-
Notifications
You must be signed in to change notification settings - Fork 2
172 lines (169 loc) · 6.2 KB
/
e2e-k3d.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
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
name: E2E test (on kubernetes)
on:
workflow_dispatch:
inputs:
all_browsers:
description: "Run tests on all browsers"
required: false
default: false
type: boolean
pull_request:
paths:
- "backend/**"
- "keycloak/**"
- "kubernetes/**"
- "website/**"
- "deploy.py"
- ".github/scripts/**"
- ".github/workflows/**"
push:
branches:
- main
concurrency:
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-e2e-k3d
cancel-in-progress: true
jobs:
k3d-e2e:
permissions:
packages: read
contents: read
checks: read
actions: read # Required by workflow-telemetry-action
runs-on: ubuntu-latest-m
timeout-minutes: 45
env:
ALL_BROWSERS: ${{ github.ref == 'refs/heads/main' || github.event.inputs.all_browsers && 'true' || 'false' }}
sha: ${{ github.event.pull_request.head.sha || github.sha }}
wait_timeout: ${{ github.ref == 'refs/heads/main' && 900 || 180 }}
steps:
- name: Shorten sha
run: echo "sha=${sha::7}" >> $GITHUB_ENV
- name: Collect Workflow Telemetry
uses: catchpoint/workflow-telemetry-action@v2
- name: Checkout repository
uses: actions/checkout@v4
- name: Install k3d
run: |
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
k3d version
- uses: azure/setup-helm@v4
- name: Create k3d cluster
run: |
./deploy.py --verbose cluster
- name: Default template with helm
uses: WyriHaximus/github-action-helm3@v4
with:
exec: helm template loculus kubernetes/loculus
- name: E2E Template with helm
uses: WyriHaximus/github-action-helm3@v4
with:
exec: ./deploy.py --verbose helm --branch ${{ github.ref_name }} --sha ${{ env.sha }} --for-e2e --template > /tmp/helm_template.yaml
- name: Upload default helm template
uses: actions/upload-artifact@v4
with:
name: helm-template
path: /tmp/helm_template.yaml
- name: Deploy with helm
run: |
./deploy.py --verbose helm --branch ${{ github.ref_name }} --sha ${{ env.sha }} --for-e2e
- uses: actions/setup-node@v4
with:
node-version-file: ./website/.nvmrc
- name: Cache .npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('website/**/package-lock.json') }}
- name: Install dependencies
run: cd website && npm i
- name: Get Installed Playwright Version
id: playwright-version
run: cd website && echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV
- name: Cache Playwright Browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright Browsers and System Dependencies
run: cd website && npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Install only System Dependencies
run: cd website && npx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit == 'true'
# Action misbehaved
# # Waits are identical to the update-argocd-metadata.yml file
# # Mirror changes to that file
# - name: Wait for Config Processor Docker Image
# uses: lewagon/[email protected]
# with:
# ref: ${{ github.sha }}
# check-name: Build config-processor Docker Image
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# wait-interval: 2
# - name: Wait for Backend Docker Image
# uses: lewagon/[email protected]
# with:
# ref: ${{ github.sha }}
# check-name: Build Backend Docker Image
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# wait-interval: 2
# - name: Wait for Website Docker Image
# uses: lewagon/[email protected]
# with:
# ref: ${{ github.sha }}
# check-name: Build Website Docker Image
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# wait-interval: 2
# - name: Wait for Keycloakify Docker Image
# uses: lewagon/[email protected]
# with:
# ref: ${{ github.sha }}
# check-name: Build keycloakify Docker Image
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# wait-interval: 2
# # End of wait block
- 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 E2E test
run: |
set -o pipefail
cd website && npm run e2e 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@v4
if: ${{ failure() }}
with:
name: playwright-report
path: website/playwright-report/
retention-days: 30
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: website/test-results/
retention-days: 30
- name: List running pods
if: ${{ !cancelled() }}
run: kubectl get pods --all-namespaces
- name: Describe pods
if: ${{ !cancelled() }}
run: kubectl describe pods -l app=loculus
- 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@v4
with:
name: kubernetes-logs
path: kubernetes_logs/