Skip to content

Commit 6441714

Browse files
authored
ADDED: Dockerfiles and RAISR build (#20)
* FIX:L Update codeql.yml with proper script * Update codeql-config.yml * Update codeql.yml * FIX: Update codeql.yml with proper script Update codeql.yml with proper script Update codeql-config.yml Update codeql.yml * ADD super-linter: perform super-linter scan workflow using config files: Linter to Dependency-Review.yml Create Hadolint.yaml for Docker Scaning actions Created template for docker-cached-build Create template-docker-cached-build.yaml Create docker-cached-build.yaml Minor changes to ubuntu build Minor update to Flex Ubuntu22 --------- Signed-off-by: Miłosz Linkiewicz <milosz.linkiewicz@intel.com>
1 parent bb2bcd5 commit 6441714

21 files changed

+892
-328
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@
33
./license*
44
./test*
55
*Dockerfile*
6+
.github/**
7+
.vscode**
8+
./_build/*
9+
./build/*
10+
./docs*
11+
./_install*

.github/codeql/codeql-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
name: "MCM CodeQL Config"
1+
name: "RAISR CodeQL Config"

.github/configs/hadolint.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ignored:
2+
- DL3002 # DL3002 Last user should not be root.
3+
- DL3006 # DL3006 Always tag the version of an image explicitly
4+
- DL3008 # DL3008⁠ Pin versions in apt-get install.
5+
- DL3013 # DL3013 Pin versions in pip.
6+
- DL3016 # DL3016 Pin versions in npm.
7+
- DL3018 # DL3018 Pin versions in apk add. Instead of apk add <package> use apk add <package>=<version>.
8+
- DL3028 # DL3028 Pin versions in gem install. Instead of gem install <gem> use gem install <gem>:<version>.
9+
- DL3033 # DL3033 warning: Specify version with `yum install -y <package>-<version>`.
10+
- SC2086 # SC2086 Double quote to prevent globbing and word splitting.
11+
- SC2267 # SC2267 info: GNU xargs -i is deprecated in favor of -I{}
12+
trustedRegistries:
13+
- docker.io
14+
- gcr.io
15+
- ghcr.io
16+
- quay.io
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BasedOnStyle: LLVM
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
MD013:
25+
line_length: 400 # Line length 80 is far too short
26+
MD026:
27+
punctuation: ".,;:!。,;:" # List of not allowed
28+
MD029: false # Ordered list item prefix
29+
MD033: false # Allow inline HTML
30+
MD036: false # Emphasis used instead of a heading
31+
32+
#################
33+
# Rules by tags #
34+
#################
35+
blank_lines: false # Error on blank lines
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
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: build-baremetal-ubuntu
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
workflow_dispatch:
9+
10+
env:
11+
TZ: "Europe/Warsaw"
12+
BUILD_TYPE: "Release"
13+
DEBIAN_FRONTEND: "noninteractive"
14+
FFMPEG_COMMIT_ID: "n6.1.1"
15+
BUILD_DIR: "${{ github.workspace }}/build"
16+
PREFIX: "${{ github.workspace }}/_install"
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
permissions:
23+
contents: read
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
build-baremetal-ubuntu:
31+
runs-on: 'ubuntu-22.04'
32+
timeout-minutes: 70
33+
env:
34+
LD_LIBRARY_PATH: "/opt/intel/oneapi/ipp/latest/lib:${PREFIX}/usr/lib:${PREFIX}/lib:${PREFIX}/lib64:${LD_LIBRARY_PATH}"
35+
steps:
36+
- name: 'Harden Runner'
37+
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
38+
with:
39+
egress-policy: audit
40+
41+
- name: 'Checkout repository'
42+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
43+
44+
- name: 'Install OS level dependencies'
45+
run: |
46+
set -exo pipefail && \
47+
mkdir -p "${PREFIX}" "${BUILD_DIR}/ffmpeg" && \
48+
sudo apt-get update --fix-missing && \
49+
sudo apt-get full-upgrade -y && \
50+
sudo apt-get install --no-install-recommends -y \
51+
build-essential \
52+
ca-certificates \
53+
cmake \
54+
curl \
55+
diffutils \
56+
git \
57+
gpg \
58+
libx264-dev \
59+
libx265-dev \
60+
nasm \
61+
ocl-icd-opencl-dev \
62+
opencl-headers \
63+
tar \
64+
unzip \
65+
wget \
66+
zlib1g-dev
67+
68+
- name: 'Install Intel OneAPI APT repository'
69+
run: |
70+
set -exo pipefail && \
71+
curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg && \
72+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/intel-oneAPI.list && \
73+
sudo apt-get update --fix-missing && \
74+
sudo apt-get install --no-install-recommends -y intel-oneapi-ipp-devel-2022.0
75+
76+
- name: 'Download and patch ffmpeg repository'
77+
run: |
78+
set -eo pipefail && \
79+
curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | tar -zx --strip-components=1 -C "${BUILD_DIR}/ffmpeg"
80+
patch -d "${BUILD_DIR}/ffmpeg" -p1 -i <(cat "${{ github.workspace }}/ffmpeg/"*.patch)
81+
cp "${{ github.workspace }}/ffmpeg/vf_raisr"*.c "${BUILD_DIR}/ffmpeg/libavfilter"
82+
83+
- name: 'Build RAISR from source code'
84+
run: |
85+
./build.sh -DENABLE_RAISR_OPENCL=ON \
86+
-DCMAKE_LIBRARY_PATH="/opt/intel/oneapi/ipp/latest/lib;${PREFIX}/lib;" \
87+
-DCMAKE_C_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp" \
88+
-DCMAKE_CXX_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp"
89+
90+
- name: 'Configure ffmpeg repository'
91+
working-directory: "${BUILD_DIR}/ffmpeg"
92+
continue-on-error: true
93+
run: |
94+
./configure \
95+
--disable-shared \
96+
--disable-debug \
97+
--disable-doc \
98+
--enable-static \
99+
--enable-libipp \
100+
--enable-gpl \
101+
--enable-libx264 \
102+
--enable-libx265 \
103+
--enable-opencl \
104+
--extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm' \
105+
--extra-cflags='-fopenmp -I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp' \
106+
--extra-ldflags="-fopenmp -L/opt/intel/oneapi/ipp/latest/lib -L${PREFIX}/lib" \
107+
--enable-cross-compile \
108+
--prefix="${PREFIX}" || \
109+
{ tail -n 100 "${BUILD_DIR}/ffmpeg/ffbuild/config.log && exit 1 }
110+
111+
- name: 'Build, install and check ffmpeg'
112+
working-directory: "${BUILD_DIR}/ffmpeg"
113+
continue-on-error: true
114+
run: |
115+
make clean
116+
make -j"$(nproc)"
117+
sudo -E make install
118+
sudo -E ldconfig
119+
ffmpeg -buildconf

.github/workflows/codeql.yml

Lines changed: 68 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
1-
name: "CodeQL"
1+
name: scan-codeql-workflow
22

33
on:
44
push:
5-
branches: [ "master", "main", "dev" ]
5+
branches: [ "main" ]
66
pull_request:
7-
branches: [ "master", "main", "dev" ]
7+
branches: [ "main" ]
88
schedule:
9-
- cron: '42 8 * * 1'
9+
- cron: '15 0 * * *'
1010

1111
env:
12-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
13-
BUILD_TYPE: Release
14-
PREFIX_DIR: /usr/local
15-
DEBIAN_FRONTEND: noninteractive
12+
TZ: "Europe/Warsaw"
13+
BUILD_TYPE: "Release"
14+
DEBIAN_FRONTEND: "noninteractive"
15+
FFMPEG_COMMIT_ID: "n6.1.1"
16+
BUILD_DIR: "${{ github.workspace }}/build"
17+
PREFIX: "${{ github.workspace }}/_install"
18+
19+
defaults:
20+
run:
21+
shell: bash
1622

1723
permissions:
1824
contents: read
1925

26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
28+
cancel-in-progress: true
29+
2030
jobs:
2131
analyze:
22-
name: Analyze
32+
name: 'scan-codeql-workflow-analyze'
2333
runs-on: ${{ matrix.runner-os }}
2434
timeout-minutes: 90
2535
strategy:
@@ -28,12 +38,7 @@ jobs:
2838
runner-os: [ 'ubuntu-22.04' ]
2939
permissions:
3040
actions: read
31-
contents: read
3241
security-events: write
33-
defaults:
34-
run:
35-
shell: bash
36-
3742
steps:
3843
- name: 'Harden Runner'
3944
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
@@ -43,24 +48,58 @@ jobs:
4348
- name: 'Checkout repository'
4449
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
4550

46-
- name: 'Initialize CodeQL'
51+
- name: 'Install OS level dependencies'
52+
run: |
53+
set -exo pipefail && \
54+
mkdir -p "${PREFIX}" "${BUILD_DIR}/ffmpeg" && \
55+
sudo apt-get update --fix-missing && \
56+
sudo apt-get full-upgrade -y && \
57+
sudo apt-get install --no-install-recommends -y \
58+
build-essential \
59+
ca-certificates \
60+
cmake \
61+
diffutils \
62+
gpg \
63+
libx264-dev \
64+
libx265-dev \
65+
llvm \
66+
m4 \
67+
meson \
68+
nasm \
69+
ocl-icd-opencl-dev \
70+
opencl-headers \
71+
zlib1g-dev \
72+
make curl git sudo tar unzip wget yasm
73+
74+
- name: 'Install Intel OneAPI APT repository'
75+
run: |
76+
set -exo pipefail && \
77+
curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg && \
78+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/intel-oneAPI.list && \
79+
sudo apt-get update --fix-missing && \
80+
sudo apt-get install --no-install-recommends -y intel-oneapi-ipp-devel-2022.0
81+
82+
- name: 'Download and patch ffmpeg repository'
83+
run: |
84+
set -exo pipefail && \
85+
curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | tar -zx --strip-components=1 -C "${BUILD_DIR}/ffmpeg"
86+
patch -d "${BUILD_DIR}/ffmpeg" -p1 -i <(cat "${{ github.workspace }}/ffmpeg/"*.patch)
87+
cp "${{ github.workspace }}/ffmpeg/vf_raisr"*.c "${BUILD_DIR}/ffmpeg/libavfilter"
88+
89+
- name: 'Initialize CodeQL action'
4790
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
4891
with:
49-
languages: 'c-cpp'
50-
build-mode: autobuild
51-
# config-file: ${{ github.workspace }}/.github/codeql/codeql-config.yml
92+
languages: "c-cpp"
93+
config-file: "${{ github.workspace }}/.github/codeql/codeql-config.yml"
5294

53-
- if: matrix.build-mode == 'manual'
54-
shell: bash
95+
- name: 'Build RAISR from source code'
5596
run: |
56-
echo 'If you are using a "manual" build mode for one or more of the' \
57-
'languages you are analyzing, replace this with the commands to build' \
58-
'your code, for example:'
59-
echo ' make bootstrap'
60-
echo ' make release'
61-
exit 1
97+
"${{ github.workspace }}/build.sh" -DENABLE_RAISR_OPENCL=ON \
98+
-DCMAKE_LIBRARY_PATH="/opt/intel/oneapi/ipp/latest/lib;${PREFIX}/lib;" \
99+
-DCMAKE_C_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp" \
100+
-DCMAKE_CXX_FLAGS="-I/opt/intel/oneapi/ipp/latest/include -I/opt/intel/oneapi/ipp/latest/include/ipp"
62101
63-
- name: Perform CodeQL Analysis
64-
uses: github/codeql-action/analyze@v3
102+
- name: 'Perform CodeQL Analysis'
103+
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
65104
with:
66-
category: "/language:${{matrix.language}}"
105+
category: "/language:c-cpp"

0 commit comments

Comments
 (0)