Fix GitHub Actions workflow: proper pnpm setup and correct test cover… #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| backend-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build and test with Maven | |
| run: cd backend && ./mvnw -B verify | |
| - name: Upload Jacoco coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: success() || failure() | |
| with: | |
| name: backend-coverage-report | |
| path: backend/target/site/jacoco/ | |
| retention-days: 5 | |
| frontend-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| run_install: false | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: cd frontend && pnpm install | |
| - name: Run tests with coverage | |
| run: cd frontend && pnpm test:coverage | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: success() || failure() | |
| with: | |
| name: frontend-coverage-report | |
| path: frontend/coverage/ | |
| retention-days: 5 |