Run CI on PRs. #17
This file contains 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: test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
action: | |
runs-on: 'ubuntu-latest' | |
timeout-minutes: 20 | |
permissions: | |
contents: read | |
deployments: write | |
strategy: | |
matrix: | |
node-version: [22] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
id: pnpm-install | |
with: | |
version: 9.* | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: ${{ runner.os }}-pnpm-store- | |
- name: Cache Playwright Browsers | |
id: cache-playwright-browsers | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/ms-playwright | |
key: playwright-browsers-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Run setup | |
run: pnpm install && pnpm dev:setup | |
- name: Setup Playwright | |
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | |
run: pnpx playwright install --with-deps chromium | |
- name: Run tests | |
run: pnpm test:ci |