From 95ff8b8970d42a3c800c39ff267844579f9226ac Mon Sep 17 00:00:00 2001 From: Ben Vinegar Date: Sun, 22 Mar 2026 09:52:26 -0400 Subject: [PATCH 1/2] ci: trim pull request workflow load --- .github/workflows/benchmarks.yml | 4 +- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index b5370332..f0fd6b97 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -1,7 +1,9 @@ name: Benchmarks on: - pull_request: + push: + branches: + - master workflow_dispatch: concurrency: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 575526b3..f10176a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,73 @@ concurrency: cancel-in-progress: true jobs: + pr-validate: + if: github.event_name == 'pull_request' + name: PR validation (Linux) + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.3.10 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Typecheck + run: bun run typecheck + + - name: Test suite + run: bun test + + - name: Verify terminal tools + run: | + command -v script + command -v timeout + + - name: TTY smoke tests + run: bun run test:tty-smoke + + - name: Build npm runtime bundle + run: bun run build:npm + + - name: Verify npm pack output + run: bun run check:pack + + - name: Simulate global npm install + run: | + pkg_dir="$(mktemp -d)" + install_dir="$(mktemp -d)" + node_dir="$(dirname "$(command -v node)")" + npm pack --pack-destination "$pkg_dir" >/dev/null + pkg="$(find "$pkg_dir" -maxdepth 1 -name 'hunkdiff-*.tgz' | head -n1)" + npm install -g --prefix "$install_dir" "$pkg" + PATH="$install_dir/bin:$node_dir:/usr/bin:/bin" + if command -v bun >/dev/null 2>&1; then + echo "bun unexpectedly available on the sanitized PATH" >&2 + exit 1 + fi + hunk --help | grep 'Usage: hunk' + + - name: Stage prebuilt npm packages + run: bun run build:prebuilt:npm + + - name: Verify staged prebuilt packs + run: bun run check:prebuilt-pack + + - name: Smoke test prebuilt global install + run: bun run smoke:prebuilt-install + validate: + if: github.event_name == 'push' name: Typecheck + tests runs-on: ubuntu-latest steps: @@ -33,6 +99,7 @@ jobs: run: bun test tty-smoke: + if: github.event_name == 'push' name: Terminal smoke tests runs-on: ubuntu-latest steps: @@ -56,6 +123,7 @@ jobs: run: bun run test:tty-smoke pack-npm: + if: github.event_name == 'push' name: Verify npm package runs-on: ubuntu-latest steps: @@ -97,6 +165,7 @@ jobs: hunk --help | grep 'Usage: hunk' prebuilt-npm: + if: github.event_name == 'push' name: Verify prebuilt npm package (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: @@ -132,6 +201,7 @@ jobs: run: bun run smoke:prebuilt-install build-bin: + if: github.event_name == 'push' name: Build compiled binary runs-on: ubuntu-latest steps: From cb1ca47bd3c8009c6c82de76e1f4de881b200fba Mon Sep 17 00:00:00 2001 From: Ben Vinegar Date: Sun, 22 Mar 2026 09:57:52 -0400 Subject: [PATCH 2/2] ci: split pr and main workflows --- .github/workflows/ci.yml | 75 +------------------------------------ .github/workflows/pr-ci.yml | 73 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 73 deletions(-) create mode 100644 .github/workflows/pr-ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f10176a4..a3889b3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,83 +1,16 @@ -name: CI +name: Main CI on: push: branches: - master - pull_request: concurrency: - group: ci-${{ github.workflow }}-${{ github.ref }} + group: main-ci-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - pr-validate: - if: github.event_name == 'pull_request' - name: PR validation (Linux) - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Set up Bun - uses: oven-sh/setup-bun@v2 - with: - bun-version: 1.3.10 - - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version: 22 - - - name: Install dependencies - run: bun install --frozen-lockfile - - - name: Typecheck - run: bun run typecheck - - - name: Test suite - run: bun test - - - name: Verify terminal tools - run: | - command -v script - command -v timeout - - - name: TTY smoke tests - run: bun run test:tty-smoke - - - name: Build npm runtime bundle - run: bun run build:npm - - - name: Verify npm pack output - run: bun run check:pack - - - name: Simulate global npm install - run: | - pkg_dir="$(mktemp -d)" - install_dir="$(mktemp -d)" - node_dir="$(dirname "$(command -v node)")" - npm pack --pack-destination "$pkg_dir" >/dev/null - pkg="$(find "$pkg_dir" -maxdepth 1 -name 'hunkdiff-*.tgz' | head -n1)" - npm install -g --prefix "$install_dir" "$pkg" - PATH="$install_dir/bin:$node_dir:/usr/bin:/bin" - if command -v bun >/dev/null 2>&1; then - echo "bun unexpectedly available on the sanitized PATH" >&2 - exit 1 - fi - hunk --help | grep 'Usage: hunk' - - - name: Stage prebuilt npm packages - run: bun run build:prebuilt:npm - - - name: Verify staged prebuilt packs - run: bun run check:prebuilt-pack - - - name: Smoke test prebuilt global install - run: bun run smoke:prebuilt-install - validate: - if: github.event_name == 'push' name: Typecheck + tests runs-on: ubuntu-latest steps: @@ -99,7 +32,6 @@ jobs: run: bun test tty-smoke: - if: github.event_name == 'push' name: Terminal smoke tests runs-on: ubuntu-latest steps: @@ -123,7 +55,6 @@ jobs: run: bun run test:tty-smoke pack-npm: - if: github.event_name == 'push' name: Verify npm package runs-on: ubuntu-latest steps: @@ -165,7 +96,6 @@ jobs: hunk --help | grep 'Usage: hunk' prebuilt-npm: - if: github.event_name == 'push' name: Verify prebuilt npm package (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: @@ -201,7 +131,6 @@ jobs: run: bun run smoke:prebuilt-install build-bin: - if: github.event_name == 'push' name: Build compiled binary runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml new file mode 100644 index 00000000..18c0ea27 --- /dev/null +++ b/.github/workflows/pr-ci.yml @@ -0,0 +1,73 @@ +name: CI + +on: + pull_request: + +concurrency: + group: pr-ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + pr-validate: + name: Typecheck + Test + Smoke + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.3.10 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Typecheck + run: bun run typecheck + + - name: Test suite + run: bun test + + - name: Verify terminal tools + run: | + command -v script + command -v timeout + + - name: TTY smoke tests + run: bun run test:tty-smoke + + - name: Build npm runtime bundle + run: bun run build:npm + + - name: Verify npm pack output + run: bun run check:pack + + - name: Simulate global npm install + run: | + pkg_dir="$(mktemp -d)" + install_dir="$(mktemp -d)" + node_dir="$(dirname "$(command -v node)")" + npm pack --pack-destination "$pkg_dir" >/dev/null + pkg="$(find "$pkg_dir" -maxdepth 1 -name 'hunkdiff-*.tgz' | head -n1)" + npm install -g --prefix "$install_dir" "$pkg" + PATH="$install_dir/bin:$node_dir:/usr/bin:/bin" + if command -v bun >/dev/null 2>&1; then + echo "bun unexpectedly available on the sanitized PATH" >&2 + exit 1 + fi + hunk --help | grep 'Usage: hunk' + + - name: Stage prebuilt npm packages + run: bun run build:prebuilt:npm + + - name: Verify staged prebuilt packs + run: bun run check:prebuilt-pack + + - name: Smoke test prebuilt global install + run: bun run smoke:prebuilt-install