test: parallelize isolated acceptance suites #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: {} | |
| workflow_call: {} | |
| permissions: | |
| contents: read | |
| jobs: | |
| native: | |
| name: Native ${{ matrix.target }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: linux-amd64 | |
| runner: ubuntu-24.04 | |
| - target: linux-arm64 | |
| runner: ubuntu-24.04-arm | |
| - target: darwin-amd64 | |
| runner: macos-15-intel | |
| - target: darwin-arm64 | |
| runner: macos-15 | |
| - target: windows-amd64 | |
| runner: windows-2025 | |
| steps: | |
| - uses: actions/checkout@v6.1.0 | |
| with: | |
| persist-credentials: false | |
| - uses: jdx/mise-action@v4.3.0 | |
| with: | |
| version: 2026.8.16 | |
| cache: true | |
| - name: Run canonical checks | |
| run: mise run check | |
| - name: Add built commands to PATH | |
| shell: bash | |
| run: | | |
| path="$PWD/bin" | |
| if [ "$RUNNER_OS" = "Windows" ]; then | |
| path=$(cygpath --windows "$path") | |
| fi | |
| echo "$path" >> "$GITHUB_PATH" | |
| - name: Smoke-test commands and completion | |
| shell: bash | |
| run: | | |
| subcommit --version | |
| git-subcommit --version | |
| git-subcommit --help | |
| git subcommit -h | |
| for shell in bash zsh fish powershell; do | |
| test -n "$(subcommit --completion "$shell")" | |
| done | |
| release-matrix: | |
| name: Cross-build release matrix | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6.1.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - uses: jdx/mise-action@v4.3.0 | |
| with: | |
| version: 2026.8.16 | |
| cache: true | |
| - run: mise run release:check | |
| - run: mise run release:snapshot | |
| - name: Verify all cross-built archives | |
| shell: bash | |
| run: | | |
| for target in \ | |
| Darwin_x86_64.tar.gz Darwin_arm64.tar.gz \ | |
| Linux_x86_64.tar.gz Linux_arm64.tar.gz \ | |
| Windows_x86_64.zip Windows_arm64.zip; do | |
| compgen -G "dist/subcommit_*_${target}" >/dev/null | |
| done | |
| - name: Smoke-test host archive | |
| shell: bash | |
| run: | | |
| archive=$(compgen -G 'dist/subcommit_*_Linux_x86_64.tar.gz') | |
| mkdir smoke | |
| tar -xzf "$archive" -C smoke | |
| smoke/subcommit --version | |
| smoke/git-subcommit --version | |
| smoke/git-subcommit --help | |
| PATH="$PWD/smoke:$PATH" git subcommit -h | |
| test -f smoke/completions/subcommit.bash | |
| test -f smoke/completions/_subcommit | |
| test -f smoke/completions/subcommit.fish | |
| test -f smoke/completions/subcommit.ps1 | |
| - name: Smoke-test Unix installer | |
| shell: bash | |
| run: | | |
| mkdir -p installer-smoke/fakebin installer-smoke/bin | |
| cat >installer-smoke/fakebin/curl <<'EOF' | |
| #!/usr/bin/env bash | |
| set -eu | |
| output= | |
| url= | |
| while [ "$#" -gt 0 ]; do | |
| case "$1" in | |
| -o) | |
| output="$2" | |
| shift 2 | |
| ;; | |
| http://*|https://*) | |
| url="$1" | |
| shift | |
| ;; | |
| *) | |
| shift | |
| ;; | |
| esac | |
| done | |
| cp "$SUBCOMMIT_INSTALL_FIXTURES/${url##*/}" "$output" | |
| EOF | |
| chmod +x installer-smoke/fakebin/curl | |
| SUBCOMMIT_INSTALL_FIXTURES="$PWD/dist" \ | |
| PATH="$PWD/installer-smoke/fakebin:$PATH" \ | |
| bash assets/install.sh -d "$PWD/installer-smoke/bin" | |
| installer-smoke/bin/subcommit --version | |
| installer-smoke/bin/git-subcommit --version | |
| - name: Upload Windows installer fixture | |
| uses: actions/upload-artifact@v7.0.1 | |
| with: | |
| name: windows-installer-fixture | |
| path: | | |
| dist/checksums.txt | |
| dist/subcommit_*_Windows_x86_64.zip | |
| if-no-files-found: error | |
| retention-days: 1 | |
| compression-level: 0 | |
| windows-installer: | |
| name: Windows installer | |
| needs: release-matrix | |
| runs-on: windows-2025 | |
| steps: | |
| - uses: actions/checkout@v6.1.0 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: windows-installer-fixture | |
| path: dist | |
| - name: Smoke-test Windows installer | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| $originalUserPath = [System.Environment]::GetEnvironmentVariable( | |
| "Path", | |
| [System.EnvironmentVariableTarget]::User | |
| ) | |
| $installDir = Join-Path $PWD "installer-smoke" | |
| try { | |
| $env:SUBCOMMIT_INSTALL_FIXTURES = (Resolve-Path dist).Path | |
| function Invoke-WebRequest { | |
| param( | |
| [switch]$UseBasicParsing, | |
| [string]$Uri, | |
| [string]$OutFile | |
| ) | |
| $file = [System.IO.Path]::GetFileName($Uri) | |
| Copy-Item -LiteralPath (Join-Path $env:SUBCOMMIT_INSTALL_FIXTURES $file) ` | |
| -Destination $OutFile | |
| } | |
| New-Item -ItemType Directory -Path $installDir | Out-Null | |
| & ./assets/install.ps1 -InstallDir $installDir | |
| & "$installDir/subcommit.exe" --version | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "installed subcommit.exe failed" | |
| } | |
| & "$installDir/git-subcommit.exe" --version | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "installed git-subcommit.exe failed" | |
| } | |
| } finally { | |
| [System.Environment]::SetEnvironmentVariable( | |
| "Path", | |
| $originalUserPath, | |
| [System.EnvironmentVariableTarget]::User | |
| ) | |
| Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $installDir | |
| } |