-
Notifications
You must be signed in to change notification settings - Fork 76
90 lines (86 loc) · 2.81 KB
/
tests.yml
File metadata and controls
90 lines (86 loc) · 2.81 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
name: Tests
on:
push:
pull_request:
jobs:
image-compression:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./bin/check-images.sh
shellcheck:
timeout-minutes: 2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install shellcheck
- run: ./bin/check-scripts.sh
unit-tests:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: 'npm'
- run: npm ci
- run: npm run lint
- uses: browser-actions/setup-chrome@v2
- run: npm run test
e2e-tests:
needs:
- image-compression
- shellcheck
- unit-tests
timeout-minutes: 120
runs-on: ubuntu-latest
steps:
# This one weird trick speeds up every build!
# see: https://github.com/getodk/central-backend/pull/1642
# see: https://github.com/actions/runner/issues/4030
- run: sudo apt-get remove --purge man-db
- uses: actions/checkout@v4
with:
path: client
fetch-depth: 0
- name: Clone getodk/central repo
run: |
git clone -b next https://github.com/getodk/central.git
cd central
git submodule set-branch -b master server
git submodule update --init --remote server
mv ../client .
- name: Modify files
working-directory: central
run: |
yq e '.services.enketo.extra_hosts += ["${DOMAIN}:host-gateway"]' -i docker-compose.yml
sed -i 's|\${BASE_URL}|http://${DOMAIN}|g' files/enketo/config.json.template
sed -i 's|\${BASE_URL}|http://${DOMAIN}|g' files/service/config.json.template
sed -i 's/\$scheme/https/g' files/nginx/backend.conf
sed 's/your.domain.com/central-test.localhost/; s/^SSL_TYPE=letsencrypt/SSL_TYPE=upstream/' .env.template > .env
echo PGHOST=postgres14 >> .env
echo PGUSER=odk >> .env
echo PGPASSWORD=odk >> .env
echo PGPORT=5432 >> .env
- name: Add domain
run: echo '127.0.0.1 central-test.localhost' | sudo tee --append /etc/hosts
- name: Start services
working-directory: central
run: touch ./files/allow-postgres14-upgrade && docker compose build && docker compose up -d
- name: Set node version
uses: actions/setup-node@v4
with:
node-version-file: central/client/package.json
cache: 'npm'
cache-dependency-path: 'central/client/package-lock.json'
- name: Run tests
working-directory: central
run: client/e2e-tests/run-tests.sh --domain=central-test.localhost --port=80
- name: Archive playwright result
if: failure()
uses: actions/upload-artifact@v4
with:
name: Playwright Artifacts
path: central/client/test-results