-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (68 loc) · 2.01 KB
/
test.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
name: Lint and test
on: [push]
env:
COMPOSE_FILE: .github/docker-compose.yml
jobs:
backend:
name: Backend
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker images
uses: docker/bake-action@v4
with:
workdir: .github
targets: backend
set: |
*.cache-to=type=gha,mode=max
*.cache-from=type=gha
load: true
- name: Run backend
run: docker compose up --wait backend
- name: Type check
run: docker compose exec backend npm run type-check
- name: Lint
run: docker compose exec backend npm run lint
- name: Run unit and integration tests
if: always()
run: docker compose exec backend npm test
- name: Run e2e tests
if: always()
run: docker compose exec backend npm run e2e-test
- name: Shutdown backend
if: always()
run: docker compose down
- name: Print logs
if: always()
run: docker compose logs
frontend:
name: Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker images
uses: docker/bake-action@v4
with:
workdir: .github
targets: frontend
set: |
*.cache-to=type=gha,mode=max
*.cache-from=type=gha
load: true
- name: Install dependencies
run: |
docker compose run frontend npm install
docker compose run frontend sh -c 'cd /shared && npm install'
- name: Lint frontend
run: docker compose run frontend npm run lint
- name: Run unit tests
run: docker compose run frontend npm run test:unit
- name: Print logs
if: always()
run: docker compose logs