diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..7542853f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,91 @@ +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