Files
zpan/.github/workflows/ci.yml
T

128 lines
3.9 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:
downloader:
name: Downloader (Go)
runs-on: ubuntu-latest
if: github.repository == 'saltbo/zpan'
defaults:
run:
working-directory: downloader
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: downloader/go.mod
cache-dependency-path: downloader/go.sum
- name: Check formatting
run: |
files="$(gofmt -l .)"
if [ -n "$files" ]; then
echo "$files"
exit 1
fi
- run: go test ./...
- name: Install live downloader engines
run: sudo apt-get update && sudo apt-get install -y aria2 qbittorrent-nox
working-directory: .
- name: Verify live downloads
run: LIVE_DOWNLOAD_VERIFY=1 go test ./internal/engine -run 'TestLive(DownloadThreeSourceTypes|QBittorrentDownloadTorrentURL)' -count=1 -v
check:
name: Typecheck & Test
runs-on: ubuntu-latest
if: github.repository == 'saltbo/zpan'
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm typecheck
- run: pnpm exec 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: pnpm exec 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: pnpm 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
E2E_CLOUD_PRO_EMAIL_NODE: ${{ secrets.E2E_CLOUD_PRO_EMAIL_NODE }}
E2E_CLOUD_PRO_PASSWORD_NODE: ${{ secrets.E2E_CLOUD_PRO_PASSWORD_NODE }}
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- 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 pnpm 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
env:
E2E_CLOUD_PRO_EMAIL_CF: ${{ secrets.E2E_CLOUD_PRO_EMAIL_CF }}
E2E_CLOUD_PRO_PASSWORD_CF: ${{ secrets.E2E_CLOUD_PRO_PASSWORD_CF }}
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- 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 pnpm e2e:cloud:cf
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report-cf
path: playwright-report/
retention-days: 7