diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 083b6e84..5526504e 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -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 }} \ No newline at end of file + token: ${{ secrets.CODECOV_TOKEN }} + directory: ./backend/coverage + flags: backend + fail_ci_if_error: true + verbose: true \ No newline at end of file