|
13 | 13 | - linux-x64 |
14 | 14 | - macos-arm64 |
15 | 15 | - macos-x64 |
| 16 | + - windows-x64 |
16 | 17 | - all |
17 | 18 | ubuntu_version: |
18 | | - description: "Ubuntu runner baseline for Linux builds. Ignored for macOS." |
| 19 | + description: "Ubuntu runner baseline for Linux builds. Ignored for macOS and Windows." |
19 | 20 | required: true |
20 | 21 | default: "22.04" |
21 | 22 | type: choice |
@@ -83,19 +84,22 @@ jobs: |
83 | 84 |
|
84 | 85 | case "${INPUT_PLATFORM}" in |
85 | 86 | linux-arm64) |
86 | | - MATRIX="{\"platform\":[{\"os\":\"${LINUX_ARM64_RUNNER}\",\"name\":\"linux-arm64-${LINUX_NAME_SUFFIX}\",\"target\":\"aarch64-unknown-linux-gnu\",\"can_smoke_test\":true}]}" |
| 87 | + MATRIX="{\"platform\":[{\"os\":\"${LINUX_ARM64_RUNNER}\",\"name\":\"linux-arm64-${LINUX_NAME_SUFFIX}\",\"target\":\"aarch64-unknown-linux-gnu\"}]}" |
87 | 88 | ;; |
88 | 89 | linux-x64) |
89 | | - MATRIX="{\"platform\":[{\"os\":\"${LINUX_X64_RUNNER}\",\"name\":\"linux-x64-${LINUX_NAME_SUFFIX}\",\"target\":\"x86_64-unknown-linux-gnu\",\"can_smoke_test\":true}]}" |
| 90 | + MATRIX="{\"platform\":[{\"os\":\"${LINUX_X64_RUNNER}\",\"name\":\"linux-x64-${LINUX_NAME_SUFFIX}\",\"target\":\"x86_64-unknown-linux-gnu\"}]}" |
90 | 91 | ;; |
91 | 92 | macos-arm64) |
92 | | - MATRIX='{"platform":[{"os":"macos-15","name":"macos-arm64","target":"aarch64-apple-darwin","can_smoke_test":true}]}' |
| 93 | + MATRIX='{"platform":[{"os":"macos-15","name":"macos-arm64","target":"aarch64-apple-darwin"}]}' |
93 | 94 | ;; |
94 | 95 | macos-x64) |
95 | | - MATRIX='{"platform":[{"os":"macos-15-intel","name":"macos-x64","target":"x86_64-apple-darwin","can_smoke_test":true}]}' |
| 96 | + MATRIX='{"platform":[{"os":"macos-15-intel","name":"macos-x64","target":"x86_64-apple-darwin"}]}' |
| 97 | + ;; |
| 98 | + windows-x64) |
| 99 | + MATRIX='{"platform":[{"os":"windows-latest","name":"windows-x64","target":"x86_64-pc-windows-msvc"}]}' |
96 | 100 | ;; |
97 | 101 | all) |
98 | | - MATRIX="{\"platform\":[{\"os\":\"macos-15\",\"name\":\"macos-arm64\",\"target\":\"aarch64-apple-darwin\",\"can_smoke_test\":true},{\"os\":\"macos-15-intel\",\"name\":\"macos-x64\",\"target\":\"x86_64-apple-darwin\",\"can_smoke_test\":true},{\"os\":\"${LINUX_X64_RUNNER}\",\"name\":\"linux-x64-${LINUX_NAME_SUFFIX}\",\"target\":\"x86_64-unknown-linux-gnu\",\"can_smoke_test\":true},{\"os\":\"${LINUX_ARM64_RUNNER}\",\"name\":\"linux-arm64-${LINUX_NAME_SUFFIX}\",\"target\":\"aarch64-unknown-linux-gnu\",\"can_smoke_test\":true}]}" |
| 102 | + MATRIX="{\"platform\":[{\"os\":\"macos-15\",\"name\":\"macos-arm64\",\"target\":\"aarch64-apple-darwin\"},{\"os\":\"macos-15-intel\",\"name\":\"macos-x64\",\"target\":\"x86_64-apple-darwin\"},{\"os\":\"${LINUX_X64_RUNNER}\",\"name\":\"linux-x64-${LINUX_NAME_SUFFIX}\",\"target\":\"x86_64-unknown-linux-gnu\"},{\"os\":\"${LINUX_ARM64_RUNNER}\",\"name\":\"linux-arm64-${LINUX_NAME_SUFFIX}\",\"target\":\"aarch64-unknown-linux-gnu\"},{\"os\":\"windows-latest\",\"name\":\"windows-x64\",\"target\":\"x86_64-pc-windows-msvc\"}]}" |
99 | 103 | ;; |
100 | 104 | *) |
101 | 105 | echo "Unsupported platform: ${INPUT_PLATFORM}" >&2 |
@@ -148,87 +152,63 @@ jobs: |
148 | 152 | shared-key: "cli-manual-v1-${{ matrix.platform.name }}" |
149 | 153 | cache-bin: false |
150 | 154 |
|
151 | | - - name: Build bitfun-cli |
| 155 | + - name: Build CLI (Unix) |
| 156 | + if: runner.os != 'Windows' |
152 | 157 | shell: bash |
153 | 158 | run: | |
154 | 159 | set -euo pipefail |
155 | 160 | cargo build --release \ |
156 | 161 | --target ${{ matrix.platform.target }} \ |
157 | 162 | -p bitfun-cli |
158 | 163 |
|
159 | | - - name: Smoke test (--version) |
160 | | - if: matrix.platform.can_smoke_test == true |
| 164 | + - name: Build CLI (Windows) |
| 165 | + if: runner.os == 'Windows' |
| 166 | + shell: pwsh |
| 167 | + env: |
| 168 | + RUSTFLAGS: -C target-feature=+crt-static |
| 169 | + run: cargo build --release --target ${{ matrix.platform.target }} -p bitfun-cli |
| 170 | + |
| 171 | + - name: Test installer (Unix) |
| 172 | + if: runner.os != 'Windows' |
161 | 173 | shell: bash |
162 | | - run: | |
163 | | - set -euo pipefail |
164 | | - BIN="target/${{ matrix.platform.target }}/release/bitfun-cli" |
165 | | - "$BIN" --version |
166 | | - "$BIN" --help > /dev/null |
| 174 | + env: |
| 175 | + CARGO_BUILD_TARGET: ${{ matrix.platform.target }} |
| 176 | + run: bash scripts/cli/test-install-unix.sh "${{ matrix.platform.target }}" |
167 | 177 |
|
168 | | - - name: Stage tarball |
| 178 | + - name: Test installer (Windows) |
| 179 | + if: runner.os == 'Windows' |
| 180 | + shell: pwsh |
| 181 | + env: |
| 182 | + CARGO_BUILD_TARGET: ${{ matrix.platform.target }} |
| 183 | + RUSTFLAGS: -C target-feature=+crt-static |
| 184 | + run: ./scripts/cli/test-install-windows.ps1 -Target $env:CARGO_BUILD_TARGET |
| 185 | + |
| 186 | + - name: Package and smoke test (Unix) |
| 187 | + if: runner.os != 'Windows' |
169 | 188 | id: stage |
170 | 189 | shell: bash |
171 | 190 | env: |
172 | 191 | VERSION: ${{ needs.prepare.outputs.version }} |
173 | 192 | TARGET: ${{ matrix.platform.target }} |
174 | 193 | run: | |
175 | 194 | set -euo pipefail |
| 195 | + bash scripts/cli/package-unix.sh "$VERSION" "$TARGET" |
176 | 196 |
|
177 | | - STAGE_DIR="$(pwd)/dist-cli/bitfun-cli-${VERSION}-${TARGET}" |
178 | | - mkdir -p "$STAGE_DIR" |
179 | | -
|
180 | | - cp "target/${TARGET}/release/bitfun-cli" "$STAGE_DIR/" |
181 | | - cp LICENSE "$STAGE_DIR/" || true |
182 | | - cp README.md "$STAGE_DIR/" || true |
183 | | -
|
184 | | - if [[ -d "src/apps/cli/themes" ]]; then |
185 | | - cp -R "src/apps/cli/themes" "$STAGE_DIR/themes" |
186 | | - fi |
187 | | - if [[ -d "src/apps/cli/prompts" ]]; then |
188 | | - cp -R "src/apps/cli/prompts" "$STAGE_DIR/prompts" |
189 | | - fi |
190 | | -
|
191 | | - ARCHIVE="bitfun-cli-${VERSION}-${TARGET}.tar.gz" |
192 | | - tar -C "$(dirname "$STAGE_DIR")" -czf "$ARCHIVE" "$(basename "$STAGE_DIR")" |
193 | | -
|
194 | | - if command -v sha256sum >/dev/null 2>&1; then |
195 | | - sha256sum "$ARCHIVE" > "${ARCHIVE}.sha256" |
196 | | - else |
197 | | - shasum -a 256 "$ARCHIVE" > "${ARCHIVE}.sha256" |
198 | | - fi |
199 | | -
|
200 | | - echo "archive=$ARCHIVE" >> "$GITHUB_OUTPUT" |
201 | | - echo "checksum=${ARCHIVE}.sha256" >> "$GITHUB_OUTPUT" |
202 | | -
|
203 | | - - name: Smoke test packaged archive |
204 | | - shell: bash |
| 197 | + - name: Package and smoke test (Windows) |
| 198 | + if: runner.os == 'Windows' |
| 199 | + id: stage-windows |
| 200 | + shell: pwsh |
205 | 201 | env: |
206 | | - ARCHIVE: ${{ steps.stage.outputs.archive }} |
207 | | - CHECKSUM: ${{ steps.stage.outputs.checksum }} |
| 202 | + VERSION: ${{ needs.prepare.outputs.version }} |
| 203 | + TARGET: ${{ matrix.platform.target }} |
208 | 204 | run: | |
209 | | - set -euo pipefail |
210 | | -
|
211 | | - if command -v sha256sum >/dev/null 2>&1; then |
212 | | - sha256sum -c "$CHECKSUM" |
213 | | - else |
214 | | - shasum -a 256 -c "$CHECKSUM" |
215 | | - fi |
216 | | -
|
217 | | - EXTRACT_DIR="$(mktemp -d)" |
218 | | - trap 'rm -rf "$EXTRACT_DIR"' EXIT |
219 | | - tar -xzf "$ARCHIVE" -C "$EXTRACT_DIR" |
220 | | -
|
221 | | - shopt -s nullglob |
222 | | - BIN_CANDIDATES=("$EXTRACT_DIR"/*/bitfun-cli) |
223 | | - [[ "${#BIN_CANDIDATES[@]}" -eq 1 ]] |
224 | | - "${BIN_CANDIDATES[0]}" --version |
225 | | - "${BIN_CANDIDATES[0]}" --help > /dev/null |
| 205 | + ./scripts/cli/package-windows.ps1 -Version $env:VERSION -Target $env:TARGET |
226 | 206 |
|
227 | 207 | - name: Upload artifact |
228 | 208 | uses: actions/upload-artifact@v6 |
229 | 209 | with: |
230 | 210 | name: bitfun-cli-${{ needs.prepare.outputs.version }}-${{ needs.prepare.outputs.short_sha }}-${{ matrix.platform.name }} |
231 | 211 | if-no-files-found: error |
232 | 212 | path: | |
233 | | - ${{ steps.stage.outputs.archive }} |
234 | | - ${{ steps.stage.outputs.checksum }} |
| 213 | + ${{ steps.stage.outputs.archive || steps.stage-windows.outputs.archive }} |
| 214 | + ${{ steps.stage.outputs.checksum || steps.stage-windows.outputs.checksum }} |
0 commit comments