jwk.pages.dev/.github/workflows/test.yml

41 lines
1.2 KiB
YAML
Raw Normal View History

2024-03-16 16:32:53 +09:00
name: test
2024-03-16 19:46:54 +09:00
on:
pull_request:
workflow_run:
workflows: deploy
types: completed
2024-03-16 16:32:53 +09:00
jobs:
test:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
2024-03-16 19:46:54 +09:00
- if: github.ref_name != github.event.repository.default_branch
id: set_preview_env
2024-03-16 16:32:53 +09:00
shell: bash
2024-03-16 19:46:54 +09:00
run: echo url="https://$(echo "${HEAD_REF}" | sed s/[^_0-9a-z]/-/gi).jwk.pages.dev/" >> "${GITHUB_OUTPUT}"
2024-03-16 16:32:53 +09:00
env:
HEAD_REF: ${{ github.head_ref }}
2024-03-16 19:46:54 +09:00
- name: Run tests in ${{ env.BASE_URL }}
run: npm test
env:
BASE_URL: ${{ github.ref_name == github.event.repository.default_branch && 'https://jwk.pages.dev/' || steps.set_preview_env.outputs.url }}
2024-03-16 16:32:53 +09:00
- uses: actions/upload-artifact@v4
if: always()
with:
name: "playwright-report-${{ matrix.os }}"
path: playwright-report