-
Notifications
You must be signed in to change notification settings - Fork 7
158 lines (157 loc) · 5.37 KB
/
integration-tests.yml
File metadata and controls
158 lines (157 loc) · 5.37 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
name: Integration tests
on:
workflow_dispatch:
inputs:
subcomponent:
description: 'Which test suite to run'
required: false
default: 'all'
type: choice
options:
- all
- chromium
- firefox
- cli
pull_request:
paths:
- "backend/**"
- "keycloak/**"
- "kubernetes/**"
- "preprocessing/**"
- "website/**"
- "deploy.py"
- "integration-tests/**"
- ".github/scripts/**"
- ".github/workflows/**"
push:
branches:
- main
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
if [ "${{ github.event_name }}" != "workflow_dispatch" ] || [ "${{ inputs.subcomponent }}" == "all" ]; then
echo 'matrix=["chromium","firefox","cli"]' >> $GITHUB_OUTPUT
else
echo 'matrix=["${{ inputs.subcomponent }}"]' >> $GITHUB_OUTPUT
fi
integration-tests:
needs: setup
permissions:
packages: read
contents: read
checks: read
actions: read # Required by workflow-telemetry-action
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
browser: ${{ fromJSON(needs.setup.outputs.matrix) }}
timeout-minutes: 45
env:
sha: ${{ github.event.pull_request.head.sha || github.sha }}
wait_timeout: ${{ github.ref == 'refs/heads/main' && 900 || 600 }}
steps:
- name: Shorten sha
run: echo "sha=${sha::7}" >> $GITHUB_ENV
- name: Get runner IP
run: curl -4 ifconfig.me
- name: Collect Workflow Telemetry
uses: ycfreeman/workflow-telemetry-action@cad169ff11f718319d5468b0a67a238db000ef3f
- name: Checkout repository
uses: actions/checkout@v6
- name: Install k3d
run: |
for i in {1..5}; do
curl https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | DEBUG=true bash && break || sleep $((i * 2))
done
k3d version
- uses: azure/setup-helm@v5
with:
version: v3.18.3
- name: Create k3d cluster
run: |
./deploy.py --verbose cluster --bind-all
- name: Deploy with Helm
run: |
./deploy.py --verbose helm \
--branch ${{ github.ref_name }} \
--sha ${{ env.sha }} \
--for-e2e \
--enablePreprocessing \
--use-localhost-ip
- uses: actions/setup-node@v6
with:
node-version-file: ./integration-tests/.nvmrc
- name: Cache .npm
uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('integration-tests/**/package-lock.json') }}
- name: Install dependencies
run: cd integration-tests && npm ci
- name: Install Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install CLI
run: cd cli && uv sync && uv build && uv pip install --system dist/*.whl
- name: Install keyring backend for CLI
run: uv pip install --system keyrings.alt
# Firefox's readonly-setup is also done with Chromium
- name: Install Playwright Browsers and System Dependencies
run: cd integration-tests && npx playwright install --with-deps --only-shell chromium ${{ matrix.browser == 'firefox' && 'firefox' || '' }}
- name: Wait for the pods to be ready
run: ./.github/scripts/wait_for_pods_to_be_ready.py --timeout ${{ env.wait_timeout }}
- name: Sleep for 10 secs
run: sleep 10
- name: Run Integration test
env:
BROWSER: ${{ matrix.browser == 'cli' && 'chromium' || matrix.browser }}
TEST_SUITE: ${{ matrix.browser == 'cli' && 'cli' || 'browser' }}
run: |
set -o pipefail
cd integration-tests && npx playwright test --workers=2 --reporter=list,html 2>&1 | tee output.txt
EXIT_CODE=$?
echo '```' >> $GITHUB_STEP_SUMMARY
sed -n '/Running [0-9]\+ tests/,$p' output.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
exit $EXIT_CODE
- uses: actions/upload-artifact@v7
if: always()
with:
name: playwright-report-${{ matrix.browser }}
path: integration-tests/playwright-report/
retention-days: 30
- name: List running pods
if: ${{ !cancelled() }}
run: kubectl get pods --all-namespaces
- name: Describe pods
if: ${{ !cancelled() }}
run: |
mkdir -p pod_descriptions
kubectl describe pods -l app=loculus | tee pod_descriptions/describe_pods.txt
- name: Upload pod descriptions
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: pod-descriptions-${{ matrix.browser }}
path: pod_descriptions/
- name: Show events
if: ${{ !cancelled() }}
run: kubectl get events
- name: Save logs from all containers to file
if: ${{ !cancelled() }}
run: ./.github/scripts/collect_kubernetes_logs.sh
- name: Upload Kubernetes logs
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: kubernetes-logs-${{ matrix.browser }}
path: kubernetes_logs/