-
Notifications
You must be signed in to change notification settings - Fork 38
204 lines (179 loc) · 5.97 KB
/
tests-bat.yml
File metadata and controls
204 lines (179 loc) · 5.97 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
---
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: "[Tests] Basic Acceptance Tests"
run-name: "[Tests] Basic Acceptance Tests"
on:
workflow_dispatch:
inputs:
cleanup:
description: "Cleanup before running BAT tests"
required: false
default: false
type: boolean
timeout:
description: "Timeout for the job in minutes"
required: false
type: number
default: 60
pull_request:
branches:
- main
- release-*
types:
- opened
- synchronize
- reopened
- ready_for_review
push:
branches:
- main
- release-*
# Trigger workflow when enqueued to a merge group
# (must be under 'on')
merge_group: {}
# Only run at most 1 workflow concurrently per PR or per branch to keep costs down
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DOCKER_BUILDKIT: 1
SUPASS: demo
permissions:
contents: read
jobs:
check-pr-state:
name: "Check PR State"
runs-on: ubuntu-latest
outputs:
pr_state: ${{ steps.check_pr.outputs.pr_state }}
steps:
- name: "Return success if triggered manually"
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "Triggered manually."
exit 0
- name: Checkout code
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: "Set up GitHub CLI"
if: ${{ github.event_name == 'pull_request' }}
run: |
sudo apt-get update && sudo apt-get install gh
- name: "Check PR state"
id: check_pr
if: ${{ github.event_name == 'pull_request' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=${{ github.event.number }}
PR_STATE=$(gh pr view $PR_NUMBER --json isDraft --jq '.isDraft')
echo "pr_state=$PR_STATE" >> $GITHUB_OUTPUT
echo "PR State \"isDraft\": $PR_STATE"
filter:
name: "Filter Changed Code Paths"
needs: check-pr-state
runs-on: ubuntu-latest
if: ${{ needs.check-pr-state.outputs.pr_state != 'true' || github.event_name == 'workflow_dispatch' }}
outputs:
code_changed: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set paths filter
id: filter
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
predicate-quantifier: "every"
filters: |
code:
- '!**/*.md'
- '!**/*.rst'
- '!**/*.html'
- '!**/*.license'
- '!**/*.svg'
- '!**/*.png'
- '!**/*.jpeg'
- '!**/*.jpg'
- '!**/*.JPG'
- '!**/*.ico'
- '!**/*.pdf'
- '!LICENSES/**'
- '!docs/**'
run-basic-acceptance-tests:
name: "Run Basic Acceptance Tests"
runs-on: [bat]
timeout-minutes: ${{ fromJSON(inputs.timeout || '60') }}
needs: [filter, check-pr-state]
if: ${{ needs.filter.outputs.code_changed == 'true' && (needs.check-pr-state.outputs.pr_state != 'true' || github.event_name == 'workflow_dispatch') }}
steps:
- name: "Checkout Repository"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: "Remove all Docker images"
if: ${{ github.event.inputs.cleanup == 'true' }}
uses: ./.github/actions/cleanup
with:
system-prune: "true"
- name: "Run Basic Acceptance Tests (BAT)"
run: |
make clean-all
git clean -fdx
make run_basic_acceptance_tests
- name: "Run Basic Acceptance Tests (BAT) - k8s"
run: |
make clean-all
git clean -fdx
make run_basic_acceptance_tests_k8s SUPASS=change_me KUBERNETES=1
- name: Rename logs to remove colons
if: always()
run: |
set +e # Ignore errors if no logs are found
find . -wholename "**/test_data/**/*.log" -exec rename 's/:/-/g' {} +
exit 0
- name: Upload Test Reports
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: tests-reports
path: |
tests/**/test_reports/**/*.html
tests/**/test_reports/**/*.xml
- name: Upload Test Logs
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: tests-logs
path: |
**/test_data/**/*.log
- name: Cleanup
if: always()
uses: ./.github/actions/cleanup
chart-deployment-test:
name: "Chart Deployment Test"
runs-on: [bat]
needs: [filter, check-pr-state]
if: ${{ needs.filter.outputs.code_changed == 'true' && (needs.check-pr-state.outputs.pr_state != 'true' || github.event_name == 'workflow_dispatch') }}
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: "3.x"
check-latest: true
- name: Install chart with timeout
run: KUBERNETES=1 DEPLOYMENT_TEST=1 ./deploy.sh
- name: Print all pods
if: always()
run: kubectl get pods,deployments,services -n scenescape -o wide
- name: Cleanup
if: always()
uses: ./.github/actions/cleanup