-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (104 loc) · 4.23 KB
/
tests.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
name: Tests
on: push
jobs:
# Label of the runner job
tests:
# You must use a Linux environment when using service containers or container jobs
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps TCP port 5433 on the host to Postgres
- 5433:5432
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5433/collimator?schema=public"
steps:
- name: Enable Corepack
run: corepack enable
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: 'true'
lfs: 'true'
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install backend dependencies
working-directory: ./backend
run: yarn install
- name: Install frontend dependencies
working-directory: ./frontend
run: yarn install
- name: Install scratch app dependencies
working-directory: ./apps/scratch
run: yarn install
- name: Install playwright dependencies
working-directory: ./apps/scratch
run: yarn playwright install --with-deps
- name: Lint backend
working-directory: ./backend
run: yarn lint
- name: Lint frontend
working-directory: ./frontend
run: yarn lint
- name: Lint scratch app
working-directory: ./apps/scratch
run: yarn lint
- name: Build backend
working-directory: ./backend
run: yarn build
- name: Build frontend
working-directory: ./frontend
run: yarn build
- name: Prepare scratch app build
working-directory: ./apps/scratch
run: yarn prepublish
- name: Build scratch app
working-directory: ./apps/scratch
run: yarn build
- name: Prepare test database
working-directory: ./backend
run: yarn prisma migrate deploy
- name: Test backend
working-directory: ./backend
run: yarn test:cov
- name: End-to-end Test backend
working-directory: ./backend
run: yarn test:e2e:cov
- name: Test frontend
working-directory: ./frontend
run: yarn test:cov
- name: Start storybook
working-directory: ./frontend
run: yarn storybook & PID=$!; echo $PID > storybook.pid
- name: Wait for storybook to be accessible
working-directory: ./frontend
run: yarn storybook:await
- name: Run storybook tests
working-directory: ./frontend
run: yarn test:storybook
- name: Stop storybook
working-directory: ./frontend
run: kill $(cat storybook.pid)
- name: Test scratch app
working-directory: ./apps/scratch
run: yarn test
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}