1212 runs-on : ubuntu-latest
1313 steps :
1414 - name : Checkout code
15- uses : actions/checkout@v4
15+ uses : actions/checkout@v5
1616
1717 - name : Setup Zig
1818 uses : mlugg/setup-zig@v2
@@ -127,7 +127,7 @@ jobs:
127127 shell : bash
128128 steps :
129129 - name : Checkout code
130- uses : actions/checkout@v4
130+ uses : actions/checkout@v5
131131
132132 - name : Setup Zig
133133 uses : mlugg/setup-zig@v2
@@ -175,7 +175,7 @@ jobs:
175175 shell : bash
176176 steps :
177177 - name : Checkout code
178- uses : actions/checkout@v4
178+ uses : actions/checkout@v5
179179
180180 - name : Setup Zig
181181 uses : mlugg/setup-zig@v2
@@ -203,7 +203,7 @@ jobs:
203203 runs-on : ubuntu-latest
204204 steps :
205205 - name : Checkout code
206- uses : actions/checkout@v4
206+ uses : actions/checkout@v5
207207
208208 - name : Download x86_64-linux artifact
209209 uses : actions/download-artifact@v4
@@ -238,7 +238,7 @@ jobs:
238238 image : mcr.microsoft.com/playwright:v1.56.0-noble
239239 steps :
240240 - name : Checkout code
241- uses : actions/checkout@v4
241+ uses : actions/checkout@v5
242242
243243 - name : Download x86_64-linux artifact
244244 uses : actions/download-artifact@v4
@@ -274,12 +274,63 @@ jobs:
274274 path : npm_packages/playwright-odiff/test-results
275275 retention-days : 7
276276
277+ valgrind :
278+ name : Valgrind Memory Check
279+ runs-on : ubuntu-latest
280+ steps :
281+ - name : Checkout code
282+ uses : actions/checkout@v5
283+
284+ - name : Setup Zig
285+ uses : mlugg/setup-zig@v2
286+ with :
287+ version : 0.15.2
288+
289+ - name : Install nasm and valgrind
290+ run : |
291+ sudo apt-get update
292+ sudo apt-get install -y nasm valgrind
293+
294+ - name : Build with debug symbols
295+ run : |
296+ zig build -Doptimize=Debug
297+
298+ - name : Run valgrind memcheck - normal mode with diff output
299+ run : |
300+ set +e
301+ valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=99 --errors-for-leak-kinds=definite,possible \
302+ --suppressions=.valgrind.supp \
303+ ./zig-out/bin/odiff test/png/orange.png test/png/orange_changed.png /tmp/diff-output.png 2>&1 | grep -vE "(DWARF2 reader: Badly formed|Can't handle line info entry)"
304+ EXIT_CODE=$?
305+ if [ $EXIT_CODE -eq 99 ]; then
306+ echo "ERROR: Valgrind detected memory errors!"
307+ exit 1
308+ else
309+ echo "Valgrind passed, command exit code: $EXIT_CODE"
310+ exit 0
311+ fi
312+
313+ - name : Run valgrind memcheck - normal mode without diff output
314+ run : |
315+ set +e
316+ valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=99 --errors-for-leak-kinds=definite,possible \
317+ --suppressions=.valgrind.supp \
318+ ./zig-out/bin/odiff test/png/orange.png test/png/orange_changed.png 2>&1 | grep -vE "(DWARF2 reader: Badly formed|Can't handle line info entry)"
319+ EXIT_CODE=$?
320+ if [ $EXIT_CODE -eq 99 ]; then
321+ echo "ERROR: Valgrind detected memory errors!"
322+ exit 1
323+ else
324+ echo "Valgrind passed, command exit code: $EXIT_CODE"
325+ exit 0
326+ fi
327+
277328 spellcheck :
278329 name : Spell check
279330 runs-on : ubuntu-latest
280331 steps :
281332 - name : Checkout code
282- uses : actions/checkout@v4
333+ uses : actions/checkout@v5
283334
284335 - name : Run typos
285336 uses : crate-ci/typos@master
@@ -293,7 +344,7 @@ jobs:
293344 runs-on : ubuntu-latest
294345 steps :
295346 - name : Checkout
296- uses : actions/checkout@v1
347+ uses : actions/checkout@v5
297348
298349 - name : Download all built binaries
299350 uses : actions/download-artifact@v4
@@ -321,7 +372,7 @@ jobs:
321372 registry-url : " https://registry.npmjs.org"
322373 cache-dependency-path : " package-lock.json"
323374
324- - name : Copy root readme
375+ - name : Copy root readme
325376 run : cp README.md npm_packages/odiff-bin/README.md
326377
327378 - name : Publish odiff-bin package
@@ -330,6 +381,10 @@ jobs:
330381 env :
331382 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
332383
384+ - name : Build playwright-odiff package
385+ working-directory : npm_packages/playwright-odiff
386+ run : npm run build
387+
333388 - name : Publish playwright-odiff package
334389 working-directory : npm_packages/playwright-odiff
335390 run : npm publish
@@ -342,3 +397,24 @@ jobs:
342397 files : " binaries/*"
343398 env :
344399 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
400+
401+ commit-sanity-check :
402+ runs-on : ubuntu-latest
403+ steps :
404+ - name : Checkout
405+ uses : actions/checkout@v5
406+
407+ - name : Verify binary was not commit in npm package folder
408+ run : |
409+ if ! file ./npm_packages/odiff-bin/bin/odiff.exe | grep -q "Node.js script executable"; then
410+ echo "Looks like you commited a local binary to ./npm_packages/odiff-bin/bin/odiff.exe. Please revert"
411+ exit 1
412+ fi
413+
414+ - name : Check docs in readme
415+ run : |
416+ npm run update-readme
417+ if ! git diff --quiet; then
418+ echo "Please run `npm run update-readme` and commit changes."
419+ exit 1
420+ fi
0 commit comments