Skip to content

Commit 1279d38

Browse files
authored
Basic GitHub workflow creation and enablement (#2)
* ADD: GitHub workflow for super-linter ADD: GitHub workflow for super-linter with basic configuration Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> * ADD: Dependabot package control rules ADD: Dependabot package control rules basic check for github actions and docker. Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> * ADD: Build docker image template with cache ADD: Build docker image template with cache for reuse possibility. Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> * ADD: Dockerfile image build from template ADD: Dockerfile image build from template Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> * ADD: Trivy basic scans for repository ADD: Trivy basic scans for repository Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> * ADD: Scorecard workflow for repository evaluation ADD: Scorecard workflow for repository evaluation Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> * ADD: Documentation build and pages publish workflow ADD: Documentation build and pages publish workflow Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com> --------- Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com>
1 parent 926558f commit 1279d38

File tree

12 files changed

+612
-0
lines changed

12 files changed

+612
-0
lines changed

.github/configs/.markdown-lint.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
###########################
3+
###########################
4+
## Markdown Linter rules ##
5+
###########################
6+
###########################
7+
8+
# Linter rules doc:
9+
# - https://github.com/DavidAnson/markdownlint
10+
#
11+
# Note:
12+
# To comment out a single error:
13+
# <!-- markdownlint-disable -->
14+
# any violations you want
15+
# <!-- markdownlint-restore -->
16+
#
17+
18+
###############
19+
# Rules by id #
20+
###############
21+
MD004: false # Unordered list style
22+
MD007:
23+
indent: 2 # Unordered list indentation
24+
MD010: false
25+
MD013:
26+
line_length: 400 # Line length 80 is far too short
27+
MD024: false
28+
MD026: false
29+
# punctuation: ".,;:!。,;:" # List of not allowed
30+
MD029: false # Ordered list item prefix
31+
MD033: false # Allow inline HTML
32+
MD036: false # Emphasis used instead of a heading
33+
34+
#################
35+
# Rules by tags #
36+
#################
37+
blank_lines: false # Error on blank lines

.github/configs/.yaml-lint.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
###########################################
3+
# These are the rules used for #
4+
# linting all the yaml files in the stack #
5+
# NOTE: #
6+
# You can disable line with: #
7+
# # yamllint disable-line #
8+
###########################################
9+
rules:
10+
braces:
11+
level: warning
12+
min-spaces-inside: 0
13+
max-spaces-inside: 0
14+
min-spaces-inside-empty: 1
15+
max-spaces-inside-empty: 5
16+
brackets:
17+
level: warning
18+
min-spaces-inside: 0
19+
max-spaces-inside: 0
20+
min-spaces-inside-empty: 1
21+
max-spaces-inside-empty: 5
22+
colons:
23+
level: warning
24+
max-spaces-before: 0
25+
max-spaces-after: 1
26+
commas:
27+
level: warning
28+
max-spaces-before: 0
29+
min-spaces-after: 1
30+
max-spaces-after: 1
31+
comments: disable
32+
comments-indentation: disable
33+
document-end: disable
34+
document-start:
35+
level: warning
36+
present: true
37+
empty-lines:
38+
level: warning
39+
max: 2
40+
max-start: 0
41+
max-end: 0
42+
hyphens:
43+
level: warning
44+
max-spaces-after: 1
45+
indentation:
46+
level: warning
47+
spaces: consistent
48+
indent-sequences: true
49+
check-multi-line-strings: false
50+
key-duplicates: enable
51+
line-length:
52+
level: warning
53+
max: 80
54+
allow-non-breakable-words: true
55+
allow-non-breakable-inline-mappings: true
56+
new-line-at-end-of-file: disable
57+
new-lines:
58+
type: unix
59+
trailing-spaces: disable

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /.github
5+
schedule:
6+
interval: "weekly"
7+
day: "sunday"
8+
9+
- package-ecosystem: docker
10+
directory: /
11+
schedule:
12+
interval: "weekly"
13+
day: "sunday"
14+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: build images
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
build_type:
7+
required: false
8+
type: string
9+
default: 'Release'
10+
docker_registry:
11+
required: false
12+
type: string
13+
default: 'ghcr.io'
14+
docker_registry_prefix:
15+
required: false
16+
type: string
17+
default: 'openvisualcloud/media-entertainment-ai-suite'
18+
docker_registry_login:
19+
required: false
20+
type: boolean
21+
default: false
22+
docker_registry_push:
23+
required: false
24+
type: boolean
25+
default: false
26+
docker_build_args:
27+
required: false
28+
type: string
29+
default: ''
30+
docker_build_platforms:
31+
required: false
32+
type: string
33+
default: 'linux/amd64'
34+
docker_image_tag:
35+
required: false
36+
type: string
37+
docker_image_name:
38+
required: true
39+
type: string
40+
docker_file_path:
41+
required: false
42+
type: string
43+
default: './Dockerfile'
44+
secrets:
45+
docker_registry_login:
46+
required: false
47+
docker_registry_passkey:
48+
required: false
49+
50+
permissions:
51+
contents: read
52+
53+
jobs:
54+
scan-and-build-docker-image:
55+
name: "${{ inputs.docker_image_name }}: Performing scan and build of Dockerfile."
56+
runs-on: ubuntu-22.04
57+
timeout-minutes: 60
58+
env:
59+
BUILD_TYPE: "${{ inputs.build_type }}"
60+
CONCURRENCY_GROUP: "${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}"
61+
DOCKER_REGISTRY: "${{ inputs.docker_registry }}"
62+
DOCKER_REGISTRY_LOGIN: "${{ github.repository == 'openvisualcloud/media-entertainment-ai-suite' && inputs.docker_registry_login }}"
63+
DOCKER_BUILD_ARGS: "${{ inputs.docker_build_args }}"
64+
DOCKER_PLATFORMS: "${{ inputs.docker_build_platforms }}"
65+
DOCKER_IMAGE_PUSH: "${{ github.repository == 'openvisualcloud/media-entertainment-ai-suite' && inputs.docker_registry_push }}"
66+
DOCKER_IMAGE_BASE: "${{ inputs.docker_registry }}/${{ inputs.docker_registry_prefix }}"
67+
DOCKER_IMAGE_TAG: "${{ inputs.docker_image_tag || github.sha }}"
68+
DOCKER_IMAGE_NAME: "${{ inputs.docker_image_name }}"
69+
DOCKER_FILE_PATH: "${{ inputs.docker_file_path }}"
70+
steps:
71+
- name: "${{ inputs.docker_image_name }}: Harden Runner"
72+
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
73+
with:
74+
egress-policy: audit
75+
76+
- name: "${{ inputs.docker_image_name }}: Set up Docker Buildx"
77+
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
78+
with:
79+
buildkitd-flags: --debug
80+
81+
- name: "${{ inputs.docker_image_name }}: Checkout repository"
82+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
83+
84+
- name: "${{ inputs.docker_image_name }}: Build and push image"
85+
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0
86+
with:
87+
load: true
88+
push: "${{ env.DOCKER_IMAGE_PUSH }}"
89+
outputs: type=docker
90+
platforms: "${{ env.DOCKER_PLATFORMS }}"
91+
file: "${{ env.DOCKER_FILE_PATH }}"
92+
tags: "${{ env.DOCKER_IMAGE_BASE }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_IMAGE_TAG }}"
93+
cache-from: type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}
94+
cache-to: type=gha,mode=max,scope=${{ env.DOCKER_IMAGE_NAME }}
95+
build-args: "${{ env.DOCKER_BUILD_ARGS }}"

