jwk.pages.dev/.github/workflows/test.yml
2024-09-02 19:23:55 +00:00

40 lines
1.3 KiB
YAML

name: test
on:
pull_request:
workflow_run:
workflows: deploy
types: completed
jobs:
test:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 5
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- if: github.ref_name != github.event.repository.default_branch
id: set_preview_env
shell: bash
run: echo url="https://$(echo "${HEAD_REF:0:28}" | sed s/[^_0-9a-z]/-/gi).jwk.pages.dev/" >> "${GITHUB_OUTPUT}"
env:
HEAD_REF: ${{ github.head_ref }}
- name: Run tests on ${{ 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 }}
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
if: always()
with:
name: "playwright-report-${{ matrix.os }}"
path: playwright-report