Meta: Retry required-file downloads and cache the WASM spec tests

Problem: CI intermittently fails when a required-file download hiccups;
e.g., the WASM spec test suite fetch failed on both its primary URL and
the Web Archive fallback on the same run — breaking configure under CI.

Cause: download_file_multisource was trying each source only once — so a
single transient HTTP error could break the whole build. The WASM spec
test tarball was also being fetched fresh every run — rather than from
the shared download cache — so each build was exposed to that flakiness.

Fix: Retry each fetch a few times across all sources — for every config-
time download: the WASM spec tests, HSTS preload list, and public-suffix
list. Cache the WASM spec test tarball across CI runs — keyed by commit,
so it’s (re)fetched only once per commit bump.
This commit is contained in:
sideshowbarker 2026-06-07 06:58:08 +09:00 committed by Andreas Kling
parent 61d0fca133
commit e97de4fc84
3 changed files with 27 additions and 9 deletions

View file

@ -117,6 +117,13 @@ jobs:
ccache_path: ${{ steps.setup.outputs.ccache_path }}
vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}
- name: Cache the WebAssembly spec test suite
if: ${{ inputs.os_name != 'Windows' }}
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/caches/WasmSpecTests
key: wasm-spec-test-suite | ${{ hashFiles('Meta/CMake/wasm_spec_tests.cmake') }}
- name: Set dynamic environment variables
if: ${{ inputs.os_name != 'Windows' }}
run: |

View file

@ -173,20 +173,31 @@ function(download_file_multisource urls path)
get_filename_component(file "${path}" NAME)
set(tmp_path "${path}.tmp")
foreach(url ${urls})
message(STATUS "Downloading file ${file} from ${url}")
set(download_attempts 3)
foreach(attempt RANGE 1 ${download_attempts})
foreach(url ${urls})
message(STATUS "Downloading file ${file} from ${url} (attempt ${attempt}/${download_attempts})")
file(DOWNLOAD "${url}" "${tmp_path}" INACTIVITY_TIMEOUT 10 STATUS download_result ${DOWNLOAD_SHA256})
list(GET download_result 0 status_code)
list(GET download_result 1 error_message)
file(DOWNLOAD "${url}" "${tmp_path}" INACTIVITY_TIMEOUT 10 STATUS download_result ${DOWNLOAD_SHA256})
list(GET download_result 0 status_code)
list(GET download_result 1 error_message)
if (status_code EQUAL 0)
file(RENAME "${tmp_path}" "${path}")
break()
endif()
file(REMOVE "${tmp_path}")
message(WARNING "Failed to download ${url} (attempt ${attempt}/${download_attempts}): ${error_message}")
endforeach()
if (status_code EQUAL 0)
file(RENAME "${tmp_path}" "${path}")
break()
endif()
file(REMOVE "${tmp_path}")
message(WARNING "Failed to download ${url}: ${error_message}")
if (attempt LESS ${download_attempts})
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 2)
endif()
endforeach()
if (NOT status_code EQUAL 0)

View file

@ -5,7 +5,7 @@
if(INCLUDE_WASM_SPEC_TESTS)
set(WASM_SPEC_TEST_COMMIT 4b24564c844e3d34bf46dfcb3c774ee5163e31cc) # 2025-09-10
set(WASM_SPEC_TEST_GZ_URL https://github.com/WebAssembly/testsuite/archive/${WASM_SPEC_TEST_COMMIT}.tar.gz)
set(WASM_SPEC_TEST_GZ_PATH ${CMAKE_BINARY_DIR}/wasm-spec-testsuite.tar.gz CACHE PATH "")
set(WASM_SPEC_TEST_GZ_PATH ${LADYBIRD_CACHE_DIR}/WasmSpecTests/wasm-spec-testsuite-${WASM_SPEC_TEST_COMMIT}.tar.gz CACHE PATH "")
set(WASM_SPEC_TEST_PATH ${CMAKE_CURRENT_BINARY_DIR}/Tests/Fixtures/SpecTests CACHE PATH "")
download_file(${WASM_SPEC_TEST_GZ_URL} ${WASM_SPEC_TEST_GZ_PATH})