-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (75 loc) · 2.26 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
86
87
88
89
name: Test the application
on: [pull_request]
jobs:
lint-frontend:
name: Lint Frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package.json
- name: Frontend lint
run: |
npm install
npm run lint
lint-backend:
name: Lint Backend
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: backend/package.json
- name: Backend lint
run: |
yarn
yarn run lint
format-check:
name: Code Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
- name: Format check
run: npx -y prettier --check frontend backend
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate .env file
run: |
touch .env
echo "NGINX_PORT=${{ vars.NGINX_PORT }}" >> .env
echo "PUBLIC_API_URL=${{ vars.PUBLIC_API_URL }}" >> .env
echo "FRONTEND_PORT=${{ vars.FRONTEND_PORT }}" >> .env
echo "BACKEND_PORT=${{ vars.BACKEND_PORT }}" >> .env
echo "BACKEND_JWT_SECRET=${{ vars.BACKEND_JWT_SECRET }}" >> .env
echo "POSTGRES_USER=${{ vars.POSTGRES_USER }}" >> .env
echo "POSTGRES_PASSWORD=${{ vars.POSTGRES_PASSWORD }}" >> .env
echo "POSTGRES_DB=${{ vars.POSTGRES_DB }}" >> .env
- name: Build images
run: docker compose build
- name: Build frontend
run: docker compose run --rm frontend npm run build && docker compose down
- name: Run backend unit tests
run: docker compose run backend yarn test
- name: Run backend e2e tests
run: docker compose run backend yarn test:e2e