Skip to content

perf(ci): run affected checks by module #1385

perf(ci): run affected checks by module

perf(ci): run affected checks by module #1385

Workflow file for this run

name: Check
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Build (container package)
run: bun run --cwd packages/container build
- name: Build (terminal package)
run: bun run --cwd packages/terminal build
- name: Build (docker-git package)
run: bun run --cwd packages/app build
- name: Build (session sync package)
run: |
if [ -f packages/docker-git-session-sync/package.json ]; then
bun run --cwd packages/docker-git-session-sync build
else
echo "packages/docker-git-session-sync is not present; skipping"
fi
- name: Build (api)
run: bun run --cwd packages/api build
dist-deps-prune:
name: Dist deps prune
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
with:
node-version: 24.14.0
- name: Build package
run: bun run --cwd packages/app build
- name: Dist deps prune (lint)
run: bun run check:dist-deps-prune
plan-checks:
name: Plan affected checks
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
typecheck_matrix: ${{ steps.plan.outputs.typecheck_matrix }}
typecheck_has_work: ${{ steps.plan.outputs.typecheck_has_work }}
lint_matrix: ${{ steps.plan.outputs.lint_matrix }}
lint_has_work: ${{ steps.plan.outputs.lint_has_work }}
test_matrix: ${{ steps.plan.outputs.test_matrix }}
test_has_work: ${{ steps.plan.outputs.test_has_work }}
lint_effect_matrix: ${{ steps.plan.outputs.lint_effect_matrix }}
lint_effect_has_work: ${{ steps.plan.outputs.lint_effect_has_work }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Compute affected module matrices
id: plan
shell: bash
env:
DOCKER_GIT_CHANGED_BASE: ${{ github.event.pull_request.base.sha }}
DOCKER_GIT_CHANGED_HEAD: ${{ github.sha }}
run: |
set -euo pipefail
write_plan() {
local key="$1"
local operation="$2"
local matrix
matrix="$(node scripts/changed-checks.mjs "$operation" --matrix)"
echo "${key}_matrix=${matrix}" >> "$GITHUB_OUTPUT"
if [[ "$matrix" == '{"include":[]}' ]]; then
echo "${key}_has_work=false" >> "$GITHUB_OUTPUT"
else
echo "${key}_has_work=true" >> "$GITHUB_OUTPUT"
fi
}
write_plan typecheck typecheck
write_plan lint lint
write_plan test test
write_plan lint_effect lint:effect
types-modules:
name: Types (${{ matrix.label }})
needs: plan-checks
if: needs.plan-checks.outputs.typecheck_has_work == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.plan-checks.outputs.typecheck_matrix) }}
steps:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Typecheck module
run: bun run --filter "${{ matrix.packageName }}" "${{ matrix.script }}"
types:
name: Types
needs: [plan-checks, types-modules]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check typecheck module results
env:
MODULE_RESULT: ${{ needs.types-modules.result }}
run: |
if [[ "$MODULE_RESULT" == "failure" || "$MODULE_RESULT" == "cancelled" ]]; then
echo "Typecheck module job result: $MODULE_RESULT" >&2
exit 1
fi
echo "Typecheck module job result: $MODULE_RESULT"
lint-modules:
name: Lint (${{ matrix.label }})
needs: plan-checks
if: needs.plan-checks.outputs.lint_has_work == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.plan-checks.outputs.lint_matrix) }}
steps:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Lint module
run: bun run --filter "${{ matrix.packageName }}" "${{ matrix.script }}"
lint:
name: Lint
needs: [plan-checks, lint-modules]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check lint module results
env:
MODULE_RESULT: ${{ needs.lint-modules.result }}
run: |
if [[ "$MODULE_RESULT" == "failure" || "$MODULE_RESULT" == "cancelled" ]]; then
echo "Lint module job result: $MODULE_RESULT" >&2
exit 1
fi
echo "Lint module job result: $MODULE_RESULT"
test-modules:
name: Test (${{ matrix.label }})
needs: plan-checks
if: needs.plan-checks.outputs.test_has_work == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.plan-checks.outputs.test_matrix) }}
steps:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Test module
run: bun run --filter "${{ matrix.packageName }}" "${{ matrix.script }}"
test:
name: Test
needs: [plan-checks, test-modules]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check test module results
env:
MODULE_RESULT: ${{ needs.test-modules.result }}
run: |
if [[ "$MODULE_RESULT" == "failure" || "$MODULE_RESULT" == "cancelled" ]]; then
echo "Test module job result: $MODULE_RESULT" >&2
exit 1
fi
echo "Test module job result: $MODULE_RESULT"
lint-effect-modules:
name: Lint Effect-TS (${{ matrix.label }})
needs: plan-checks
if: needs.plan-checks.outputs.lint_effect_has_work == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.plan-checks.outputs.lint_effect_matrix) }}
steps:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Lint Effect-TS module
run: bun run --filter "${{ matrix.packageName }}" "${{ matrix.script }}"
lint-effect:
name: Lint Effect-TS
needs: [plan-checks, lint-effect-modules]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check Effect-TS lint module results
env:
MODULE_RESULT: ${{ needs.lint-effect-modules.result }}
run: |
if [[ "$MODULE_RESULT" == "failure" || "$MODULE_RESULT" == "cancelled" ]]; then
echo "Effect-TS lint module job result: $MODULE_RESULT" >&2
exit 1
fi
echo "Effect-TS lint module job result: $MODULE_RESULT"
e2e-prepare:
name: E2E prepare
runs-on: ubuntu-latest
timeout-minutes: 30
env:
DOCKER_GIT_CONTROLLER_BUILD_SKILLER: "0"
DOCKER_GIT_E2E_PROJECT_IMAGE: docker-git-e2e-project:latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/setup
- name: Build E2E prebuilt payload
run: |
bun run --cwd packages/app build:docker-git:reuse-install
bun run --cwd packages/app build:web
- name: Free Docker disk
uses: ./.github/actions/free-docker-disk
- name: Build E2E project image
run: |
set -euo pipefail
bun run --cwd packages/lib build
bun scripts/ci/build-e2e-project-image.ts "$DOCKER_GIT_E2E_PROJECT_IMAGE"
mkdir -p artifacts
docker save "$DOCKER_GIT_E2E_PROJECT_IMAGE" | gzip -1 > artifacts/docker-git-e2e-project-image.tar.gz
ls -lh artifacts/docker-git-e2e-project-image.tar.gz
- name: Build E2E controller image
run: |
set -euo pipefail
DOCKER_GIT_CONTROLLER_REV="$(bun --cwd packages/app scripts/print-controller-revision.ts "$PWD/docker-compose.yml")"
export DOCKER_GIT_CONTROLLER_REV
echo "Building docker-git controller image revision: ${DOCKER_GIT_CONTROLLER_REV}"
docker compose --project-name docker-git -f docker-compose.yml build api
docker image inspect docker-git-api \
-f 'controller revision={{ index .Config.Labels "io.prover-coder-ai.docker-git.controller-rev" }}'
mkdir -p artifacts
docker save docker-git-api | gzip -1 > artifacts/docker-git-e2e-controller-image.tar.gz
ls -lh artifacts/docker-git-e2e-controller-image.tar.gz
- name: Pack E2E prebuilt artifact
run: |
mkdir -p artifacts
bun scripts/ci/pack-e2e-prebuilt.mjs artifacts/docker-git-e2e-prebuilt.tgz
- name: Upload E2E prebuilt artifact
uses: actions/upload-artifact@v7
with:
name: docker-git-e2e-prebuilt
path: artifacts/docker-git-e2e-prebuilt.tgz
- name: Upload E2E controller image artifact
uses: actions/upload-artifact@v7
with:
name: docker-git-e2e-controller-image
path: artifacts/docker-git-e2e-controller-image.tar.gz
compression-level: 0
- name: Upload E2E project image artifact
uses: actions/upload-artifact@v7
with:
name: docker-git-e2e-project-image
path: artifacts/docker-git-e2e-project-image.tar.gz
compression-level: 0
e2e-local-package:
name: E2E (Local package CLI)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Pack and run local package via Bun
run: bash scripts/e2e/local-package-cli.sh
e2e-browser-command:
name: E2E (Browser command)
needs: e2e-prepare
runs-on: ubuntu-latest
timeout-minutes: 40
env:
DOCKER_GIT_CONTROLLER_BUILD_SKILLER: "0"
DOCKER_GIT_E2E_USE_PREBUILT_CLI: "1"
DOCKER_GIT_E2E_PROJECT_IMAGE: docker-git-e2e-project:latest
DOCKER_GIT_E2E_USE_PREBUILT_WEB: "1"
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/setup
with:
install-dependencies: "false"
- name: Download E2E prebuilt artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-prebuilt
path: artifacts
- name: Download E2E controller image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-controller-image
path: artifacts
- name: Download E2E project image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-project-image
path: artifacts
- name: Restore E2E prebuilt artifact
run: tar -xzf artifacts/docker-git-e2e-prebuilt.tgz
- name: Free Docker disk
uses: ./.github/actions/free-docker-disk
- name: Load E2E Docker images
run: |
gzip -dc artifacts/docker-git-e2e-controller-image.tar.gz | docker load
docker image inspect docker-git-api \
-f 'controller revision={{ index .Config.Labels "io.prover-coder-ai.docker-git.controller-rev" }}'
gzip -dc artifacts/docker-git-e2e-project-image.tar.gz | docker load
docker image inspect "$DOCKER_GIT_E2E_PROJECT_IMAGE" \
-f 'project image={{.Id}}'
- name: Docker info
run: docker version && docker compose version
- name: Browser command startup
run: bash scripts/e2e/browser-command.sh
e2e-opencode:
name: E2E (OpenCode)
needs: e2e-prepare
runs-on: ubuntu-latest
timeout-minutes: 40
env:
DOCKER_GIT_CONTROLLER_BUILD_SKILLER: "0"
DOCKER_GIT_E2E_USE_PREBUILT_CLI: "1"
DOCKER_GIT_E2E_PROJECT_IMAGE: docker-git-e2e-project:latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/setup
with:
install-dependencies: "false"
- name: Download E2E prebuilt artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-prebuilt
path: artifacts
- name: Download E2E controller image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-controller-image
path: artifacts
- name: Download E2E project image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-project-image
path: artifacts
- name: Restore E2E prebuilt artifact
run: tar -xzf artifacts/docker-git-e2e-prebuilt.tgz
- name: Free Docker disk
uses: ./.github/actions/free-docker-disk
- name: Load E2E Docker images
run: |
gzip -dc artifacts/docker-git-e2e-controller-image.tar.gz | docker load
docker image inspect docker-git-api \
-f 'controller revision={{ index .Config.Labels "io.prover-coder-ai.docker-git.controller-rev" }}'
gzip -dc artifacts/docker-git-e2e-project-image.tar.gz | docker load
docker image inspect "$DOCKER_GIT_E2E_PROJECT_IMAGE" \
-f 'project image={{.Id}}'
- name: Docker info
run: docker version && docker compose version
- name: OpenCode autoconnect
run: bash scripts/e2e/opencode-autoconnect.sh
e2e-clone-cache:
name: E2E (Clone cache)
needs: e2e-prepare
runs-on: ubuntu-latest
timeout-minutes: 40
env:
DOCKER_GIT_CONTROLLER_BUILD_SKILLER: "0"
DOCKER_GIT_E2E_USE_PREBUILT_CLI: "1"
DOCKER_GIT_E2E_PROJECT_IMAGE: docker-git-e2e-project:latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/setup
with:
install-dependencies: "false"
- name: Download E2E prebuilt artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-prebuilt
path: artifacts
- name: Download E2E controller image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-controller-image
path: artifacts
- name: Download E2E project image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-project-image
path: artifacts
- name: Restore E2E prebuilt artifact
run: tar -xzf artifacts/docker-git-e2e-prebuilt.tgz
- name: Free Docker disk
uses: ./.github/actions/free-docker-disk
- name: Load E2E Docker images
run: |
gzip -dc artifacts/docker-git-e2e-controller-image.tar.gz | docker load
docker image inspect docker-git-api \
-f 'controller revision={{ index .Config.Labels "io.prover-coder-ai.docker-git.controller-rev" }}'
gzip -dc artifacts/docker-git-e2e-project-image.tar.gz | docker load
docker image inspect "$DOCKER_GIT_E2E_PROJECT_IMAGE" \
-f 'project image={{.Id}}'
- name: Docker info
run: docker version && docker compose version
- name: Clone cache reuse
run: bash scripts/e2e/clone-cache.sh
e2e-login-context:
name: E2E (Login context)
needs: e2e-prepare
runs-on: ubuntu-latest
timeout-minutes: 40
env:
DOCKER_GIT_CONTROLLER_BUILD_SKILLER: "0"
DOCKER_GIT_E2E_USE_PREBUILT_CLI: "1"
DOCKER_GIT_E2E_PROJECT_IMAGE: docker-git-e2e-project:latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/setup
with:
install-dependencies: "false"
- name: Download E2E prebuilt artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-prebuilt
path: artifacts
- name: Download E2E controller image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-controller-image
path: artifacts
- name: Download E2E project image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-project-image
path: artifacts
- name: Restore E2E prebuilt artifact
run: tar -xzf artifacts/docker-git-e2e-prebuilt.tgz
- name: Free Docker disk
uses: ./.github/actions/free-docker-disk
- name: Load E2E Docker images
run: |
gzip -dc artifacts/docker-git-e2e-controller-image.tar.gz | docker load
docker image inspect docker-git-api \
-f 'controller revision={{ index .Config.Labels "io.prover-coder-ai.docker-git.controller-rev" }}'
gzip -dc artifacts/docker-git-e2e-project-image.tar.gz | docker load
docker image inspect "$DOCKER_GIT_E2E_PROJECT_IMAGE" \
-f 'project image={{.Id}}'
- name: Docker info
run: docker version && docker compose version
- name: Login context notice
run: bash scripts/e2e/login-context.sh
e2e-runtime-volumes-ssh:
name: E2E (Runtime volumes + SSH)
needs: e2e-prepare
runs-on: ubuntu-latest
timeout-minutes: 60
env:
DOCKER_GIT_CONTROLLER_BUILD_SKILLER: "0"
DOCKER_GIT_E2E_USE_PREBUILT_CLI: "1"
DOCKER_GIT_E2E_PROJECT_IMAGE: docker-git-e2e-project:latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/setup
with:
install-dependencies: "false"
- name: Download E2E prebuilt artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-prebuilt
path: artifacts
- name: Download E2E controller image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-controller-image
path: artifacts
- name: Download E2E project image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-project-image
path: artifacts
- name: Restore E2E prebuilt artifact
run: tar -xzf artifacts/docker-git-e2e-prebuilt.tgz
- name: Free Docker disk
uses: ./.github/actions/free-docker-disk
- name: Load E2E Docker images
run: |
gzip -dc artifacts/docker-git-e2e-controller-image.tar.gz | docker load
docker image inspect docker-git-api \
-f 'controller revision={{ index .Config.Labels "io.prover-coder-ai.docker-git.controller-rev" }}'
gzip -dc artifacts/docker-git-e2e-project-image.tar.gz | docker load
docker image inspect "$DOCKER_GIT_E2E_PROJECT_IMAGE" \
-f 'project image={{.Id}}'
- name: Docker info
run: docker version && docker compose version
- name: Runtime volumes + host SSH CLI
run: bash scripts/e2e/runtime-volumes-ssh.sh
e2e-clone-auto-open-ssh:
name: E2E (Clone auto-open SSH)
needs: e2e-prepare
runs-on: ubuntu-latest
timeout-minutes: 40
env:
DOCKER_GIT_CONTROLLER_BUILD_SKILLER: "0"
DOCKER_GIT_E2E_USE_PREBUILT_CLI: "1"
DOCKER_GIT_E2E_PROJECT_IMAGE: docker-git-e2e-project:latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install dependencies
uses: ./.github/actions/setup
with:
install-dependencies: "false"
- name: Download E2E prebuilt artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-prebuilt
path: artifacts
- name: Download E2E controller image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-controller-image
path: artifacts
- name: Download E2E project image artifact
uses: actions/download-artifact@v7
with:
name: docker-git-e2e-project-image
path: artifacts
- name: Restore E2E prebuilt artifact
run: tar -xzf artifacts/docker-git-e2e-prebuilt.tgz
- name: Free Docker disk
uses: ./.github/actions/free-docker-disk
- name: Load E2E Docker images
run: |
gzip -dc artifacts/docker-git-e2e-controller-image.tar.gz | docker load
docker image inspect docker-git-api \
-f 'controller revision={{ index .Config.Labels "io.prover-coder-ai.docker-git.controller-rev" }}'
gzip -dc artifacts/docker-git-e2e-project-image.tar.gz | docker load
docker image inspect "$DOCKER_GIT_E2E_PROJECT_IMAGE" \
-f 'project image={{.Id}}'
- name: Docker info
run: docker version && docker compose version
- name: Clone auto-open SSH
run: bash scripts/e2e/clone-auto-open-ssh.sh