-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (95 loc) · 2.99 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Test suites
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
python-unit-tests:
name: Tests renderer
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install poetry
run: pipx install poetry
- name: Setup poetry
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: "poetry"
- name: Install python dependencies
run: poetry install --with dev,test
- name: Run python linter
run: poetry run ruff check render_templates
if: ${{ !cancelled() }}
- name: Run python formatter
run: poetry run ruff format --check render_templates
if: ${{ !cancelled() }}
- name: Run tests and coverage
run: poetry run pytest render_templates
if: ${{ !cancelled() }}
Linter:
name: Run linters
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flavor: ["armnn", "cpu", "cuda", "noml", "openvino"]
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install poetry
run: pipx install poetry
- name: Setup poetry
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: "poetry"
- name: Install python dependencies
run: poetry install --without dev,test
- name: Create Dockerfile from template
run: poetry run python3 render_templates/main.py --flavor ${{ matrix.flavor }}
- name: Run Hadolint
uses: hadolint/[email protected]
if: ${{ !cancelled() }}
with:
dockerfile: build-${{ matrix.flavor }}/Dockerfile
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
if: ${{ !cancelled() }}
with:
scandir: build-${{ matrix.flavor }}
additional_files: "run"
- name: Check Permissions
if: ${{ !cancelled() }}
run: |
WRONG_PERM=$(find ./build-${{ matrix.flavor }} -path "./.git" -prune -o \( -name "run" -o -name "finish" -o -name "check" \) -not -perm -u=x,g=x,o=x -print)
if [ -n "${WRONG_PERM}" ]; then
for i in ${WRONG_PERM}; do
echo "::error file=${i},line=1,title=Missing Executable Bit::This file needs to be set as executable!"
done
exit 1
else
echo "**** All perms look good ****"
fi
format:
name: Prettier
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install prettier
run: npm i [email protected]
- name: Run formatter
run: npx prettier --check .