Skip to content

Commit 7ca7707

Browse files
committed
chore: Update Codecov workflow to run tests in the backend directory
1 parent 770db50 commit 7ca7707

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

.github/workflows/codecov.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,52 @@ jobs:
77
test:
88
name: Run tests and collect coverage
99
runs-on: ubuntu-latest
10+
1011
steps:
1112
- name: Checkout
1213
uses: actions/checkout@v4
1314
with:
1415
fetch-depth: 0
1516

16-
- name: Set up Node
17+
- uses: pnpm/action-setup@v2
18+
with:
19+
version: 8
20+
21+
- name: Setup Node.js
1722
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
cache: 'pnpm'
26+
27+
- name: Get pnpm store directory
28+
id: pnpm-cache
29+
shell: bash
30+
run: |
31+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
32+
33+
- name: Setup pnpm cache
34+
uses: actions/cache@v3
35+
with:
36+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
37+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38+
restore-keys: |
39+
${{ runner.os }}-pnpm-store-
1840
1941
- name: Install dependencies
20-
run: npm install
42+
run: |
43+
cd backend
44+
pnpm install --frozen-lockfile
2145
2246
- name: Run tests
23-
run: cd backend && npx jest --coverage
47+
run: |
48+
cd backend
49+
pnpm exec jest --coverage --maxWorkers=2 --forceExit
2450
25-
- name: Upload results to Codecov
51+
- name: Upload coverage to Codecov
2652
uses: codecov/codecov-action@v4
2753
with:
28-
token: ${{ secrets.CODECOV_TOKEN }}
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
directory: ./backend/coverage
56+
flags: backend
57+
fail_ci_if_error: true
58+
verbose: true

0 commit comments

Comments
 (0)