Skip to content

Commit 3ff7d08

Browse files
fix: make more robust and expands CI coverage for new macOS and toolchain versions (#29)
* fix: update fetch_all_assets to use curl options for improved flexibility * fix: replace deprecated macos-13 runner with macos-latest in CI (#30) * chore: Update version list in build.yml * fix: update macOS support in CI and improve architecture handling in utils.bash * fix: enhance fetch_all_assets function with retry logic and improved error handling * fix: update plugin installation path to use GITHUB_WORKSPACE for consistency --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
1 parent 4f773bb commit 3ff7d08

2 files changed

Lines changed: 43 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [ubuntu-latest, macos-13]
17+
os: [ubuntu-latest, macos-latest, macos-15-intel]
1818
tool:
1919
- plugin: clang-format
2020
command: clang-format --version
@@ -24,15 +24,17 @@ jobs:
2424
command: clang-tidy --version
2525
- plugin: clang-apply-replacements
2626
command: clang-apply-replacements --version
27-
version: ["9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21"]
27+
version: ["11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22"]
2828

2929
steps:
30+
- uses: actions/checkout@v5
31+
3032
- name: Install asdf
3133
uses: asdf-vm/actions/setup@v4
3234

3335
- name: Add plugin ${{ matrix.tool.plugin }}
3436
run: |
35-
asdf plugin add ${{ matrix.tool.plugin }} https://github.com/cpp-linter/asdf-clang-tools.git
37+
asdf plugin add ${{ matrix.tool.plugin }} "$GITHUB_WORKSPACE"
3638
3739
- name: Install and test ${{ matrix.tool.plugin }} ${{ matrix.version }} on ${{ matrix.os }}
3840
run: |

lib/utils.bash

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,34 @@ sort_versions() {
4646
}
4747

4848
fetch_all_assets() {
49-
curl -s -H "Accept: application/vnd.github.v3+json" \
50-
https://api.github.com/repos/${GH_REPO}/releases |
51-
jq -r '.[0].assets[] | "\(.name) \(.browser_download_url)"'
49+
# Build API-specific curl options without -f so we can read the error body
50+
local api_curl_opts=(-sSL)
51+
if [ -n "${GITHUB_TOKEN:-}" ]; then
52+
api_curl_opts+=(-H "Authorization: token $GITHUB_TOKEN")
53+
fi
54+
55+
local response attempt
56+
for attempt in 1 2 3; do
57+
response=$(curl "${api_curl_opts[@]}" \
58+
-H "Accept: application/vnd.github.v3+json" \
59+
"https://api.github.com/repos/${GH_REPO}/releases")
60+
61+
if echo "$response" | jq -e 'type == "array"' >/dev/null 2>&1; then
62+
echo "$response" | jq -r '.[0].assets[] | "\(.name) \(.browser_download_url)"'
63+
return 0
64+
fi
65+
66+
local msg
67+
msg=$(echo "$response" | jq -r '.message // "unexpected response"' 2>/dev/null || echo "invalid JSON")
68+
log "GitHub API error (attempt $attempt/3): $msg"
69+
70+
if [ "$attempt" -lt 3 ]; then
71+
log "Retrying in $((attempt * 15))s..."
72+
sleep "$((attempt * 15))"
73+
fi
74+
done
75+
76+
fail "GitHub API error after 3 attempts: $msg"
5277
}
5378

5479
validate_platform() {
@@ -62,8 +87,16 @@ validate_platform() {
6287

6388
case $kernel in
6489
Darwin)
65-
USE_KERNEL=macosx
66-
USE_ARCH=amd64
90+
case $arch in
91+
arm64)
92+
USE_KERNEL=macosx
93+
USE_ARCH=arm64
94+
;;
95+
x86_64)
96+
USE_KERNEL=macos-intel
97+
USE_ARCH=amd64
98+
;;
99+
esac
67100
;;
68101
Linux)
69102
USE_KERNEL=linux

0 commit comments

Comments
 (0)