Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ jobs:
- run: npm ci
- name: Dummy env (never real secrets)
run: if [ -f .env.ci ]; then cp .env.ci .env.production.local; fi
- run: npm run typecheck
- run: npm run lint
- run: npm test
- run: npm run build
- run: npx playwright install --with-deps chromium
- run: npm run e2e
- run: npm run ci
- name: Upload report
if: failure()
continue-on-error: true
Expand Down
39 changes: 39 additions & 0 deletions bin/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
#
# Checks GitHub runs after install. Preflight calls this same file.
#
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${ROOT}"

step() {
echo ""
echo "==> $*"
}

step "npm run typecheck"
npm run typecheck

step "npm run lint"
npm run lint

step "npm test"
npm test

step "npm run build"
npm run build

if [[ "${CI:-}" == "true" ]]; then
step "npx playwright install --with-deps chromium"
npx playwright install --with-deps chromium
else
step "npx playwright install chromium"
npx playwright install chromium
fi

step "npm run e2e"
npm run e2e

echo ""
echo "==> CI checks passed."
30 changes: 12 additions & 18 deletions bin/preflight.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Pre-commit checklist: lint/format, typecheck, and build.
# Local run of the CI checks.
#
# Usage:
# bin/preflight.sh
Expand All @@ -11,22 +11,16 @@ set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${ROOT}"

step() {
echo ""
echo "==> $*"
}
if [[ ! -d node_modules ]]; then
echo ""
echo "==> npm ci"
npm ci
fi

step "npm run lint"
npm run lint
if [[ -f .env.ci && ! -f .env.production.local ]]; then
echo ""
echo "==> .env.ci -> .env.production.local"
cp .env.ci .env.production.local
fi

step "npm run format"
npm run format

step "npm run typecheck"
npm run typecheck

step "npm run build"
npm run build

echo ""
echo "==> Preflight complete. Review the diff, then commit."
exec "${ROOT}/bin/ci.sh"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"test": "node --eval \"process.exit(0)\"",
"e2e": "playwright test --project=chromium",
"check": "npm run typecheck && npm run lint && npm test",
"ci": "bash bin/ci.sh",
"test:ui": "playwright test --ui",
"format": "prettier --write .",
"preflight": "bash bin/preflight.sh"
Expand Down
Loading