The full non-E2E suite (`bun run test`) only ran inside the release workflow, and pull requests only built the Docker image, so a failing test or type error surfaced at release time. A new Test workflow runs on every pull request and push to main (Markdown and docs-only changes excluded): - "Type check and build": `bun run typecheck`, `bun run typecheck:mobile` and `bun run build:web`; - "Regression tests": `bun run test` (bulk and integration suites). It uses the Bun version pinned in package.json, retries `bun install` like the other workflows, cancels superseded runs, reads the repository only, and is limited to this repository so deployment forks spend no runners.
92 lines
2.1 KiB
YAML
92 lines
2.1 KiB
YAML
name: Test
|
|
|
|
# Runs the non-E2E regression suite, type checks and the web build for every
|
|
# pull request and every push to main, so failures surface before a release
|
|
# instead of in the release workflow.
|
|
on:
|
|
pull_request:
|
|
paths-ignore:
|
|
- "**/*.md"
|
|
- "docs/**"
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- "**/*.md"
|
|
- "docs/**"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: edgeever-test-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
checks:
|
|
# Forks that deploy their own copy do not spend runners on this; pull
|
|
# requests opened against this repository still run here.
|
|
if: github.repository == 'tianma-if/edgeever'
|
|
name: Type check and build
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version-file: package.json
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
for attempt in 1 2 3; do
|
|
if bun install --frozen-lockfile; then
|
|
exit 0
|
|
fi
|
|
if [[ "$attempt" = "3" ]]; then
|
|
exit 1
|
|
fi
|
|
sleep "$((15 * attempt))"
|
|
done
|
|
|
|
- name: Type check
|
|
run: bun run typecheck
|
|
|
|
- name: Type check mobile
|
|
run: bun run typecheck:mobile
|
|
|
|
- name: Build web
|
|
run: bun run build:web
|
|
|
|
tests:
|
|
if: github.repository == 'tianma-if/edgeever'
|
|
name: Regression tests
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version-file: package.json
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
for attempt in 1 2 3; do
|
|
if bun install --frozen-lockfile; then
|
|
exit 0
|
|
fi
|
|
if [[ "$attempt" = "3" ]]; then
|
|
exit 1
|
|
fi
|
|
sleep "$((15 * attempt))"
|
|
done
|
|
|
|
- name: Run regression tests
|
|
run: bun run test
|