178 lines
4.8 KiB
YAML
178 lines
4.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: package.json
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm build
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
retention-days: 1
|
|
|
|
unit:
|
|
name: Unit Tests (Vitest)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: package.json
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm test
|
|
|
|
e2e-chromium:
|
|
name: E2E Tests (Chromium)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: package.json
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm exec playwright install --with-deps chromium
|
|
- run: pnpm test:e2e --project=chromium
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report-chromium
|
|
path: playwright-report/
|
|
retention-days: 7
|
|
|
|
e2e-firefox:
|
|
name: E2E Tests (Firefox)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: package.json
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm exec playwright install --with-deps firefox
|
|
- run: pnpm test:e2e --project=firefox
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report-firefox
|
|
path: playwright-report/
|
|
retention-days: 7
|
|
|
|
e2e-webkit:
|
|
name: E2E Tests (WebKit)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: package.json
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm exec playwright install --with-deps webkit
|
|
- run: pnpm test:e2e --project=webkit
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report-webkit
|
|
path: playwright-report/
|
|
retention-days: 7
|
|
|
|
e2e-mobile-chrome:
|
|
name: E2E Tests (Mobile Chrome)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: package.json
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm exec playwright install --with-deps chromium
|
|
- run: pnpm test:e2e --project=mobile-chrome
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report-mobile-chrome
|
|
path: playwright-report/
|
|
retention-days: 7
|
|
|
|
e2e-mobile-safari:
|
|
name: E2E Tests (Mobile Safari)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
run_install: false
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: package.json
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm exec playwright install --with-deps webkit
|
|
- run: pnpm test:e2e --project=mobile-safari
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report-mobile-safari
|
|
path: playwright-report/
|
|
retention-days: 7
|
|
|
|
quality-gate:
|
|
name: Quality Gate
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build
|
|
- unit
|
|
- e2e-chromium
|
|
- e2e-firefox
|
|
- e2e-webkit
|
|
- e2e-mobile-chrome
|
|
- e2e-mobile-safari
|
|
if: always()
|
|
steps:
|
|
- name: Check all jobs passed
|
|
run: |
|
|
results='${{ toJSON(needs) }}'
|
|
failed=$(echo "$results" | grep -o '"result":"[^"]*"' | grep -v '"result":"success"' | wc -l)
|
|
if [ "$failed" -gt 0 ]; then
|
|
echo "One or more jobs failed:"
|
|
echo "$results" | grep -o '"[^"]*":{"result":"[^"]*"'
|
|
exit 1
|
|
fi
|
|
echo "All jobs passed."
|