mirror of
https://github.com/saltbo/zpan.git
synced 2026-09-01 15:49:00 +08:00
104 lines
3.1 KiB
YAML
104 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
env:
|
|
E2E_CLOUD_PRO_EMAIL: ${{ secrets.E2E_CLOUD_PRO_EMAIL }}
|
|
E2E_CLOUD_PRO_PASSWORD: ${{ secrets.E2E_CLOUD_PRO_PASSWORD }}
|
|
|
|
jobs:
|
|
check:
|
|
name: Typecheck & Test
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'saltbo/zpan'
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
- uses: actions/cache@v4
|
|
id: deps
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
- if: steps.deps.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
- run: npm run lint
|
|
- run: npm run typecheck
|
|
- run: npx vitest run --project unit --coverage
|
|
- uses: codecov/codecov-action@v5
|
|
if: always()
|
|
with:
|
|
files: coverage/coverage-final.json
|
|
flags: unit
|
|
fail_ci_if_error: false
|
|
handle_no_reports_found: true
|
|
- run: npx vitest run --project integration --coverage
|
|
- uses: codecov/codecov-action@v5
|
|
if: always()
|
|
with:
|
|
files: coverage/coverage-final.json
|
|
flags: integration
|
|
fail_ci_if_error: false
|
|
handle_no_reports_found: true
|
|
- run: mkdir -p dist
|
|
- run: npm run test:cf
|
|
|
|
e2e-node:
|
|
name: E2E (Node)
|
|
runs-on: ubuntu-latest
|
|
needs: check
|
|
env:
|
|
BETTER_AUTH_SECRET: ci-test-secret-that-is-at-least-32-chars
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
- run: npx playwright install --with-deps chromium
|
|
- name: Install cloudflared
|
|
run: |
|
|
curl -L --fail --output cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
|
|
chmod +x cloudflared
|
|
- run: CLOUDFLARED_BIN=./cloudflared npm run e2e:cloud -- --runtime node
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report-node
|
|
path: playwright-report/
|
|
retention-days: 7
|
|
|
|
e2e-cf:
|
|
name: E2E (CF Workers)
|
|
runs-on: ubuntu-latest
|
|
needs: check
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
- run: npx playwright install --with-deps chromium
|
|
- name: Install cloudflared
|
|
run: |
|
|
curl -L --fail --output cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
|
|
chmod +x cloudflared
|
|
- run: CLOUDFLARED_BIN=./cloudflared npm run e2e:cloud:cf
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report-cf
|
|
path: playwright-report/
|
|
retention-days: 7
|