Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,36 @@ jobs:
output.write(script if script.endswith("\n") else script + "\n")
PY

- name: Select prebuilt targets across supported runners
run: |
set -euo pipefail
target_script=("$RUNNER_TEMP"/action-scripts/*-Select-postil-target.sh)
[ "${#target_script[@]}" -eq 1 ]
fake_bin="$RUNNER_TEMP/fake-target-bin"
mkdir -p "$fake_bin"
cat >"$fake_bin/uname" <<'SH'
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' "$FIXTURE_ARCH"
SH
chmod +x "$fake_bin/uname"

run_case() {
runner_os="$1"
architecture="$2"
expected="$3"
output="$RUNNER_TEMP/target-$runner_os-$architecture.txt"
PATH="$fake_bin:$PATH" FIXTURE_ARCH="$architecture" \
RUNNER_OS="$runner_os" GITHUB_OUTPUT="$output" \
bash "${target_script[0]}"
grep -Fx "target=$expected" "$output"
}

run_case Linux x86_64 x86_64-unknown-linux-gnu
run_case Linux arm64 aarch64-unknown-linux-gnu
run_case macOS x86_64 x86_64-apple-darwin
run_case macOS arm64 aarch64-apple-darwin

- name: Reject invalid provider input without exposing credentials
run: |
set -euo pipefail
Expand Down Expand Up @@ -630,6 +660,10 @@ jobs:
runner: ubuntu-24.04-arm
- target: aarch64-unknown-linux-musl
runner: ubuntu-24.04-arm
- target: x86_64-apple-darwin
runner: macos-15-intel
- target: aarch64-apple-darwin
runner: macos-15
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
Expand All @@ -655,7 +689,11 @@ jobs:
curl -fsSL --retry 3 --retry-connrefused --retry-delay 2 -o "$DEST/postil.tar.gz.pem" "$base/postil-$TARGET.tar.gz.pem"

expected=$(awk '{print $1}' "$DEST/postil.tar.gz.sha256")
actual=$(sha256sum "$DEST/postil.tar.gz" | awk '{print $1}')
if command -v sha256sum >/dev/null 2>&1; then
actual=$(sha256sum "$DEST/postil.tar.gz" | awk '{print $1}')
else
actual=$(shasum -a 256 "$DEST/postil.tar.gz" | awk '{print $1}')
fi
[ "$expected" = "$actual" ]

cosign verify-blob \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Set the `POSTIL_REVIEW_MODEL` repository variable to a model qualified for your
| --- | --- | --- |
| `cli-ref` | yes | Full 40-character `postil-cli` commit SHA |
| `api-key` | yes | Model provider credential |
| `cli-release` | no | Matching signed release tag for a prebuilt Linux binary |
| `cli-release` | no | Matching signed release tag for a prebuilt Linux or macOS binary |
| `api-base` | no | Model endpoint, defaulting to the CLI provider endpoint |
| `api-format` | no | `openai-compatible` or `anthropic` |
| `endpoint-auth-header`, `endpoint-auth-value` | no | Paired additional private-gateway authentication |
Expand Down
13 changes: 10 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ runs:
x86_64) target="x86_64-unknown-linux-$libc" ;;
aarch64|arm64) target="aarch64-unknown-linux-$libc" ;;
esac
elif [ "$RUNNER_OS" = "macOS" ]; then
case "$(uname -m)" in
x86_64) target="x86_64-apple-darwin" ;;
arm64) target="aarch64-apple-darwin" ;;
esac
fi

if [ -n "$target" ]; then
Expand Down Expand Up @@ -205,8 +210,6 @@ runs:
rm -f "$auth_cfg"
trap - EXIT
if [ "$tag_sha" = "$CLI_REF" ]; then
# Prebuilt artifacts are Linux-only here; other runners fall back
# to the source build rather than fetching a binary that cannot run.
target="$POSTIL_TARGET"
if [ -n "$target" ]; then
base="https://github.com/postil-dev/postil-cli/releases/download/$CLI_RELEASE"
Expand All @@ -215,7 +218,11 @@ runs:
&& curl -fsSL --retry 3 --retry-connrefused --retry-delay 2 -o "$DEST/postil.tar.gz.sig" "$base/postil-$target.tar.gz.sig" \
&& curl -fsSL --retry 3 --retry-connrefused --retry-delay 2 -o "$DEST/postil.tar.gz.pem" "$base/postil-$target.tar.gz.pem"; then
expected=$(awk '{print $1}' "$DEST/postil.tar.gz.sha256")
actual=$(sha256sum "$DEST/postil.tar.gz" | awk '{print $1}')
if command -v sha256sum >/dev/null 2>&1; then
actual=$(sha256sum "$DEST/postil.tar.gz" | awk '{print $1}')
else
actual=$(shasum -a 256 "$DEST/postil.tar.gz" | awk '{print $1}')
fi
# Checksum guards against transit corruption; the checksum file
# sits next to the artifact on the same release, so it alone
# cannot prove the release wasn't tampered with. The Sigstore
Expand Down
Loading