Frontend #161
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: Frontend | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - "**.md" | |
| - "**.py" | |
| - "**.txt" | |
| - "**.csv" | |
| - "**.po" | |
| - "**.pot" | |
| - ".github/workflows/server-tests.yml" | |
| - ".github/workflows/builds.yml" | |
| schedule: | |
| # Run every day at midnight UTC / 5:30 IST | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| concurrency: | |
| group: frontend-${{ github.event.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # frontend/package.json links `@framework/ui` to a sibling frappe checkout | |
| # (link:../../frappe/ui); without it, anything importing from @framework/ui | |
| # fails to resolve. actions/checkout cannot place a repo outside the | |
| # workspace, and only the `ui` package is needed. | |
| - name: Clone frappe for @framework/ui | |
| run: | | |
| git clone --depth 1 --branch develop --filter=blob:none --sparse \ | |
| https://github.com/frappe/frappe "$GITHUB_WORKSPACE/../frappe" | |
| git -C "$GITHUB_WORKSPACE/../frappe" sparse-checkout set ui | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: yarn | |
| cache-dependency-path: frontend/yarn.lock | |
| - name: Install dependencies | |
| run: cd frontend && yarn install --frozen-lockfile | |
| - name: ESLint | |
| run: cd frontend && npx eslint src --ext .js,.ts,.vue | |
| - name: Oxlint | |
| run: cd frontend && npx oxlint src | |
| build: | |
| name: Production Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # see the lint job: @framework/ui links to a sibling frappe checkout | |
| - name: Clone frappe for @framework/ui | |
| run: | | |
| git clone --depth 1 --branch develop --filter=blob:none --sparse \ | |
| https://github.com/frappe/frappe "$GITHUB_WORKSPACE/../frappe" | |
| git -C "$GITHUB_WORKSPACE/../frappe" sparse-checkout set ui | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: yarn | |
| cache-dependency-path: frontend/yarn.lock | |
| - name: Install dependencies | |
| run: cd frontend && yarn install --frozen-lockfile | |
| - name: Build frontend | |
| run: cd frontend && yarn build | |
| test: | |
| name: Unit Tests & Coverage | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: yarn | |
| cache-dependency-path: frontend/yarn.lock | |
| - name: Run frontend tests | |
| uses: ./.github/actions/frontend-tests | |
| with: | |
| node-version: "24" | |
| enable-coverage: "true" | |
| - name: Upload coverage artifact | |
| if: github.base_ref == 'develop' || github.ref_name == 'develop' | |
| uses: ./.github/actions/upload-coverage | |
| with: | |
| artifact-name: coverage-frontend | |
| coverage-path: frontend/coverage/lcov.info | |
| coverage: | |
| name: Coverage Wrap Up | |
| needs: test | |
| if: github.base_ref == 'develop' || github.ref_name == 'develop' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Publish coverage to Codecov | |
| uses: ./.github/actions/publish-codecov | |
| with: | |
| name: Frontend | |
| token: ${{ secrets.CODECOV_TOKEN }} |