Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ jobs:
release: ${{ matrix.msys_release }}
update: ${{ matrix.msys_update }}
cache: ${{ matrix.msys_cache }}
install: ${{ matrix.msys_pkg }}

- name: Install MSYS2 toolchain package
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
set -euo pipefail
bash ./scripts/install_msys2_package.sh "${{ matrix.msys_pkg }}"

- name: Restore benchmark cache
uses: actions/cache@v5
Expand Down Expand Up @@ -247,7 +253,13 @@ jobs:
release: ${{ matrix.msys_release }}
update: ${{ matrix.msys_update }}
cache: ${{ matrix.msys_cache }}
install: ${{ matrix.msys_pkg }}

- name: Install MSYS2 toolchain package
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
set -euo pipefail
bash ./scripts/install_msys2_package.sh "${{ matrix.msys_pkg }}"

- name: Build all packages
if: runner.os != 'Windows'
Expand Down Expand Up @@ -329,7 +341,13 @@ jobs:
release: ${{ matrix.msys_release }}
update: ${{ matrix.msys_update }}
cache: ${{ matrix.msys_cache }}
install: ${{ matrix.msys_pkg }}

- name: Install MSYS2 toolchain package
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
set -euo pipefail
bash ./scripts/install_msys2_package.sh "${{ matrix.msys_pkg }}"

- name: Build local Unix release asset
if: runner.os != 'Windows'
Expand Down
24 changes: 24 additions & 0 deletions scripts/install_msys2_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -euo pipefail

pkg="${1:?usage: install_msys2_package.sh <package>}"
attempts="${MSYS2_PACMAN_ATTEMPTS:-3}"
base_delay="${MSYS2_PACMAN_RETRY_DELAY_SECONDS:-5}"

attempt=1
while [ "$attempt" -le "$attempts" ]; do
if pacman --noconfirm -S --needed --overwrite '*' "$pkg"; then
exit 0
fi

if [ "$attempt" -eq "$attempts" ]; then
echo "pacman install failed for ${pkg} after ${attempts} attempts" >&2
exit 1
fi

echo "Retrying pacman install for ${pkg} (attempt $((attempt + 1))/${attempts})" >&2
pacman -Scc --noconfirm || true
sleep $((base_delay * attempt))
attempt=$((attempt + 1))
done
Loading