Skip to content

Commit

Permalink
ci: ensure wasm integrity
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Apr 27, 2024
1 parent 51a97af commit 5c017dd
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/llhttp-wasm-integrity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Ensure integrity of llhttp wasm files
on:
workflow_dispatch:
workflow_call:

permissions:
contents: read

jobs:
check:
name: Check files
outputs:
run_job: ${{ steps.check_files.outputs.run_job }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: check modified files
id: check_files
run: |
echo "=============== list modified files ==============="
git diff --name-only HEAD^ HEAD
echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
echo "run_job=false" > "$GITHUB_OUTPUT"
while IFS= read -r file
do
if [[ $file == deps/llhttp/* || $file == lib/llhttp/llhttp* ]]; then
echo "run_job=true" > "$GITHUB_OUTPUT"
fi
done < files.txt
llhttp-wasm:
if: needs.check.outputs.run_job == 'true'
name: Check integrity of generagted wasm-files for llhttp
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build wasm of llhttp
run: |
npm run prebuild:wasm &&
npm run build:wasm
- name: Integrity Check
run: |
git diff --quiet lib/llhttp*
if [ $? -eq 0 ]; then
echo "No changes in the generated wasm files."
else
echo "Changes detected in the generated wasm files."
echo "Please run 'npm run prebuild:wasm' and 'npm run build:wasm' locally and commit the changes."
exit 1
fi
5 changes: 5 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ jobs:
- name: Run typings tests
run: npm run test:typescript

test-llhttp-integrity:
name: Ensure integrity of llhttp wasm files
uses: uzlopak/undici/.github/workflows/llhttp-wasm-integrity.yml@llhttp-integrity

automerge:
if: >
github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'
Expand All @@ -190,6 +194,7 @@ jobs:
- test-types
- test-without-intl
- test-fuzzing
- test-llhttp-integrity
- lint
runs-on: ubuntu-latest
permissions:
Expand Down
2 changes: 2 additions & 0 deletions lib/llhttp/llhttp_simd-wasm.js

Large diffs are not rendered by default.

0 comments on commit 5c017dd

Please sign in to comment.