-
Notifications
You must be signed in to change notification settings - Fork 0
181 lines (165 loc) · 5.38 KB
/
Copy pathci.yml
File metadata and controls
181 lines (165 loc) · 5.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
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