Skip to content

Commit cf344ec

Browse files
committed
ci: ensure wasm integrity
1 parent 51a97af commit cf344ec

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Ensure integrity of llhttp wasm files
2+
on:
3+
workflow_dispatch:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
check:
11+
name: Check files
12+
outputs:
13+
run_job: ${{ steps.check_files.outputs.run_job }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 2
20+
- name: check modified files
21+
id: check_files
22+
run: |
23+
echo "=============== list modified files ==============="
24+
git diff --name-only HEAD^ HEAD
25+
26+
echo "========== check paths of modified files =========="
27+
git diff --name-only HEAD^ HEAD > files.txt
28+
29+
echo "run_job=false" > "$GITHUB_OUTPUT"
30+
31+
while IFS= read -r file
32+
do
33+
if [[ $file == deps/llhttp/* ]]; then
34+
echo "run_job=true" > "$GITHUB_OUTPUT"
35+
fi
36+
done < files.txt
37+
38+
llhttp-wasm:
39+
if: needs.check.outputs.run_job == 'true'
40+
name: Check integrity of generagted wasm-files for llhttp
41+
needs: check
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v2
46+
- name: Build wasm of llhttp
47+
run: |
48+
npm run prebuild:wasm &&
49+
npm run build:wasm
50+
- name: Integrity Check
51+
run: |
52+
git diff --quiet lib/llhttp*
53+
if [ $? -eq 0 ]; then
54+
echo "No changes in the generated wasm files."
55+
else
56+
echo "Changes detected in the generated wasm files."
57+
echo "Please run 'npm run prebuild:wasm' and 'npm run build:wasm' locally and commit the changes."
58+
exit 1
59+
fi

.github/workflows/nodejs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ jobs:
181181
- name: Run typings tests
182182
run: npm run test:typescript
183183

184+
test-llhttp-integrity:
185+
name: Ensure integrity of llhttp wasm files
186+
uses: uzlopak/undici/.github/workflows/llhttp-wasm-integrity.yml@llhttp-integrity
187+
184188
automerge:
185189
if: >
186190
github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'
@@ -190,6 +194,7 @@ jobs:
190194
- test-types
191195
- test-without-intl
192196
- test-fuzzing
197+
- test-llhttp-integrity
193198
- lint
194199
runs-on: ubuntu-latest
195200
permissions:

0 commit comments

Comments
 (0)