Skip to content

Commit 35051a8

Browse files
committed
ci: harden CLI release packaging
1 parent 7783458 commit 35051a8

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

.github/workflows/release-cli.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ jobs:
105105
swift --version
106106
107107
- name: Build CodexBarCLI (release)
108+
id: build
108109
shell: bash
109110
run: |
110111
set -euo pipefail
@@ -118,11 +119,6 @@ jobs:
118119
fi
119120
"${BUILD_ARGS[@]}"
120121
121-
- name: Smoke test CodexBarCLI
122-
shell: bash
123-
run: |
124-
set -euo pipefail
125-
126122
SHOW_BIN_ARGS=(swift build -c release --product CodexBarCLI --show-bin-path)
127123
if [[ -n "${{ matrix.build-arch }}" ]]; then
128124
SHOW_BIN_ARGS+=(--arch "${{ matrix.build-arch }}")
@@ -131,11 +127,25 @@ jobs:
131127
SHOW_BIN_ARGS+=(--static-swift-stdlib)
132128
fi
133129
134-
BIN_DIR="$("${SHOW_BIN_ARGS[@]}")"
130+
echo "bin_dir=$("${SHOW_BIN_ARGS[@]}")" >> "$GITHUB_OUTPUT"
131+
132+
- name: Smoke test CodexBarCLI
133+
timeout-minutes: 5
134+
shell: bash
135+
run: |
136+
set -euo pipefail
137+
138+
BIN_DIR="${{ steps.build.outputs.bin_dir }}"
135139
BIN="$BIN_DIR/CodexBarCLI"
136-
"$BIN" --help >/dev/null
137-
"$BIN" --version >/dev/null
138-
file "$BIN" | grep -q "${{ matrix.asset-arch }}"
140+
echo "BIN=$BIN"
141+
"$BIN" --help
142+
"$BIN" --version
143+
file "$BIN"
144+
if [[ "${{ matrix.platform }}" == "macos" ]]; then
145+
lipo -archs "$BIN" | tr ' ' '\n' | grep -Fx "${{ matrix.asset-arch }}"
146+
else
147+
file "$BIN" | grep -q "${{ matrix.asset-arch }}"
148+
fi
139149
140150
- name: Package
141151
id: pkg
@@ -150,15 +160,7 @@ jobs:
150160
fi
151161
SAFE_REF_NAME="${REF_NAME//\//-}"
152162
153-
SHOW_BIN_ARGS=(swift build -c release --product CodexBarCLI --show-bin-path)
154-
if [[ -n "${{ matrix.build-arch }}" ]]; then
155-
SHOW_BIN_ARGS+=(--arch "${{ matrix.build-arch }}")
156-
fi
157-
if [[ "${{ matrix.static-swift-stdlib }}" == "true" ]]; then
158-
SHOW_BIN_ARGS+=(--static-swift-stdlib)
159-
fi
160-
161-
BIN_DIR="$("${SHOW_BIN_ARGS[@]}")"
163+
BIN_DIR="${{ steps.build.outputs.bin_dir }}"
162164
OUT_DIR="$(mktemp -d)"
163165
install -m 0755 "$BIN_DIR/CodexBarCLI" "$OUT_DIR/CodexBarCLI"
164166
ln -s "CodexBarCLI" "$OUT_DIR/codexbar"

0 commit comments

Comments
 (0)