-
Notifications
You must be signed in to change notification settings - Fork 38
237 lines (206 loc) · 7.32 KB
/
tests-bat.yml
File metadata and controls
237 lines (206 loc) · 7.32 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
---
# SPDX-FileCopyrightText: (C) 2025-2026 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set paths filter
id: filter
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
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]
permissions:
packages: write # For using GHCR as cache registry
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
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: "Log in to GHCR"
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Log in to DockerHub"
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
username: scenescape
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Setup Cache Targets"
id: setup-cache
uses: ./.github/actions/setup-cache
- name: "Run Basic Acceptance Tests (BAT)"
env:
CACHE_REGISTRY: ${{ steps.setup-cache.outputs.cache_registry }}
CACHE_TAG: ${{ steps.setup-cache.outputs.cache_tag }}
GITHUB_ACTIONS_CACHE: ${{ steps.setup-cache.outputs.github_actions_cache }}
run: |
make clean-all
git clean -fdx
make run_basic_acceptance_tests
- name: Upload Logs and Reports
if: always()
uses: ./.github/actions/upload-artifacts
- name: Cleanup
if: always()
uses: ./.github/actions/cleanup
chart-deployment-test:
name: "Chart Deployment Test"
runs-on: [bat]
permissions:
packages: write # For using GHCR as cache registry
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.x"
check-latest: true
- name: "Log in to GHCR"
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Log in to DockerHub"
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
username: scenescape
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Setup Cache Targets"
id: setup-cache
uses: ./.github/actions/setup-cache
- name: Install chart with timeout
env:
CACHE_REGISTRY: ${{ steps.setup-cache.outputs.cache_registry }}
CACHE_TAG: ${{ steps.setup-cache.outputs.cache_tag }}
GITHUB_ACTIONS_CACHE: ${{ steps.setup-cache.outputs.github_actions_cache }}
run: |
KUBERNETES=1 DEPLOYMENT_TEST=1 ./deploy.sh
- name: Stability test (2m)
run: make -C kubernetes test
- name: Fetch stability test logs
if: always()
run: kubectl logs -n scenescape scenescape-release-1-test-stability || true
- name: Print all pods
if: always()
run: kubectl get pods,deployments,services -n scenescape -o wide
- name: Print all logs
if: always()
run: |
kubectl get pods -n scenescape -o name | xargs -r -n1 -I{} sh -c 'echo "===== {} ====="; kubectl logs -n '"$NAMESPACE"' {} --all-containers --tail=500 || true'
- name: Cleanup
if: always()
uses: ./.github/actions/cleanup