Merge pull request #11 from blackphoenix42/dependabot/npm_and_yarn/ty… #26
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: [master] | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint_typecheck_unit: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # Keep local + CI in sync via .node-version | |
| - name: Use Node (from .node-version) | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version-file: .node-version | |
| cache: npm | |
| - name: npm ci | |
| run: npm ci | |
| # Workaround npm optional-deps quirk for Rollup on Linux | |
| - name: Patch Rollup native binary (Linux) | |
| if: runner.os == 'Linux' | |
| run: npm i --no-save --no-package-lock @rollup/rollup-linux-x64-gnu@^4 | |
| - name: Lint (ESLint + Stylelint) | |
| run: | | |
| npm run lint --if-present || echo "No lint script" | |
| npm run stylelint --if-present || echo "No stylelint script" | |
| - name: Type check | |
| run: npm run typecheck --if-present || npx -y typescript -p tsconfig.json --noEmit | |
| # Ensure Vitest exists even if not in devDeps yet | |
| - name: Ensure Vitest present | |
| run: npm ls vitest || npm i --no-save --no-package-lock vitest@^3 @vitest/coverage-v8@^3 | |
| - name: Unit tests (Vitest) | |
| env: | |
| CI: true | |
| run: npx vitest run --coverage | |
| - name: Build (Vite) | |
| run: npm run build --if-present || npx -y vite build | |
| - name: Upload coverage | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: | | |
| coverage/** | |
| .vitest/** | |
| if-no-files-found: ignore | |
| e2e: | |
| runs-on: ubuntu-latest | |
| needs: lint_typecheck_unit | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Use Node (from .node-version) | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version-file: .node-version | |
| cache: npm | |
| - name: npm ci | |
| run: npm ci | |
| - name: Patch Rollup native binary (Linux) | |
| if: runner.os == 'Linux' | |
| run: npm i --no-save --no-package-lock @rollup/rollup-linux-x64-gnu@^4 | |
| - name: Build site | |
| run: npm run build --if-present || npx -y vite build | |
| - name: Install Playwright browsers | |
| run: npx -y playwright install --with-deps | |
| - name: Start preview server | |
| run: | | |
| npx -y vite preview --port 4173 --strictPort & | |
| npx -y wait-on http://127.0.0.1:4173 | |
| - name: Run Playwright tests | |
| env: | |
| CI: true | |
| run: npx -y playwright test --reporter=dot |