-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (57 loc) · 1.92 KB
/
api-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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: PR - API
on:
pull_request:
branches:
- master
- '!release-please**'
paths:
- 'api/**'
env:
NODE_VERSION: '20'
PNPM_VERSION: 8
jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
if: contains(fromJson('["ved-bot", "renovate[bot]"]'), github.actor) == false
services:
postgres:
image: postgres:13.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432/tcp
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ env.NODE_VERSION }}
- name: Install packages
run: pnpm install
- name: Init
run: pnpm run init --no-client
env:
DATABASE_URL: 'postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres'
- name: Test and Coverage (PR)
uses: anuraag016/Jest-Coverage-Diff@master
with:
accessToken: '${{ secrets.GH_BOT_TOKEN }}'
runCommand: 'pnpm run --filter ./api coverage'
delta: 100 # Delta of % changed that would make this job fail
total_delta: 100
afterSwitchCommand: 'pnpm i && pnpm run init --no-client'
useSameComment: true
env:
DATABASE_URL: 'postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres'
TEST_DATABASE_URL: 'postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres'
COV_REPORTER: 'json-summary'
COV_DIRECTORY: '../'