-
Notifications
You must be signed in to change notification settings - Fork 4
48 lines (39 loc) · 1.37 KB
/
backend-test-coverage.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
name: Backend test coverage
on:
push:
workflow_dispatch:
env:
MIN_COVERAGE: 40
jobs:
backend-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
working-directory: backend
run: yarn
- name: Run backend tests
working-directory: backend
run: yarn test-ci
- name: Check test coverage
working-directory: backend
run: |
pct=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct')
echo "current test coverage: $pct% (min required: $MIN_COVERAGE%)"
if (( pct < $MIN_COVERAGE )); then
exit 1
fi
# We need to create a empty "frontend" folder to silence below vercel build error and allow "Ignored Build Step" to run
# which will stop vercel build for "gh-pages"
# Error: The specified Root Directory "frontend" does not exist. Please update your Project Settings.
- name: Creating empty frontend folder
run: |
mkdir -p ./backend/coverage/frontend
touch ./backend/coverage/frontend/empty
tree -I node_modules
- name: Move coverage report to gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./backend/coverage
publish_branch: gh-pages