diff --git a/.github/workflows/sanitizers.yaml b/.github/workflows/sanitizers.yaml index fe2f2d251..5ba8813ba 100644 --- a/.github/workflows/sanitizers.yaml +++ b/.github/workflows/sanitizers.yaml @@ -52,7 +52,7 @@ jobs: - name: Determine PHP version id: determine-php-version run: | - curl -fsSL 'https://www.php.net/releases/index.php?json&max=1&version=8.5' -o version.json + curl -fsSL 'https://www.php.net/releases/index.php?json&max=1&version=8.5' -o version.json 2>/dev/null || curl -fsSL 'https://phpmirror.static-php.dev/releases/index.php?json&max=1&version=8.5' -o version.json echo version="$(jq -r 'keys[0]' version.json)" >> "$GITHUB_OUTPUT" echo archive="$(jq -r '.[] .source[] | select(.filename |endswith(".xz")) | "https://www.php.net/distributions/" + .filename' version.json)" >> "$GITHUB_OUTPUT" - name: Cache PHP @@ -65,7 +65,8 @@ jobs: name: Compile PHP run: | mkdir php/ - curl -fsSL "${URL}" | tar -Jx -C php --strip-components=1 + MIRROR_URL=${URL/https:\/\/www.php.net/https:\/\/phpmirror.static-php.dev} + (curl -fsSL "${URL}" || curl -fsSL "${MIRROR_URL}") | tar -Jx -C php --strip-components=1 cd php/ ./configure \ CFLAGS="$CFLAGS" \ diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 44443883e..407d9fb0c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -129,7 +129,7 @@ jobs: - name: Download PHP sources run: | PHP_VERSION=$(php -r "echo PHP_VERSION;") - wget -q "https://www.php.net/distributions/php-${PHP_VERSION}.tar.gz" + wget -q "https://www.php.net/distributions/php-${PHP_VERSION}.tar.gz" || wget -q "https://phpmirror.static-php.dev/distributions/php-${PHP_VERSION}.tar.gz" tar xzf "php-${PHP_VERSION}.tar.gz" echo "GEN_STUB_SCRIPT=${PWD}/php-${PHP_VERSION}/build/gen_stub.php" >> "${GITHUB_ENV}" - name: Set CGO flags diff --git a/build-static.sh b/build-static.sh index a507e722b..429c8376e 100755 --- a/build-static.sh +++ b/build-static.sh @@ -62,7 +62,7 @@ fi if [ -z "${PHP_VERSION}" ]; then get_latest_php_version() { input="$1" - json=$(curl -s "https://www.php.net/releases/index.php?json&version=$input") + json=$(curl -fsSL "https://www.php.net/releases/index.php?json&version=$input" 2>/dev/null || curl -fsSL "https://phpmirror.static-php.dev/releases/index.php?json&version=$input") latest=$(echo "$json" | jq -r '.version') if [[ "$latest" == "$input"* ]]; then