Skip to content

Commit ee06e6f

Browse files
committed
Address PR #2 review comments (round 3)
- Make token input required (expression defaults don't evaluate in action metadata) - Use RUNNER_OS/RUNNER_ARCH to match release asset naming convention - Add cleanup step (if: always) to kill backgrounded spiceio process
1 parent 953fedb commit ee06e6f

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ inputs:
3939
required: false
4040
default: "127.0.0.1:8333"
4141
token:
42-
description: GitHub token for downloading release assets
43-
required: false
44-
default: ${{ github.token }}
42+
description: GitHub token for downloading release assets from private repos
43+
required: true
4544

4645
outputs:
4746
endpoint:
@@ -65,6 +64,7 @@ runs:
6564
6665
REPO="spiceai/spiceio"
6766
INSTALL_DIR="${RUNNER_TEMP:-/tmp}/spiceio-bin"
67+
PID_FILE="${RUNNER_TEMP:-/tmp}/spiceio.pid"
6868
mkdir -p "$INSTALL_DIR"
6969
7070
if [[ "$VERSION" == "latest" ]]; then
@@ -73,13 +73,9 @@ runs:
7373
TAG="$VERSION"
7474
fi
7575
76-
OS=$(uname -s)
77-
ARCH=$(uname -m)
78-
# Map to GitHub runner naming
79-
case "$ARCH" in
80-
arm64|aarch64) ARCH="ARM64" ;;
81-
x86_64) ARCH="X64" ;;
82-
esac
76+
# Asset names use runner.os / runner.arch convention from the release workflow
77+
OS="${RUNNER_OS:-$(uname -s)}"
78+
ARCH="${RUNNER_ARCH:-$(uname -m)}"
8379
8480
ASSET="spiceio-${OS}-${ARCH}.tar.gz"
8581
echo "Downloading $ASSET from $REPO@$TAG"
@@ -90,6 +86,7 @@ runs:
9086
9187
echo "$INSTALL_DIR" >> "$GITHUB_PATH"
9288
echo "bin=$INSTALL_DIR/spiceio" >> "$GITHUB_OUTPUT"
89+
echo "pid_file=$PID_FILE" >> "$GITHUB_OUTPUT"
9390
9491
- name: Start spiceio
9592
id: start
@@ -108,9 +105,11 @@ runs:
108105
set -euo pipefail
109106
110107
ENDPOINT="http://${SPICEIO_BIND}"
108+
PID_FILE="${{ steps.download.outputs.pid_file }}"
111109
112110
spiceio &
113111
PID=$!
112+
echo "$PID" > "$PID_FILE"
114113
echo "pid=$PID" >> "$GITHUB_OUTPUT"
115114
echo "endpoint=$ENDPOINT" >> "$GITHUB_OUTPUT"
116115
@@ -129,3 +128,18 @@ runs:
129128
done
130129
echo "::error::spiceio failed to start within 30s"
131130
exit 1
131+
132+
- name: Register cleanup
133+
if: always()
134+
shell: bash
135+
run: |
136+
PID_FILE="${{ steps.download.outputs.pid_file }}"
137+
if [[ -f "$PID_FILE" ]]; then
138+
PID=$(cat "$PID_FILE")
139+
if kill -0 "$PID" 2>/dev/null; then
140+
echo "Stopping spiceio (PID $PID)"
141+
kill "$PID" 2>/dev/null || true
142+
wait "$PID" 2>/dev/null || true
143+
fi
144+
rm -f "$PID_FILE"
145+
fi

0 commit comments

Comments
 (0)