-
Notifications
You must be signed in to change notification settings - Fork 80
126 lines (102 loc) · 3.46 KB
/
Copy pathserver-test.yaml
File metadata and controls
126 lines (102 loc) · 3.46 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
name: Test for the server/ directory
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-headful:
uses: ./.github/workflows/chromium-headful-image.yaml
secrets: inherit
build-headless:
uses: ./.github/workflows/chromium-headless-image.yaml
secrets: inherit
test-server-unit:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "server/go.mod"
cache: true
cache-dependency-path: server/go.sum
# categorygen's checks (unclassified route, category that isn't control or
# platform, classified route with no handler) only run when the generator
# does, and its only other caller is `make oapi-generate`, which needs the
# npm down-converter. Running it here enforces them on every change.
- name: Check generated event categories are current
run: |
go generate ./lib/events/...
git diff --exit-code -- lib/events/category_gen.go
working-directory: server
- name: Run server unit tests
run: make test-unit
working-directory: server
test-server-e2e:
runs-on: ubuntu-latest
needs: [build-headful, build-headless]
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Chrome
uses: browser-actions/setup-chrome@v2
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Add pnpm to PATH
run: |
echo "$PNPM_HOME" >> "$GITHUB_PATH"
export PATH="$PNPM_HOME:$PATH"
pnpm --version
- name: Install Playwright e2e dependencies
run: pnpm install --frozen-lockfile
working-directory: server/e2e/playwright
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "server/go.mod"
cache: true
cache-dependency-path: server/go.sum
- name: Compute short SHA for images
id: vars
shell: bash
run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pull e2e images
shell: bash
run: |
set -euo pipefail
docker pull "$E2E_CHROMIUM_HEADFUL_IMAGE" &
headful_pid=$!
docker pull "$E2E_CHROMIUM_HEADLESS_IMAGE" &
headless_pid=$!
wait "$headful_pid"
wait "$headless_pid"
env:
E2E_CHROMIUM_HEADFUL_IMAGE: onkernel/chromium-headful:${{ steps.vars.outputs.short_sha }}
E2E_CHROMIUM_HEADLESS_IMAGE: onkernel/chromium-headless:${{ steps.vars.outputs.short_sha }}
- name: Run server e2e tests
run: make test-e2e
working-directory: server
env:
E2E_CHROMIUM_HEADFUL_IMAGE: onkernel/chromium-headful:${{ steps.vars.outputs.short_sha }}
E2E_CHROMIUM_HEADLESS_IMAGE: onkernel/chromium-headless:${{ steps.vars.outputs.short_sha }}