chore: add GitHub community files (#3) #8
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: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| # A new push to a PR supersedes the run in progress. Runs on main always finish. | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| env: | |
| NODE_VERSION: 24 | |
| permissions: | |
| contents: read | |
| jobs: | |
| check: | |
| name: Format, lint & types | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| # Also runs `nuxt prepare`, which generates the .nuxt tsconfigs that | |
| # type-aware linting and `check-types` resolve types through. | |
| - name: Install dependencies | |
| id: install | |
| run: pnpm install --frozen-lockfile | |
| - name: Format | |
| run: pnpm format:check | |
| # The checks are independent, so each one reports even when an earlier | |
| # one failed. | |
| - name: Lint | |
| if: ${{ !cancelled() && steps.install.conclusion == 'success' }} | |
| run: pnpm lint --format=github | |
| - name: Type-check | |
| if: ${{ !cancelled() && steps.install.conclusion == 'success' }} | |
| run: pnpm check-types | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| # Runs the `test` script of every workspace that has one. | |
| - name: Test | |
| run: pnpm test | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Upload web build | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: web-dist | |
| path: apps/web/dist | |
| if-no-files-found: error | |
| # A re-run uploads under the same name as the earlier attempt. | |
| overwrite: true | |
| retention-days: 1 | |
| # Audits the site the build job generated instead of building it again. As a | |
| # job of its own, a Lighthouse failure reads apart from a build failure, and | |
| # "Re-run failed jobs" retries only the audit against the same build. | |
| lighthouse: | |
| name: Lighthouse | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 | |
| # No dependency install, so no dependency cache: the audit only needs the | |
| # built site, lighthouserc.json and `pnpm dlx @lhci/cli`. | |
| - name: Setup Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Download web build | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: web-dist | |
| path: apps/web/dist | |
| # Fails below 100 in any category. | |
| - name: Lighthouse | |
| id: lighthouse | |
| run: pnpm --filter web lighthouse | |
| - name: Upload Lighthouse reports | |
| if: ${{ failure() && steps.lighthouse.conclusion == 'failure' }} | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: lighthouse-reports | |
| path: apps/web/.lighthouseci | |
| include-hidden-files: true | |
| overwrite: true | |
| retention-days: 7 |