mirror of
https://github.com/cpvalente/ontime.git
synced 2026-07-26 10:38:55 +00:00
113 lines
2.9 KiB
YAML
113 lines
2.9 KiB
YAML
name: Ontime test
|
|
|
|
on:
|
|
pull_request:
|
|
branches: '*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
unit-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
env:
|
|
CI: ''
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
|
|
- name: Get pnpm store directory
|
|
run: echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
|
|
- name: Setup pnpm cache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ${{ env.PNPM_STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
# Run code quality
|
|
- name: Run formatter
|
|
run: pnpm format:check
|
|
|
|
- name: Run linter
|
|
run: pnpm lint
|
|
|
|
- name: Run TypeScript checks
|
|
run: pnpm typecheck
|
|
|
|
# We choose to run tests separately
|
|
- name: Run unit tests
|
|
if: always()
|
|
run: pnpm test
|
|
|
|
e2e-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
|
|
- name: Get pnpm store directory
|
|
run: echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
|
|
- name: Setup pnpm cache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ${{ env.PNPM_STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Get installed Playwright version
|
|
run: echo "PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --parseable | cut -s -d '@' -f3 | cut -d '/' -f1)" >> $GITHUB_ENV
|
|
- name: Cache playwright binaries
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
~/.cache/ms-playwright
|
|
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
|
restore-keys: |
|
|
${{ runner.os }}-playwright-
|
|
- run: pnpm playwright install --with-deps
|
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
|
|
- name: Install Playwright Browsers
|
|
run: pnpm playwright install --with-deps
|
|
|
|
- name: Run Playwright tests
|
|
run: pnpm e2e
|
|
|
|
- uses: actions/upload-artifact@v6
|
|
if: always()
|
|
with:
|
|
name: playwright-report
|
|
path: playwright-report/
|
|
retention-days: 30
|
|
|
|
- uses: actions/upload-artifact@v6
|
|
with:
|
|
name: automated-screenshots
|
|
path: automated-screenshots/
|
|
retention-days: 14
|