Skip to content

Commit 60c6136

Browse files
committed
Resolve release checksums during CI bootstrap
1 parent b7b3d5e commit 60c6136

2 files changed

Lines changed: 67 additions & 9 deletions

File tree

.github/workflows/prebuilt-refresh.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,39 @@ jobs:
9393
ccache --zero-stats
9494
ccache --show-stats
9595
96+
- name: Resolve DXC prebuilt checksum
97+
shell: bash
98+
run: |
99+
set -euo pipefail
100+
dxc_sha="$(curl -L --fail "${DXC_WASM_PREBUILT_URL}.sha256" | awk 'NR==1 {print $1}')"
101+
if [ -z "${dxc_sha}" ]; then
102+
echo "Failed to resolve DXC prebuilt checksum from release sidecar file."
103+
exit 1
104+
fi
105+
echo "DXC_WASM_PREBUILT_SHA256=${dxc_sha}" >> "${GITHUB_ENV}"
106+
96107
- name: Bootstrap DXC Wasm prebuilt
97108
shell: bash
98109
run: |
99110
set -euo pipefail
100111
dxc_dir="${GITHUB_WORKSPACE}/.3rdparty/dxc-wasm"
101112
dxc_js="${dxc_dir}/dxc.js"
102113
dxc_wasm="${dxc_dir}/dxc.wasm"
114+
dxc_sha_stamp="${dxc_dir}/.sha256"
115+
download_dxc=0
103116
if [ ! -f "${dxc_js}" ] || [ ! -f "${dxc_wasm}" ]; then
117+
download_dxc=1
118+
elif [ ! -f "${dxc_sha_stamp}" ] || [ "$(cat "${dxc_sha_stamp}")" != "${DXC_WASM_PREBUILT_SHA256}" ]; then
119+
download_dxc=1
120+
fi
121+
if [ "${download_dxc}" -eq 1 ]; then
104122
mkdir -p "${dxc_dir}"
123+
rm -f "${dxc_js}" "${dxc_wasm}" "${dxc_sha_stamp}"
105124
curl -L --fail "${DXC_WASM_PREBUILT_URL}" -o "${RUNNER_TEMP}/dxc-wasm-prebuilt.zip"
106-
if [ -n "${DXC_WASM_PREBUILT_SHA256}" ]; then
107-
echo "${DXC_WASM_PREBUILT_SHA256} ${RUNNER_TEMP}/dxc-wasm-prebuilt.zip" | sha256sum -c -
108-
fi
125+
echo "${DXC_WASM_PREBUILT_SHA256} ${RUNNER_TEMP}/dxc-wasm-prebuilt.zip" | sha256sum -c -
109126
python3 -c "import sys,zipfile; zipfile.ZipFile(sys.argv[1]).extractall(sys.argv[2])" \
110127
"${RUNNER_TEMP}/dxc-wasm-prebuilt.zip" "${dxc_dir}"
128+
printf '%s' "${DXC_WASM_PREBUILT_SHA256}" > "${dxc_sha_stamp}"
111129
fi
112130
test -f "${dxc_js}"
113131
test -f "${dxc_wasm}"

