Fix CI workflow - auto-detect architecture
The Gitea runner uses ARM64, not x86_64. Detect architecture at runtime and download the appropriate NATS server binary. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit was merged in pull request #56.
This commit is contained in:
@@ -27,13 +27,27 @@ jobs:
|
||||
go-version: '1.23'
|
||||
- name: Install and Start NATS Server
|
||||
run: |
|
||||
# Download nats-server
|
||||
curl -L https://github.com/nats-io/nats-server/releases/download/v2.10.24/nats-server-v2.10.24-linux-amd64.tar.gz -o nats-server.tar.gz
|
||||
# Detect architecture and download appropriate binary
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
NATS_ARCH="amd64"
|
||||
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||
NATS_ARCH="arm64"
|
||||
else
|
||||
echo "Unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
fi
|
||||
echo "Detected architecture: $ARCH, using NATS binary: $NATS_ARCH"
|
||||
|
||||
# Download and extract nats-server
|
||||
curl -L "https://github.com/nats-io/nats-server/releases/download/v2.10.24/nats-server-v2.10.24-linux-${NATS_ARCH}.tar.gz" -o nats-server.tar.gz
|
||||
tar -xzf nats-server.tar.gz
|
||||
# Run directly from extracted location (no sudo needed)
|
||||
./nats-server-v2.10.24-linux-amd64/nats-server -js -p 4222 &
|
||||
|
||||
# Start NATS with JetStream
|
||||
./nats-server-v2.10.24-linux-${NATS_ARCH}/nats-server -js -p 4222 &
|
||||
|
||||
# Wait for NATS to be ready
|
||||
sleep 3
|
||||
./nats-server-v2.10.24-linux-amd64/nats-server --version
|
||||
./nats-server-v2.10.24-linux-${NATS_ARCH}/nats-server --version
|
||||
- name: Run Integration Tests
|
||||
run: go test -tags=integration -v ./...
|
||||
|
||||
Reference in New Issue
Block a user