Skip to content

Commit 4210419

Browse files
author
Datanoise
committed
CI: Refactor startup test to separate job with dynamic architecture detection
1 parent 3b8b649 commit 4210419

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o dist/tinyice-${{ matrix.goos }}-${{ matrix.goarch }}${EXT} main.go
4040
4141
42-
4342
- name: Upload artifacts
4443
uses: actions/upload-artifact@v4
4544
with:
@@ -54,20 +53,32 @@ jobs:
5453
- name: Checkout code
5554
uses: actions/checkout@v4
5655

57-
- name: Download Linux AMD64 artifact
56+
- name: Determine Runner Architecture
57+
id: arch_detect
58+
run: |
59+
RUNNER_ARCH=$(uname -m)
60+
case "$RUNNER_ARCH" in
61+
x86_64) GOARCH="amd64" ;;
62+
aarch64) GOARCH="arm64" ;;
63+
arm64) GOARCH="arm64" ;;
64+
*) echo "Unsupported runner architecture: $RUNNER_ARCH"; exit 1 ;;
65+
esac
66+
echo "GOARCH=$GOARCH" >> "$GITHUB_OUTPUT"
67+
68+
- name: Download Linux Artifact for Runner Arch
5869
uses: actions/download-artifact@v4
5970
with:
60-
name: tinyice-linux-amd64
71+
name: tinyice-linux-${{ steps.arch_detect.outputs.GOARCH }}
6172
path: artifacts_to_test
6273

6374
- name: Run TinyIce startup test
6475
run: |
65-
# The downloaded artifact will be in a subdirectory named after the artifact, e.g., artifacts_to_test/tinyice-linux-amd64/tinyice-linux-amd64
66-
BINARY_PATH="artifacts_to_test/tinyice-linux-amd64/tinyice-linux-amd64"
76+
GOARCH="${{ steps.arch_detect.outputs.GOARCH }}"
77+
BINARY_PATH="artifacts_to_test/tinyice-linux-${GOARCH}/tinyice-linux-${GOARCH}"
6778
6879
echo "Starting TinyIce in background for 5 seconds to check for startup errors..."
6980
# Use a non-default port and tmp config to avoid conflicts
70-
timeout 5s sh -c "$BINARY_PATH -port 8080 -config /tmp/tinyice-test-linux-amd64.json" &
81+
timeout 5s sh -c "$BINARY_PATH -port 8080 -config /tmp/tinyice-test-linux-${GOARCH}.json" &
7182
PID=$!
7283
7384
# Wait for the process to finish for up to 6 seconds (slightly more than timeout)
@@ -117,4 +128,4 @@ jobs:
117128
artifacts/**/tinyice*
118129
checksums.txt
119130
env:
120-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)