Improve CI scripts #32
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: | |
| workflow_dispatch: | |
| # Clear GitHub token permissions | |
| permissions: {} | |
| # Cancel identical concurrent CI runs | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: lts/* | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| env: | |
| # Download browsers in a separate cached step, instead of in npm ci | |
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' | |
| - name: Get Playwright version | |
| id: playwright-version | |
| run: echo "version=$(npx playwright --version)" >> "$GITHUB_OUTPUT" | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ steps.playwright-version.outputs.version }} | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps | |
| - name: Run tests | |
| run: npm run test | |
| typecheck-and-build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: lts/* | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type check | |
| run: npm run typecheck | |
| - name: Build | |
| run: npm run build |