.github/workflows/smoke.yml

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ jobs:
4646
python3 -m pip install meson mako
4747
python3 -m pip install cmake==4.2.0
4848
49+
- name: Resolve prebuilt bundle checksums
50+
shell: bash
51+
run: |
52+
set -euo pipefail
53+
llvm_sha="$(curl -L --fail "${LLVM_PREBUILT_URL}.sha256" | awk 'NR==1 {print $1}')"
54+
dxc_sha="$(curl -L --fail "${DXC_WASM_PREBUILT_URL}.sha256" | awk 'NR==1 {print $1}')"
55+
if [ -z "${llvm_sha}" ] || [ -z "${dxc_sha}" ]; then
56+
echo "Failed to resolve prebuilt checksums from release sidecar files."
57+
exit 1
58+
fi
59+
echo "LLVM_PREBUILT_SHA256=${llvm_sha}" >> "${GITHUB_ENV}"
60+
echo "DXC_WASM_PREBUILT_SHA256=${dxc_sha}" >> "${GITHUB_ENV}"
61+
4962
- name: Restore third-party cache
5063
id: cache_thirdparty
5164
uses: actions/cache/restore@v4
@@ -74,14 +87,21 @@ jobs:
7487
dxc_dir="${GITHUB_WORKSPACE}/.3rdparty/dxc-wasm"
7588
dxc_js="${dxc_dir}/dxc.js"
7689
dxc_wasm="${dxc_dir}/dxc.wasm"
90+
dxc_sha_stamp="${dxc_dir}/.sha256"
91+
download_dxc=0
7792
if [ ! -f "${dxc_js}" ] || [ ! -f "${dxc_wasm}" ]; then
93+
download_dxc=1
94+
elif [ ! -f "${dxc_sha_stamp}" ] || [ "$(cat "${dxc_sha_stamp}")" != "${DXC_WASM_PREBUILT_SHA256}" ]; then
95+
download_dxc=1
96+
fi
97+
if [ "${download_dxc}" -eq 1 ]; then
7898
mkdir -p "${dxc_dir}"
99+
rm -f "${dxc_js}" "${dxc_wasm}" "${dxc_sha_stamp}"
79100
curl -L --fail "${DXC_WASM_PREBUILT_URL}" -o "${RUNNER_TEMP}/dxc-wasm-prebuilt.zip"
80-
if [ -n "${DXC_WASM_PREBUILT_SHA256}" ]; then
81-
echo "${DXC_WASM_PREBUILT_SHA256} ${RUNNER_TEMP}/dxc-wasm-prebuilt.zip" | sha256sum -c -
82-
fi
101+
echo "${DXC_WASM_PREBUILT_SHA256} ${RUNNER_TEMP}/dxc-wasm-prebuilt.zip" | sha256sum -c -
83102
python3 -c "import sys,zipfile; zipfile.ZipFile(sys.argv[1]).extractall(sys.argv[2])" \
84103
"${RUNNER_TEMP}/dxc-wasm-prebuilt.zip" "${dxc_dir}"
104+
printf '%s' "${DXC_WASM_PREBUILT_SHA256}" > "${dxc_sha_stamp}"
85105
fi
86106
test -f "${dxc_js}"
87107
test -f "${dxc_wasm}"
@@ -158,6 +178,19 @@ jobs:
158178
python3 -m pip install --upgrade pip
159179
python3 -m pip install cmake==4.2.0
160180
181+
- name: Resolve prebuilt bundle checksums
182+
shell: bash
183+
run: |
184+
set -euo pipefail
185+
llvm_sha="$(curl -L --fail "${LLVM_PREBUILT_URL}.sha256" | awk 'NR==1 {print $1}')"
186+
dxc_sha="$(curl -L --fail "${DXC_WASM_PREBUILT_URL}.sha256" | awk 'NR==1 {print $1}')"
187+
if [ -z "${llvm_sha}" ] || [ -z "${dxc_sha}" ]; then
188+
echo "Failed to resolve prebuilt checksums from release sidecar files."
189+
exit 1
190+
fi
191+
echo "LLVM_PREBUILT_SHA256=${llvm_sha}" >> "${GITHUB_ENV}"
192+
echo "DXC_WASM_PREBUILT_SHA256=${dxc_sha}" >> "${GITHUB_ENV}"
193+
161194
- name: Restore third-party cache
162195
id: cache_thirdparty
163196
uses: actions/cache/restore@v4
@@ -189,14 +222,21 @@ jobs:
189222
dxc_dir="${GITHUB_WORKSPACE}/.3rdparty/dxc-wasm"
190223
dxc_js="${dxc_dir}/dxc.js"
191224
dxc_wasm="${dxc_dir}/dxc.wasm"
225+
dxc_sha_stamp="${dxc_dir}/.sha256"
226+
download_dxc=0
192227
if [ ! -f "${dxc_js}" ] || [ ! -f "${dxc_wasm}" ]; then
228+
download_dxc=1
229+
elif [ ! -f "${dxc_sha_stamp}" ] || [ "$(cat "${dxc_sha_stamp}")" != "${DXC_WASM_PREBUILT_SHA256}" ]; then
230+
download_dxc=1
231+
fi
232+
if [ "${download_dxc}" -eq 1 ]; then
193233
mkdir -p "${dxc_dir}"
234+
rm -f "${dxc_js}" "${dxc_wasm}" "${dxc_sha_stamp}"
194235
curl -L --fail "${DXC_WASM_PREBUILT_URL}" -o "${RUNNER_TEMP}/dxc-wasm-prebuilt.zip"
195-
if [ -n "${DXC_WASM_PREBUILT_SHA256}" ]; then
196-
echo "${DXC_WASM_PREBUILT_SHA256} ${RUNNER_TEMP}/dxc-wasm-prebuilt.zip" | sha256sum -c -
197-
fi
236+
echo "${DXC_WASM_PREBUILT_SHA256} ${RUNNER_TEMP}/dxc-wasm-prebuilt.zip" | sha256sum -c -
198237
python3 -c "import sys,zipfile; zipfile.ZipFile(sys.argv[1]).extractall(sys.argv[2])" \
199238
"${RUNNER_TEMP}/dxc-wasm-prebuilt.zip" "${dxc_dir}"
239+
printf '%s' "${DXC_WASM_PREBUILT_SHA256}" > "${dxc_sha_stamp}"
200240
fi
201241
test -f "${dxc_js}"
202242
test -f "${dxc_wasm}"

0 commit comments

Comments
 (0)