Skip to content

Commit 864c4bb

Browse files
committed
Add arm64 testing in GitHub Actions workflow.
1 parent d62b7ec commit 864c4bb

1 file changed

Lines changed: 73 additions & 2 deletions

File tree

.github/workflows/build-test-image.yml

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ env:
2020
IMAGE_NAME: ${{ github.repository }}
2121

2222
jobs:
23-
build:
23+
build-push-test:
2424
runs-on: ubuntu-latest
2525
environment: testing
2626
permissions:
@@ -76,7 +76,7 @@ jobs:
7676
CF_ACCESS_CLIENT_ID: "op://x4h33jlflygxmifnxfrizew4oa/7g2fhcv3tpsogr2vhkielewvsm/wsyxxjrdsyj36zsaanbh3kybfe"
7777
CF_ACCESS_CLIENT_SECRET: "op://x4h33jlflygxmifnxfrizew4oa/7g2fhcv3tpsogr2vhkielewvsm/5x3sr7bry5a3ealsemvx5vcbuy"
7878

79-
- name: Run test matrix in container
79+
- name: Run test matrix in container (linux/amd64)
8080
env:
8181
IMAGE_REF: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
8282
CF_ACCESS_CLIENT_ID: ${{ steps.op-load-secrets.outputs.CF_ACCESS_CLIENT_ID }}
@@ -102,6 +102,7 @@ jobs:
102102
echo "--- Test: $test_name ---"
103103
echo "Description: $test_desc"
104104
echo "Expected exit: $expected_exit"
105+
echo "Platform: linux/amd64"
105106
106107
docker_cmd=(docker run --rm --pull always --platform linux/amd64)
107108
@@ -144,3 +145,73 @@ jobs:
144145
if [ $failed_tests -gt 0 ]; then
145146
exit 1
146147
fi
148+
149+
- name: Run test matrix in container (linux/arm64)
150+
env:
151+
IMAGE_REF: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
152+
CF_ACCESS_CLIENT_ID: ${{ steps.op-load-secrets.outputs.CF_ACCESS_CLIENT_ID }}
153+
CF_ACCESS_CLIENT_SECRET: ${{ steps.op-load-secrets.outputs.CF_ACCESS_CLIENT_SECRET }}
154+
run: |
155+
set +e
156+
total_tests=0
157+
passed_tests=0
158+
failed_tests=0
159+
160+
while IFS= read -r test_case; do
161+
total_tests=$((total_tests + 1))
162+
163+
test_name=$(echo "$test_case" | jq -r '.name')
164+
test_desc=$(echo "$test_case" | jq -r '.description')
165+
test_args=$(echo "$test_case" | jq -r '.args')
166+
test_url=$(echo "$test_case" | jq -r '.url')
167+
expected_exit=$(echo "$test_case" | jq -r '.expect_exit')
168+
skip_url=$(echo "$test_case" | jq -r '.skip_url')
169+
skip_creds=$(echo "$test_case" | jq -r '.skip_creds // false')
170+
171+
echo ""
172+
echo "--- Test: $test_name ---"
173+
echo "Description: $test_desc"
174+
echo "Expected exit: $expected_exit"
175+
echo "Platform: linux/arm64"
176+
177+
docker_cmd=(docker run --rm --pull always --platform linux/arm64)
178+
179+
if [ "$skip_creds" != "true" ]; then
180+
docker_cmd+=(
181+
-e "CF_ACCESS_CLIENT_ID=$CF_ACCESS_CLIENT_ID"
182+
-e "CF_ACCESS_CLIENT_SECRET=$CF_ACCESS_CLIENT_SECRET"
183+
)
184+
fi
185+
186+
docker_cmd+=("$IMAGE_REF" bash -lc)
187+
188+
if [ "$skip_url" = "true" ]; then
189+
test_command="r2-downloader $test_args"
190+
else
191+
test_command="r2-downloader $test_args $test_url"
192+
fi
193+
194+
echo "Running: docker run --rm ... bash -lc \"$test_command\""
195+
196+
"${docker_cmd[@]}" "$test_command"
197+
actual_exit=$?
198+
199+
if [ $actual_exit -eq $expected_exit ]; then
200+
echo "✅ [PASS] $test_name"
201+
passed_tests=$((passed_tests + 1))
202+
else
203+
echo "❌ [FAIL] $test_name - expected $expected_exit, got $actual_exit"
204+
failed_tests=$((failed_tests + 1))
205+
fi
206+
207+
done < <(jq -c '.include[]' .github/workflows/test-matrix.json)
208+
209+
echo ""
210+
echo "=== Container Test Summary (arm64) ==="
211+
echo "Total: $total_tests"
212+
echo "Passed: $passed_tests"
213+
echo "Failed: $failed_tests"
214+
215+
if [ $failed_tests -gt 0 ]; then
216+
exit 1
217+
fi

0 commit comments

Comments
 (0)