-
Notifications
You must be signed in to change notification settings - Fork 18
154 lines (153 loc) · 5.81 KB
/
test-runner-ci.yaml
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Test Runner CI
on:
merge_group: null
pull_request_target:
types: [opened, edited, reopened, synchronize]
branches: [main]
paths:
- 'test-runner/**'
push:
branches:
- main
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
unit-test:
runs-on: k8-runners
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: true
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'push' }}
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'pull_request_target' }}
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'merge_group' }}
with:
fetch-depth: 0
ref: ${{ github.event.merge_group.head_ref }}
- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
with:
driver: docker
- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python }}
- name: Install requirements
run: python -m pip install -U pip tox-gh-actions
- name: Tox
run: python -m tox
env:
CACHE_REGISTRY: ${{ secrets.CACHE_REGISTRY }}
FORCE_COLOR: 1
REGISTRY: ${{ secrets.REGISTRY }}
REPO: ${{ secrets.REPO }}
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: covdata-${{ matrix.python }}
path: ${{ github.workspace }}/.coverage*
coverage:
needs: [unit-test]
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'push' }}
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'pull_request_target' }}
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'merge_group' }}
with:
fetch-depth: 0
ref: ${{ github.event.merge_group.head_ref }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: "3.10"
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
merge-multiple: true
- name: Coverage
run: |
python -m pip install coverage
python -m coverage combine --debug=pathmap
python -m coverage xml --skip-empty
- name: Comment on PR
if: ${{ github.event_name == 'pull_request' }}
uses: orgoro/coverage@4e3bc9302f715595336a40f7dd4a3b15c687bdb4 # v3.1
with:
coverageFile: coverage.xml
token: ${{ secrets.ACTION_TOKEN }}
treshholdAll: 80
integration-test:
runs-on: k8-runners
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'push' }}
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'pull_request_target' }}
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
if: ${{ github.event_name == 'merge_group' }}
with:
fetch-depth: 0
ref: ${{ github.event.merge_group.head_ref }}
- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
with:
driver: docker
- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: "3.8"
- name: Test Container Group
uses: intel/ai-containers/test-runner@28ee014b2e4e9ffc4126d1b226691e5c72b75df5 # main
with:
cache_registry: ${{ secrets.CACHE_REGISTRY }}
recipe_dir: test-runner
registry: ${{ secrets.REGISTRY }}
repo: ${{ secrets.REPO }}
test_dir: test-runner
token: ${{ secrets.ACTION_TOKEN }}