Address review feedback and harden TMDB/settings flows #429
Workflow file for this run
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: Build and Test | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }} | |
| CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
| strategy: | |
| matrix: | |
| node-version: [20.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install Dependencies | |
| run: npm run install:all | |
| - name: Lint Frontend | |
| run: | | |
| cd frontend | |
| npm run lint | |
| - name: Build Frontend | |
| run: | | |
| cd frontend | |
| npm run build | |
| - name: Build Backend | |
| run: | | |
| cd backend | |
| npm run build | |
| - name: Test Backend | |
| run: | | |
| cd backend | |
| npm run test -- run | |
| - name: Generate Coverage Reports | |
| if: ${{ env.CODACY_API_TOKEN != '' || env.CODACY_PROJECT_TOKEN != '' }} | |
| run: | | |
| cd backend | |
| npm run test:coverage -- --coverage.reporter=lcov | |
| cd ../frontend | |
| npm run test:coverage -- --coverage.reporter=lcov | |
| - name: Upload Coverage Reports to Codacy | |
| if: ${{ env.CODACY_API_TOKEN != '' || env.CODACY_PROJECT_TOKEN != '' }} | |
| run: | | |
| set -euo pipefail | |
| CODACY_TOKEN="${CODACY_API_TOKEN:-$CODACY_PROJECT_TOKEN}" | |
| REPO_OWNER="${GITHUB_REPOSITORY_OWNER}" | |
| REPO_NAME="${GITHUB_REPOSITORY#*/}" | |
| if curl --silent --show-error --fail -H "api-token: ${CODACY_TOKEN}" https://api.codacy.com/api/v3/user > /dev/null; then | |
| echo "Using Codacy account token mode." | |
| export CODACY_API_TOKEN="${CODACY_TOKEN}" | |
| export CODACY_ORGANIZATION_PROVIDER="gh" | |
| export CODACY_USERNAME="${REPO_OWNER}" | |
| export CODACY_PROJECT_NAME="${REPO_NAME}" | |
| unset CODACY_PROJECT_TOKEN | |
| else | |
| echo "Using Codacy project token mode." | |
| export CODACY_PROJECT_TOKEN="${CODACY_TOKEN}" | |
| unset CODACY_API_TOKEN CODACY_ORGANIZATION_PROVIDER CODACY_USERNAME CODACY_PROJECT_NAME | |
| fi | |
| bash <(curl -Ls https://coverage.codacy.com/get.sh) report \ | |
| --partial \ | |
| --force-coverage-parser lcov \ | |
| --prefix backend/ \ | |
| -r backend/coverage/lcov.info | |
| bash <(curl -Ls https://coverage.codacy.com/get.sh) report \ | |
| --partial \ | |
| --force-coverage-parser lcov \ | |
| --prefix frontend/ \ | |
| -r frontend/coverage/lcov.info | |
| bash <(curl -Ls https://coverage.codacy.com/get.sh) final |