🩺 Frontend quality checks on PR 80 #267
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: Datafeeder CI Frontend | |
| run-name: 🩺 Frontend quality checks on ${{ github.event_name == 'pull_request' && 'PR' || '🌱' }} ${{ github.event_name == 'pull_request' && github.event.number || github.ref_name }} | |
| env: | |
| NODE_VERSION: 22.20.0 | |
| GEONETWORK_VERSION: 4.4.8 | |
| ELASTICSEARCH_VERSION: 8.14.3 | |
| # This workflow runs for Pull Requests which are not draft, | |
| # as well as commits going to the default branch | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, ready_for_review] | |
| # Only allow concurrent checks on the main branch to keep history | |
| # on QA checks | |
| concurrency: | |
| group: checks-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref_name != 'main' }} | |
| jobs: | |
| build-lint-test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: apps/frontend | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Use Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: apps/frontend/package-lock.json | |
| - name: Cache dependencies | |
| id: npm-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| apps/frontend/node_modules | |
| ~/.cache/Cypress | |
| key: ${{ runner.os }}-npm-cypress-${{ hashFiles('apps/frontend/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-npm-cypress- | |
| - name: Install dependencies | |
| run: npm ci | |
| if: steps.npm-cache.outputs.cache-hit != 'true' | |
| - name: Lint code | |
| run: npm run lint | |
| - name: Type check | |
| run: npm run format:check | |
| - name: Build application | |
| run: npm run build | |
| - name: Run unit tests | |
| run: npm run test:ut:ci | |
| # - name: Set up Python for backend | |
| # uses: actions/setup-python@v6 | |
| # with: | |
| # python-version-file: ".python-version" | |
| # - name: Install uv | |
| # uses: astral-sh/setup-uv@v7 | |
| # with: | |
| # enable-cache: true | |
| # - name: Install backend dependencies | |
| # run: uv sync --project apps/backend | |
| # - name: Create backend .env file | |
| # working-directory: apps/backend | |
| # run: | | |
| # cat > .env << EOF | |
| # POSTGRES_SERVER=localhost | |
| # POSTGRES_PORT=5432 | |
| # POSTGRES_USER=georchestra | |
| # POSTGRES_PASSWORD=georchestra | |
| # POSTGRES_DB=georchestra | |
| # SECRET_KEY=test-secret-key-for-ci | |
| # EOF | |
| # - name: Start backend server | |
| # working-directory: apps/backend | |
| # run: | | |
| # georchestradatadir=/home/runner/work/Datafeeder/Datafeeder/docker/datadir uv run fastapi dev src/main.py --host 0.0.0.0 --port 8000 & | |
| # echo "Waiting for backend to be ready..." | |
| # timeout 30 bash -c 'until curl -f http://localhost:8000/version; do sleep 1; done' | |
| # echo "Backend is ready!" | |
| # - name: Run E2E tests | |
| # run: npm run test:e2e:ci | |
| - name: Coveralls | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| allow-empty: true | |