Skip to content

Test

Test #6383

Workflow file for this run

name: Test
on:
schedule:
- cron: '*/30 * * * *'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
worker:
- production
- staging
steps:
- name: Checkout Commit
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: npm
- name: Install Dependencies
run: npm ci
- name: Install Playwright Chromium
run: npx playwright install --with-deps chromium --only-shell
- name: Run Tests
run: npm test
env:
VITEST_EXTERNAL_API_URL: ${{ matrix.worker == 'production' && 'https://api.cdnjs.com' || 'https://api.cdnjs.dev' }}
- name: Run Web Tests
id: web-tests
if: matrix.worker == 'staging'
run: npm run test:web
env:
PLAYWRIGHT_EXTERNAL_WEB_URL: ${{ matrix.worker == 'production' && 'https://cdnjs.com' || 'https://cdnjs.dev' }}
- name: Upload Test Results
if: always() && (steps.web-tests.outcome == 'failure' || steps.web-tests.outcome == 'success')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-report-${{ github.run_id }}
path: .playwright/report
retention-days: ${{ case(steps.web-tests.outcome == 'success', 1, 3) }}