fix: expose Git command on Windows CI #4
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 | |
| - name: Smoke-test Windows installer | |
| if: matrix.target == 'windows-amd64' | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| $originalUserPath = [System.Environment]::GetEnvironmentVariable( | |
| "Path", | |
| [System.EnvironmentVariableTarget]::User | |
| ) | |
| $installDir = Join-Path $PWD "installer-smoke" | |
| try { | |
| mise run release:snapshot | |
| $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 | |
| } | |
| 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 |