-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (81 loc) · 3.15 KB
/
ci.yml
File metadata and controls
99 lines (81 loc) · 3.15 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
name: XCCup CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: 👀 Checkout repo
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: 🕸 Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
#cache: "pnpm"
- name: 🙄 Check for "only" in test files (client)
working-directory: ./client/cypress/e2e
# Grep will exit with 1 if no matching line in any file was found
# Therefore we will invert the result of grep
# Exit codes !0 will fail the whole workflow
run: (! grep -r "it.only" .)
- name: Check for "only" in test files (server)
working-directory: ./server/test
run: (! grep -r "test.only" .)
- name: 🖥 Install backend
run: chmod -R 777 . && docker compose -f docker-compose-ci.yml run --rm pnpm install
working-directory: ./server
- name: 🚿 Lint backend
run: docker compose -f docker-compose-ci.yml run --rm pnpm run lint
working-directory: ./server
- name: 🕵️ Add secrets to ENV
run: echo "METAR_API_KEY=${{ secrets.METAR_API_KEY }}" >> ./.env.ci
working-directory: ./server
- name: 🧪 Test backend
run: docker compose -f docker-compose-ci.yml run --rm -e NODE_ENV=CI pnpm run test
working-directory: ./server
- name: 🐳 Start Docker Backend Environment
run: docker compose -f docker-compose-ci.yml --env-file ./.env.ci up -d
working-directory: ./server
- name: 📝 List all databases (just for debugging)
run: sleep 10 && docker exec db psql -U xccup_user -l
- name: 🛠 Setup DB (enable PostGIS and set correct timezone)
run: docker exec db psql -U xccup_user xccup_db -c "set timezone='Europe/Berlin'"
working-directory: ./server
- name: 💻 Install and build frontend
run: pnpm install && pnpm run build-local
working-directory: ./client
- name: 🖨 Print current server log before testing (just for debugging)
run: docker logs server
- name: 🏃♀️ Cypress run
uses: cypress-io/github-action@v6
with:
install: false
start: docker compose -f docker-compose-ci.yml up -d
wait-on: http://localhost:4173
working-directory: ./client
config: baseUrl=http://localhost:4173
browser: chrome
env: TZ=Europe/Berlin
- name: 😩 Store artifacts of test failures
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: ./client/cypress/screenshots
- name: 🤨 Store artifacts of server logs
uses: actions/upload-artifact@v4
if: always()
with:
name: server-logs
path: ./server/data/logs