Skip to content

Commit

Permalink
chore: Update Codecov workflow to run tests in the backend directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Sma1lboy committed Oct 23, 2024
1 parent 770db50 commit 7ca7707
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,52 @@ jobs:
test:
name: Run tests and collect coverage
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node
- uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: npm install
run: |
cd backend
pnpm install --frozen-lockfile
- name: Run tests
run: cd backend && npx jest --coverage
run: |
cd backend
pnpm exec jest --coverage --maxWorkers=2 --forceExit
- name: Upload results to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./backend/coverage
flags: backend
fail_ci_if_error: true
verbose: true

0 comments on commit 7ca7707

Please sign in to comment.