-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (114 loc) · 3.64 KB
/
main-ci.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
name: Main CI
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
pre-commit-check:
name: Check pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Pre-commit
run: pip install pre-commit
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Prettier
working-directory: ./frontend
run: |
pnpm install --frozen-lockfile
pnpm run format-check
- run: pre-commit run --all-files
build-backend:
name: Build Backend
uses: ./.github/workflows/build.yml
with:
image: ghcr.io/dnum-mi/basegun/basegun-backend
context: ./backend
build-frontend:
name: Build Frontend
uses: ./.github/workflows/build.yml
with:
image: ghcr.io/dnum-mi/basegun/basegun-frontend
context: ./frontend
test-backend:
name: Test Backend
needs: build-backend
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Start stack using docker compose
run: IMAGE_TAG=${{ needs.build-backend.outputs.image_tag }} docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d
- run: docker compose exec backend coverage run -m pytest
- run: docker compose exec backend coverage xml --ignore-errors
- name: Produce the coverage report
uses: insightsengineering/coverage-action@v2
with:
coverage-summary-title: Backend Coverage Summary
path: ./backend/coverage.xml
publish: true
threshold: 80
diff-storage: _xml_coverage_reports_backend
test-frontend-format:
name: Test Frontend Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Run Prettier check
working-directory: ./frontend
run: |
pnpm install --frozen-lockfile
pnpm run format-check
test-e2e:
name: Run E2E tests
needs: [build-backend, build-frontend]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Start stack using docker compose
run: IMAGE_TAG=${{ needs.build-backend.outputs.image_tag }} docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: ./frontend
build: pnpm run build
start: pnpm run start
command: pnpm run test:e2e-ci
- name: Install pycobertura
run: pip install pycobertura
- name: Generate cobertura report
working-directory: ./frontend
run: npx nyc report --reporter=cobertura
- name: Produce coverage report
uses: insightsengineering/coverage-action@v2
with:
coverage-summary-title: Frontend Coverage Summary
path: ./frontend/coverage/cobertura-coverage.xml
publish: true
threshold: 75
diff-storage: _xml_coverage_reports_frontend
- name: Send artifacts
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: cypress-screenshots
path: ./frontend/cypress/screenshots/