name: CI on: push: branches: [main] # `labeled` reruns a pull request when a label asks for every platform # (scripts/ci-scope.py); any other label reruns the same Linux checks. # ready_for_review starts the run a draft skipped. pull_request: types: [opened, synchronize, reopened, labeled, ready_for_review] # The merge queue checks every platform before a change reaches main. merge_group: workflow_dispatch: # Deny by default; every job below declares the scopes it actually needs. # Fork PRs rely on Settings > Actions > General > Require approval for all # external contributors. Approval permits execution, not access to secrets: # keep pull_request, hosted runners, and secret-free/read-only PR jobs. permissions: {} # A newer run cancels the previous run for the same ref, including main. concurrency: group: ci-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true # Every rust-cache entry shares the repository's 10 GB budget. With full # debug info the entries overflowed it, and GitHub evicted the Windows # checks' caches between main runs, so they compiled from scratch. Without # debug info dependencies cache about 40% smaller and build faster; panics # still report file and line. Release profiles keep their own settings. env: CARGO_PROFILE_DEV_DEBUG: '0' jobs: # Audits the workflows themselves for injection, over-broad permissions, # unpinned actions, and credential persistence. It runs beside the other # jobs rather than before them, since each job waits its own turn for a # runner, and the required gate fails without it; GitHub's fork isolation # and protected release environments remain the credential boundary, not # the scanner. # # Draft pull requests run nothing: every job below waits on this one or on # `commits`, and the run starts when the draft is marked ready for review. zizmor: if: >- github.event.pull_request.draft != true && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.actor == 'penso' && github.triggering_actor == 'penso' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')))) name: Workflow Security # Members' runs use our own Linux VMs when CI_LINUX_ARM_RUNNER names # them, as the checks job does: every other job waits for this one, and # hosted runners are shared with every repository of the account. runs-on: ${{ fromJSON((github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association))) && vars.CI_LINUX_ARM_RUNNER || '"ubuntu-latest"') }} timeout-minutes: 10 permissions: contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # Shares the runner's checkout with the build jobs: keep target/. clean: ${{ runner.environment != 'self-hosted' }} persist-credentials: false - name: Clean the self-hosted checkout but its build if: runner.environment == 'self-hosted' run: bash scripts/ci-clean-self-hosted.sh - uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1 with: advanced-security: false online-audits: false # The release changelog is generated from these subjects, so a bad one is a # release defect. Local commits are caught earlier by `just hooks`. commits: if: >- github.event.pull_request.draft != true && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.actor == 'penso' && github.triggering_actor == 'penso' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')))) name: Commit messages outputs: cargo_scope: ${{ steps.scope.outputs.cargo_scope }} code: ${{ steps.changes.outputs.code }} full: ${{ steps.scope.outputs.full }} gpui: ${{ steps.scope.outputs.gpui }} macos_release: ${{ steps.changes.outputs.macos_release }} relay_agent: ${{ steps.changes.outputs.relay_agent }} website: ${{ steps.changes.outputs.website }} windows: ${{ steps.scope.outputs.windows }} windows_native: ${{ steps.changes.outputs.windows_native }} windows_package: ${{ steps.changes.outputs.windows_package }} # Members' runs use our own Linux VMs when CI_LINUX_ARM_RUNNER names # them, as the checks job does: every other job waits for this one, and # hosted runners are shared with every repository of the account. runs-on: ${{ fromJSON((github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association))) && vars.CI_LINUX_ARM_RUNNER || '"ubuntu-24.04"') }} timeout-minutes: 5 permissions: contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # Shares the runner's checkout with the build jobs: keep target/. clean: ${{ runner.environment != 'self-hosted' }} # The range being checked is history the default shallow clone lacks. fetch-depth: 0 persist-credentials: false - name: Clean the self-hosted checkout but its build if: runner.environment == 'self-hosted' run: bash scripts/ci-clean-self-hosted.sh - name: Check every commit subject the changelog will publish env: BASE: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }} HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} run: | set -euo pipefail # A first push or a rewritten branch has no usable base; check the # tip alone rather than every commit that ever reached the repository. if [[ ! $BASE =~ ^[0-9a-f]{40}$ ]] || ! git cat-file -e "$BASE^{commit}" 2>/dev/null; then BASE="$HEAD_SHA~1" fi python3 scripts/release/check-commit-messages.py range "$BASE..$HEAD_SHA" - name: Test automatic PR closure policy env: PYTHONDONTWRITEBYTECODE: '1' run: python3 scripts/test_close_low_confidence_prs.py - name: Test the relay list editor env: PYTHONDONTWRITEBYTECODE: '1' run: python3 scripts/test_relays.py - name: Test CI platform and crate selection env: PYTHONDONTWRITEBYTECODE: '1' run: python3 scripts/test_ci_scope.py - name: Test the self-hosted checkout cleanup env: PYTHONDONTWRITEBYTECODE: '1' run: python3 scripts/tests/test_ci_clean_self_hosted.py - name: Test the self-hosted runners' job hook env: PYTHONDONTWRITEBYTECODE: '1' run: python3 scripts/tests/test_ci_runner_job_hook.py - name: Detect build and test inputs id: changes env: EVENT: ${{ github.event_name }} BASE: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }} HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} run: bash scripts/ci-changes.sh >> "$GITHUB_OUTPUT" # Pull requests run Linux and the crates they reach; the merge queue and # main run every platform over the workspace, as releases require. - name: Select platforms and crates id: scope env: PYTHONDONTWRITEBYTECODE: '1' EVENT: ${{ github.event_name }} BASE: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }} HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }} run: python3 scripts/ci-scope.py >> "$GITHUB_OUTPUT" checks: if: >- needs.commits.outputs.code == 'true' && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.actor == 'penso' && github.triggering_actor == 'penso' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')))) name: Format, lint, and test (${{ matrix.runner }}, ${{ matrix.features }}) needs: commits strategy: fail-fast: false matrix: # macOS 14, the oldest supported release, is off: every macOS job # shares one account-wide runner limit with the release. Add it back # if a macOS 14 regression shows up: # runner: [macos-14, macos-15, ubuntu-24.04, ubuntu-24.04-arm] runner: [macos-15, ubuntu-24.04, ubuntu-24.04-arm] # The two test passes each take most of the job, so they run side by # side, each with one of the lints; the script checks ride with the # default-features pass. features: [default, all] # Every pull request runs the macOS default-features leg, as nothing # checks macOS between it and main. A members' pull request runs its # Linux legs on ARM64, which our own machines take; x86_64 Linux is # left to main and the merge queue. Any other pull request runs x86_64 # Linux, adding ARM64 when it needs every platform # (scripts/ci-scope.py). Every platform also brings the macOS # all-features leg for members, whose macOS runs on our own Macs; a # fork's runs on the account's few hosted macOS runners and skips it. # Main and the merge queue run every leg. exclude: ${{ fromJSON(github.event_name != 'pull_request' && '[]' || (github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)) && (needs.commits.outputs.full != 'true' && '[{"runner":"ubuntu-24.04"},{"runner":"macos-15","features":"all"}]' || '[{"runner":"ubuntu-24.04"}]') || needs.commits.outputs.full != 'true' && '[{"runner":"macos-15","features":"all"},{"runner":"ubuntu-24.04-arm"}]' || '[{"runner":"macos-15","features":"all"}]') }} # The repository variables CI_MACOS_RUNNER and CI_LINUX_ARM_RUNNER, JSON # label lists such as '["self-hosted", "macOS", "ARM64", "tart"]', move # the macOS and ARM64 Linux legs to our own machines, past the account's # five hosted macOS jobs and onto warm build directories, for code only # members wrote: main, the merge queue, and pull requests from branches of # this repository opened by its owner, members, or collaborators. A # fork's pull request, or a bot's such as Dependabot's, which brings in # new dependencies' build scripts, stays on hosted runners. runs-on: ${{ fromJSON((github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association))) && (matrix.runner == 'macos-15' && vars.CI_MACOS_RUNNER || matrix.runner == 'ubuntu-24.04-arm' && vars.CI_LINUX_ARM_RUNNER) || toJSON(matrix.runner)) }} timeout-minutes: ${{ matrix.runner == 'macos-15' && 120 || (matrix.runner == 'ubuntu-24.04-arm' && matrix.features == 'all') && 90 || 60 }} permissions: contents: read env: # `--workspace`, the crates a pull request reaches, or empty for none. SCOPE: ${{ needs.commits.outputs.cargo_scope }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false # A self-hosted runner keeps its target directory between runs, so # a build compiles only what changed; the next step cleans the rest. clean: ${{ runner.environment != 'self-hosted' }} - name: Clean the self-hosted checkout but its build if: runner.environment == 'self-hosted' run: bash scripts/ci-clean-self-hosted.sh - name: Install Linux build dependencies if: runner.os == 'Linux' run: bash scripts/install-linux-deps.sh # Lets the release script tests build real .deb, .rpm and Arch packages. - name: Install the pinned Linux package builder if: runner.os == 'Linux' && matrix.features == 'default' run: echo "HERDR_TEST_NFPM=$(bash scripts/release/install-nfpm.sh "$RUNNER_TEMP/nfpm")" >> "$GITHUB_ENV" - name: Test release scripts and security contracts without credentials if: matrix.features == 'default' env: PYTHONDONTWRITEBYTECODE: '1' run: | python3 -c 'import sys; assert sys.version_info >= (3, 11), "Python 3.11+ required"' jq --version python3 -m unittest discover -s scripts/release/tests -v python3 scripts/release/test-release-security.py python3 assets/icons/test_artwork.py # The signed update manifests' contract. Releases require this job, so # a manifest regression stops a release, not only the Updater workflow. - name: Test update manifest contracts if: matrix.features == 'default' env: PYTHONDONTWRITEBYTECODE: '1' run: | if [[ "$RUNNER_OS" == macOS ]]; then OPENSSL="$(brew --prefix openssl@3)/bin/openssl" # Self-hosted Tart images may lack it; macOS's own is LibreSSL. if [[ ! -x "$OPENSSL" ]]; then HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 \ brew install --quiet openssl@3 fi else OPENSSL=/usr/bin/openssl fi export OPENSSL "$OPENSSL" version | grep -q '^OpenSSL 3\.' python3 -m unittest discover -s scripts -p 'test_*manifest.py' -v - name: Install pinned Rust toolchain run: rustup show # Remote shims run on POSIX hosts, including WSL, independently of the desktop. - name: Test remote work entrypoint if: matrix.features == 'default' env: PYTHONDONTWRITEBYTECODE: '1' run: python3 scripts/tests/test_remote_work.py - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 if: runner.environment != 'self-hosted' with: key: checks-${{ matrix.features }} save-if: ${{ github.ref == 'refs/heads/main' }} # Hosted ARM64 Linux runners have 16 GB RAM; building and linking the # all-features workspace tests with GNU ld at full parallelism OOM-kills # the VM. Use lld and bound Cargo to 2 jobs instead. - name: Bound Cargo memory on hosted ARM64 all-features builds if: runner.environment != 'self-hosted' && matrix.runner == 'ubuntu-24.04-arm' && matrix.features == 'all' run: | if ! command -v ld.lld >/dev/null 2>&1; then sudo apt-get -o Acquire::Retries=3 -o Acquire::http::No-Cache=true update sudo apt-get -o Acquire::Retries=3 install --no-install-recommends -y lld fi { echo "CARGO_BUILD_JOBS=2" echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-C link-arg=-fuse-ld=lld" } >> "$GITHUB_ENV" - name: Check formatting if: matrix.features == 'default' run: cargo fmt --all -- --check - name: Check source file sizes if: matrix.features == 'default' run: bash scripts/check-file-size.sh - name: Check keep-sorted regions if: matrix.features == 'default' run: | python3 scripts/test_check_sorted.py python3 scripts/check-sorted.py - name: Check Fluent messages if: matrix.features == 'default' env: PYTHONDONTWRITEBYTECODE: '1' run: | python3 scripts/test_check_i18n.py python3 scripts/check-i18n.py - name: Test mockup feedback receiver if: matrix.features == 'default' run: python3 .claude/skills/gpui-mockup/scripts/test_wait.py - name: Test terminal benchmark measurements if: matrix.features == 'default' env: PYTHONDONTWRITEBYTECODE: '1' run: python3 scripts/test_bench_terminal.py - name: Lint every target and feature if: matrix.features == 'all' && env.SCOPE != '' run: read -ra scope <<< "$SCOPE" && cargo clippy --locked "${scope[@]}" --all-targets --all-features -- -D warnings - name: Lint without default features if: matrix.features == 'default' && env.SCOPE != '' run: read -ra scope <<< "$SCOPE" && cargo clippy --locked "${scope[@]}" --all-targets --no-default-features -- -D warnings - name: Test default features and executable CLI if: matrix.features == 'default' && env.SCOPE != '' run: read -ra scope <<< "$SCOPE" && cargo test --locked "${scope[@]}" # Hosted ubuntu-24.04-arm runners OOM when Cargo compiles and links # sheprd-gpui's lib, bin, and integration-test targets in parallel. - name: Limit build jobs on hosted Linux ARM64 all-features if: runner.environment != 'self-hosted' && matrix.runner == 'ubuntu-24.04-arm' && matrix.features == 'all' run: echo "CARGO_BUILD_JOBS=1" >> "$GITHUB_ENV" - name: Test integration-feature build and executable CLI if: matrix.features == 'all' && env.SCOPE != '' run: read -ra scope <<< "$SCOPE" && cargo test --locked "${scope[@]}" --all-features # The `moonframe` feature's Luau layout loads only at run time: load every # module and report what fails, without a window. The CLI integration # tests already build `sheprd` with this matrix's features: the default # build checks the copy compiled in; all features read the sources. - name: Check the Moonframe layout if: needs.commits.outputs.gpui == 'true' run: ./target/debug/sheprd --check # Match the other platforms' Rust checks without an extra optimized build, # in the merge queue, on main, and on pull requests that need every platform. # Native GUI tests run in windows-native; the Windows release builds run in # the release workflow. windows: if: >- needs.commits.outputs.code == 'true' && needs.commits.outputs.windows == 'true' && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.actor == 'penso' && github.triggering_actor == 'penso' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')))) name: Windows check (${{ matrix.runner }}, ${{ matrix.features }}) needs: commits strategy: fail-fast: false matrix: runner: [windows-2025, windows-11-arm] # Split as in the checks job: each test pass with one of the lints. features: [default, all] runs-on: ${{ matrix.runner }} timeout-minutes: ${{ matrix.runner == 'windows-11-arm' && matrix.features == 'all' && 90 || 60 }} permissions: contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Install pinned Rust toolchain run: rustup show - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: key: ${{ matrix.runner }}-${{ matrix.features }} save-if: ${{ github.ref == 'refs/heads/main' }} - name: Check formatting if: matrix.features == 'default' run: cargo fmt --all -- --check - name: Lint every target and feature if: matrix.features == 'all' run: cargo clippy --locked --workspace --all-targets --all-features -- -D warnings - name: Lint without default features if: matrix.features == 'default' run: cargo clippy --locked --workspace --all-targets --no-default-features -- -D warnings - name: Test default features and executable CLI if: matrix.features == 'default' run: cargo test --locked --workspace - name: Test integration-feature build and executable CLI if: matrix.features == 'all' run: cargo test --locked --workspace --all-features # The CLI integration tests already build sheprd.exe with this matrix's features. - name: Check the Moonframe layout shell: bash run: ./target/debug/sheprd.exe --check # The native GUI tests (`just test-gui`, `just test-sidebar`) on a real # Windows desktop session against a pinned, checksummed Herdr daemon in the # shared test sandbox, then the release-mode performance budget # (`just test-perf`). Hosted runners have no GPU, so Direct3D runs on WARP: # the budget is a regression tripwire, not a target for real hardware. # Pull requests run it only when what the tests launch changes # (`scripts/ci-changes.sh`); main always does. windows-native: if: >- needs.commits.outputs.windows_native == 'true' && needs.commits.outputs.windows == 'true' && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.actor == 'penso' && github.triggering_actor == 'penso' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')))) name: Windows native GUI (${{ matrix.runner }}) needs: commits strategy: fail-fast: false matrix: runner: [windows-2025, windows-11-arm] runs-on: ${{ matrix.runner }} timeout-minutes: 90 permissions: contents: read defaults: run: shell: bash steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Install pinned Rust toolchain run: rustup show - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: key: native-${{ matrix.runner }} save-if: ${{ github.ref == 'refs/heads/main' }} - name: Install the pinned Herdr daemon run: echo "HERDR_TEST_BINARY=$(python scripts/install-herdr-windows.py "$RUNNER_TEMP/herdr")" >> "$GITHUB_ENV" # Runners start at 1024x768; the sidebar fixture skips, and counts, any # window size the display cannot hold if this is refused. - name: Raise the desktop resolution run: pwsh -NoProfile -ExecutionPolicy Bypass -File scripts/set-display-resolution.ps1 # Herdr publishes no ARM64 Windows build. Under x64 emulation on # windows-11-arm its panes echo typed text but never act on Enter, so # the live-daemon test runs on x64; the native fixtures run on both. - name: Native window, input, and live-daemon tests env: RUNNER: ${{ matrix.runner }} run: | skip=() if [[ $RUNNER == windows-11-arm ]]; then skip=(--skip native_gui_live); fi cargo test --locked -p sheprd-gpui --features integration-test --test live_gui -- --ignored --nocapture --test-threads=1 "${skip[@]}" # The updater's Authenticode check against a real signature: the pinned # archive's Microsoft-signed OpenConsole.exe, compared with PowerShell. - name: Update installer signer check run: | HERDR_TEST_SIGNED_FILE="$(dirname "$HERDR_TEST_BINARY")/conpty/x64/OpenConsole.exe" \ cargo test --locked -p sheprd-gpui signer_matches_what_powershell_reports -- --ignored --nocapture # An optimized build, too slow for a pull request: the merge queue and # main run it, and a labeled pull request asking for every platform # leaves it to them. - name: Release-mode performance budget if: github.event_name != 'pull_request' env: HERDR_PERF_P95_MS: '100' run: | cargo build --locked --release -p sheprd-gpui --features integration-test target/release/sheprd.exe --performance-test # The optimized Windows build, its zip, and its installer, made and installed # as the release workflow does, so a packaging or installer mistake fails the # merge queue rather than a release. A release build is too slow for every # change, so this runs only when what those artifacts are made from changes, # and with every platform: in the merge queue, on main, and on a pull # request labeled for it. windows-package: if: >- needs.commits.outputs.windows_package == 'true' && needs.commits.outputs.windows == 'true' && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.actor == 'penso' && github.triggering_actor == 'penso' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')))) name: Windows package and installer needs: commits runs-on: windows-2025 timeout-minutes: 60 # The steps read "$TARGET" and friends, as the release workflow's do. defaults: run: shell: bash permissions: contents: read env: # Packaging names files after a release version; any valid one will do. VERSION: '20000101.1' TARGET: x86_64-pc-windows-msvc steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false # The other jobs that run scripts/release/tests are macOS and Linux, # where the shortcut test skips; run it here, before the slow build. - name: Test the install script's Start menu shortcut run: python scripts/release/tests/test_install_ps1.py -v - name: Install pinned Rust toolchain run: rustup show - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: key: windows-package save-if: ${{ github.ref == 'refs/heads/main' }} - name: Build optimized Windows executables run: cargo build --locked --release -p sheprd-gpui -p sheprd-launcher -p sheprd-acp -p sheprd-remote-control -p sheprd-automate -p sheprd-nearby --target "$TARGET" - name: Smoke-test the optimized executable as the release does run: python scripts/release/smoke-cli.py "target/$TARGET/release/sheprd.exe" # The package requires the pinned herdr-core beside the app, as the # release fetches it. - name: Fetch the pinned herdr-core run: python scripts/release/fetch-herdr-core.py "$TARGET" "target/$TARGET/release" - name: Smoke-test herdr-core run: '"target/$TARGET/release/herdr-core.exe" --version' # The release job passes generated third-party notices; any nonempty # file exercises the same packaging. - name: Package the Windows zip run: | mkdir dist python scripts/release/package-windows.py "$VERSION" "$TARGET" "target/$TARGET/release/sheprd.exe" "target/$TARGET/release/sheprd-launcher.exe" dist LICENSE - name: Install the pinned Inno Setup compiler run: python scripts/release/windows-installer.py install-iscc "$RUNNER_TEMP/inno-setup" > "$RUNNER_TEMP/iscc-path" - name: Build the Windows installer run: python scripts/release/windows-installer.py build "$VERSION" "$TARGET" "dist/Sheprd-$VERSION-$TARGET.zip" dist "$(cat "$RUNNER_TEMP/iscc-path")" - name: Install and uninstall the Windows installer run: python scripts/release/windows-installer.py smoke "dist/Sheprd-$VERSION-$TARGET-setup.exe" # sheprd.org and its docs, which Netlify builds at deploy time. Python only, # so a website-only change runs this and skips every native job; a broken # link or page fails here before the deploy does. website: if: >- needs.commits.outputs.website == 'true' && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.actor == 'penso' && github.triggering_actor == 'penso' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')))) name: Website and docs needs: commits # Members' runs use our own Linux VMs when CI_LINUX_ARM_RUNNER names # them, as the checks job does: every other job waits for this one, and # hosted runners are shared with every repository of the account. runs-on: ${{ fromJSON((github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association))) && vars.CI_LINUX_ARM_RUNNER || '"ubuntu-24.04"') }} timeout-minutes: 10 permissions: contents: read env: PYTHONDONTWRITEBYTECODE: '1' steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # Shares the runner's checkout with the build jobs: keep target/. clean: ${{ runner.environment != 'self-hosted' }} persist-credentials: false - name: Clean the self-hosted checkout but its build if: runner.environment == 'self-hosted' run: bash scripts/ci-clean-self-hosted.sh - name: Check the docs site run: | python3 -m venv "$RUNNER_TEMP/docs-venv" "$RUNNER_TEMP/docs-venv/bin/pip" install --quiet --require-hashes -r website/requirements.txt "$RUNNER_TEMP/docs-venv/bin/python" website/tools/test_docs.py "$RUNNER_TEMP/docs-venv/bin/python" website/tools/docs.py --check - name: Test the sheprd.org publishing contracts run: python3 -m unittest discover -s site/tests -v # Keep the branch-protection context stable while requiring every platform # the run selected. checks-passed: name: Format, lint, and test needs: [checks, windows, windows-native, windows-package, build-macos, relay-agent, commits, website, zizmor] if: >- always() && github.event.pull_request.draft != true && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group' || ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.actor == 'penso' && github.triggering_actor == 'penso' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')))) # Members' runs use our own Linux VMs when CI_LINUX_ARM_RUNNER names # them, as the checks job does: every other job waits for this one, and # hosted runners are shared with every repository of the account. runs-on: ${{ fromJSON((github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association))) && vars.CI_LINUX_ARM_RUNNER || '"ubuntu-24.04"') }} timeout-minutes: 5 permissions: {} steps: - name: Require all platform checks env: RESULT: ${{ needs.checks.result }} WINDOWS: ${{ needs.windows.result }} NATIVE: ${{ needs.windows-native.result }} NATIVE_INPUTS: ${{ needs.commits.outputs.windows_native }} PACKAGE: ${{ needs.windows-package.result }} MACOS_RELEASE: ${{ needs.build-macos.result }} MACOS_INPUTS: ${{ needs.commits.outputs.macos_release }} RELAY_AGENT: ${{ needs.relay-agent.result }} RELAY_AGENT_INPUTS: ${{ needs.commits.outputs.relay_agent }} EVENT: ${{ github.event_name }} COMMITS: ${{ needs.commits.result }} CODE: ${{ needs.commits.outputs.code }} FULL: ${{ needs.commits.outputs.full }} WINDOWS_SCOPE: ${{ needs.commits.outputs.windows }} PACKAGE_INPUTS: ${{ needs.commits.outputs.windows_package }} SITE: ${{ needs.website.result }} SITE_INPUTS: ${{ needs.commits.outputs.website }} ZIZMOR: ${{ needs.zizmor.result }} run: | test "$COMMITS" = success && test "$ZIZMOR" = success || exit 1 # Only a pull request may skip platforms; main and the merge queue # check every one. if [ "$EVENT" != pull_request ]; then test "$FULL" = true && test "$WINDOWS_SCOPE" = true || exit 1 fi if [ "$CODE" = true ]; then test "$RESULT" = success || exit 1 if [ "$WINDOWS_SCOPE" = true ]; then test "$WINDOWS" = success || exit 1 else test "$WINDOWS_SCOPE" = false && test "$WINDOWS" = skipped || exit 1 fi else test "$CODE" = false && test "$RESULT" = skipped && test "$WINDOWS" = skipped || exit 1 fi # The GUI tests run with every platform: on main and in the merge # queue with code changes, on pull requests when their inputs # change; missing detection fails. if [ "$NATIVE_INPUTS" = true ] && [ "$WINDOWS_SCOPE" = true ]; then test "$NATIVE" = success || exit 1 else { [ "$NATIVE_INPUTS" = false ] || [ "$WINDOWS_SCOPE" = false ]; } && test "$NATIVE" = skipped || exit 1 fi # The macOS release builds run before merge, with every platform, # when their inputs change. if [ "$CODE" = true ] && [ "$MACOS_INPUTS" = true ] && [ "$FULL" = true ] && { [ "$EVENT" = pull_request ] || [ "$EVENT" = merge_group ]; }; then test "$MACOS_RELEASE" = success || exit 1 else test "$MACOS_RELEASE" = skipped || exit 1 fi # The relay agent builds run before merge when their inputs change. if [ "$RELAY_AGENT_INPUTS" = true ] && { [ "$EVENT" = pull_request ] || [ "$EVENT" = merge_group ]; }; then test "$RELAY_AGENT" = success || exit 1 else test "$RELAY_AGENT" = skipped || exit 1 fi if [ "$PACKAGE_INPUTS" = true ] && [ "$WINDOWS_SCOPE" = true ]; then test "$PACKAGE" = success || exit 1 else { [ "$PACKAGE_INPUTS" = false ] || [ "$WINDOWS_SCOPE" = false ]; } && test "$PACKAGE" = skipped || exit 1 fi if [ "$SITE_INPUTS" = true ]; then test "$SITE" = success else test "$SITE_INPUTS" = false && test "$SITE" = skipped fi # Linux release builds on main, which the release gate requires. The release # workflow builds the same targets but only smoke-tests what it ships. build: if: >- needs.commits.outputs.code == 'true' && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.actor == 'penso' && github.triggering_actor == 'penso' name: Release (${{ matrix.target }}) needs: commits strategy: fail-fast: false matrix: include: - runner: ubuntu-24.04 target: x86_64-unknown-linux-gnu - runner: ubuntu-24.04-arm target: aarch64-unknown-linux-gnu runs-on: ${{ matrix.runner }} timeout-minutes: 60 permissions: contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Install Linux build dependencies run: bash scripts/install-linux-deps.sh - name: Install pinned Rust toolchain env: TARGET: ${{ matrix.target }} run: | rustup show rustup target add "$TARGET" - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: key: release-${{ matrix.target }} save-if: ${{ github.ref == 'refs/heads/main' }} - name: Build optimized executable env: TARGET: ${{ matrix.target }} run: cargo build --locked --release -p sheprd-gpui --target "$TARGET" # The full CLI suite in release mode, for this commit; the release # workflow only smoke-tests the bytes it ships, since `cargo test` # rebuilds the executable with dev-dependency features. - name: Exercise release executable without opening a window env: TARGET: ${{ matrix.target }} run: cargo test --locked --release -p sheprd-gpui --test cli --target "$TARGET" # sheprd-relay-agent as each release builds it for the machines Sheprd # shares as a fleet's plain host (scripts/release/build-agent.sh), before # merge only and when what it is built from changes (`scripts/ci-changes.sh`). # A pull request builds the x86_64 Linux one; one that needs every # platform, and the merge queue, also build the aarch64 Linux one and both # Macs' on one macOS runner. The release workflow builds all four anyway. relay-agent: if: >- needs.commits.outputs.relay_agent == 'true' && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group') name: Relay agent (${{ matrix.runner }}) needs: commits strategy: fail-fast: false matrix: runner: [ubuntu-24.04, ubuntu-24.04-arm, macos-15] exclude: ${{ fromJSON(needs.commits.outputs.full != 'true' && '[{"runner":"macos-15"},{"runner":"ubuntu-24.04-arm"}]' || '[]') }} # Our own machines for members' macOS and ARM64 legs, as in the checks job. runs-on: ${{ fromJSON((github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association))) && (matrix.runner == 'macos-15' && vars.CI_MACOS_RUNNER || matrix.runner == 'ubuntu-24.04-arm' && vars.CI_LINUX_ARM_RUNNER) || toJSON(matrix.runner)) }} timeout-minutes: 30 permissions: contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false # Shares the runner's checkout with the build jobs: keep target/. clean: ${{ runner.environment != 'self-hosted' }} - name: Clean the self-hosted checkout but its build if: runner.environment == 'self-hosted' run: bash scripts/ci-clean-self-hosted.sh - run: rustup show # Linux builds its own architecture's static agent; macOS builds # both thin ones, the x86_64 one cross-compiled. - name: Build sheprd-relay-agent as a release does run: | if [ "$(uname -s)" = Darwin ]; then targets="aarch64-apple-darwin x86_64-apple-darwin" else targets="$(uname -m)-unknown-linux-musl" fi for target in $targets; do bash scripts/release/build-agent.sh "$target" "$RUNNER_TEMP/sheprd-relay-agent-$target" done # The macOS release builds and their release-mode CLI suite, before merge # only and when what they depend on changes (`scripts/ci-changes.sh`): in # the merge queue and on pull requests that need every platform. On main # they would hold two of the account-wide macOS runners the release # workflow's own macOS builds wait for. With no main run to save a cache, # there is nothing to restore, so they build cold. build-macos: if: >- needs.commits.outputs.macos_release == 'true' && needs.commits.outputs.full == 'true' && (github.repository == 'sheprd-labs/sheprd' || github.repository == 'penso/herdr-gpui') && (github.event_name == 'pull_request' || github.event_name == 'merge_group') name: Release (${{ matrix.target }}) needs: commits strategy: fail-fast: false matrix: # x86_64 macOS cross-compiles on Apple Silicon and runs under Rosetta, # as the release workflow builds it; Intel runners are scarce. target: [aarch64-apple-darwin, x86_64-apple-darwin] # Our own Macs when CI_MACOS_RUNNER names them, for members' code only, # as in the checks job. runs-on: ${{ fromJSON((github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association))) && vars.CI_MACOS_RUNNER || '"macos-15"') }} timeout-minutes: 60 permissions: contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false # A self-hosted runner keeps its target directory between runs, so # a build compiles only what changed; the next step cleans the rest. clean: ${{ runner.environment != 'self-hosted' }} - name: Clean the self-hosted checkout but its build if: runner.environment == 'self-hosted' run: bash scripts/ci-clean-self-hosted.sh - name: Install pinned Rust toolchain env: TARGET: ${{ matrix.target }} run: | rustup show rustup target add "$TARGET" - name: Require Rosetta for the x86_64 macOS executable if: matrix.target == 'x86_64-apple-darwin' run: arch -x86_64 /usr/bin/true || sudo softwareupdate --install-rosetta --agree-to-license - name: Build optimized executable env: TARGET: ${{ matrix.target }} run: cargo build --locked --release -p sheprd-gpui --target "$TARGET" # Rosetta translates an x86_64 executable on its first launch, which # outlasts the CLI suite's 10 second limit when several tests start it # at once. Build the suite's own executable (it differs from the one # above) and launch it once, so the tests find it translated. - name: Translate the x86_64 test executable once if: matrix.target == 'x86_64-apple-darwin' env: TARGET: ${{ matrix.target }} run: | cargo test --locked --release -p sheprd-gpui --test cli --target "$TARGET" --no-run "target/$TARGET/release/sheprd" --build-info - name: Exercise release executable without opening a window env: TARGET: ${{ matrix.target }} run: cargo test --locked --release -p sheprd-gpui --test cli --target "$TARGET"