.github/workflows/docker_build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Docker Build
2+
3+
on:
4+
pull_request:
5+
branches: [ "main", "dev" ]
6+
push:
7+
branches: [ "main", "dev" ]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
ivsr-image-build:
19+
name: Build sdk Docker Image
20+
uses: ./.github/workflows/build_docker_tpl.yml
21+
with:
22+
docker_file_path: "Dockerfile"
23+
docker_image_name: "sdk"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: documentation-build-and-publish
2+
on:
3+
workflow_call:
4+
workflow_dispatch:
5+
push:
6+
branches: [ "main" ]
7+
8+
env:
9+
DEBIAN_FRONTEND: noninteractive
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
publishGitHubPages:
20+
name: Publish GitHub Pages
21+
permissions:
22+
contents: read
23+
id-token: write
24+
pages: write
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 20
30+
steps:
31+
- name: Secure the runner
32+
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
33+
with:
34+
egress-policy: audit
35+
36+
- name: Checkout
37+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
38+
39+
- name: Prepare operating system for documentation build
40+
run: |
41+
sudo apt-get update -y && \
42+
sudo apt-get install -y --no-install-recommends make python3 python3-pip python3-sphinx
43+
44+
- name: Prepare environment for documentation build
45+
run: python3 -m pip install sphinx_book_theme myst_parser sphinxcontrib.mermaid sphinx-copybutton
46+
47+
- name: Build documentation
48+
run: make -C docs/sphinx html
49+
50+
- name: Upload GitHub Pages artifact
51+
uses: actions/upload-pages-artifact@v3.0.1
52+
with:
53+
path: ./docs/_build/html
54+
55+
- name: Publish to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4

.github/workflows/linter.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Linter
2+
on:
3+
pull_request:
4+
workflow_call:
5+
workflow_dispatch:
6+
inputs:
7+
branch:
8+
description: "Branch to run the scans on"
9+
default: "main"
10+
type: string
11+
12+
permissions:
13+
contents: read
14+
jobs:
15+
super-linter:
16+
name: "super-linter: Workflow initializing"
17+
runs-on: "ubuntu-22.04"
18+
timeout-minutes: 30
19+
permissions:
20+
contents: read
21+
steps:
22+
- name: Harden Runner
23+
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
24+
with:
25+
egress-policy: audit
26+
27+
- name: checkout repository
28+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
29+
with:
30+
fetch-depth: 0
31+
ref: "${{ env.INPUT_BRANCH }}"
32+
33+
- name: Lint
34+
uses: super-linter/super-linter/slim@e1cb86b6e8d119f789513668b4b30bf17fe1efe4 # v7.2.0 x-release-please-version
35+
env:
36+
DISABLE_ERRORS: true
37+
VALIDATE_ALL_CODEBASE: false
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
BASH_SEVERITY: "warning"
40+
LINTER_RULES_PATH: ".github/configs"
41+
VALIDATE_BASH_EXEC: true
42+
VALIDATE_BASH: true
43+
VALIDATE_CPP: true
44+
VALIDATE_GITHUB_ACTIONS: true
45+
VALIDATE_JSON_PRETTIER: true
46+
VALIDATE_JSONC_PRETTIER: true
47+
VALIDATE_MARKDOWN: true
48+
VALIDATE_PYTHON_BLACK: true
49+
VALIDATE_YAML_PRETTIER: true

0 commit comments

Comments
 (0)