6666 - name : check compilation without threading
6767 run : cargo check ${{ env.CARGO_ARGS }}
6868
69+ - run : cargo doc --locked
70+ if : runner.os == 'Linux'
71+
6972 - name : check compilation without host_env (sandbox mode)
7073 run : |
7174 cargo check -p rustpython-vm --no-default-features --features compiler
@@ -326,8 +329,13 @@ jobs:
326329 run : python -I scripts/whats_left.py ${{ env.CARGO_ARGS }} --features jit
327330
328331 lint :
329- name : Lint Rust & Python code
332+ name : Lint
330333 runs-on : ubuntu-latest
334+ permissions :
335+ contents : read
336+ checks : write
337+ pull-requests : write
338+ security-events : write # for zizmor
331339 steps :
332340 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
333341 with :
@@ -337,53 +345,52 @@ jobs:
337345 with :
338346 python-version : ${{ env.PYTHON_VERSION }}
339347
340- - name : Check for redundant test patches
341- run : python scripts/check_redundant_patches.py
342-
343348 - uses : dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
344349 with :
345- components : clippy
346350 toolchain : stable
351+ components : rustfmt
347352
348- - name : run clippy on wasm
349- run : cargo clippy --manifest-path=crates/wasm/Cargo.toml -- -Dwarnings
350-
351- - name : Ensure docs generate no warnings
352- run : cargo doc --locked
353+ - uses : cargo-bins/cargo-binstall@113a77a4ce971c41332f2129c3d995df993cf746 # v1.17.8
353354
354- - name : Ensure Lib/_opcode_metadata is updated
355+ - name : cargo shear
355356 run : |
356- python scripts/generate_opcode_metadata.py
357- if [ -n "$(git status --porcelain)" ]; then
358- exit 1
359- fi
357+ cargo binstall --no-confirm cargo-shear
358+ cargo shear
360359
361- - name : Install ruff
362- uses : astral-sh/ruff-action@4919ec5cf1f49eff0871dbcea0da843445b837e6 # v3.6.1
363- with :
364- version : " 0.15.5"
365- args : " --version"
360+ - name : actionlint
361+ uses : reviewdog/action-actionlint@0d952c597ef8459f634d7145b0b044a9699e5e43 # v1.71.0
366362
367- - run : ruff check --diff
363+ - name : zizmor
364+ uses : zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
368365
369- - run : ruff format --check
366+ - name : restore prek cache
367+ if : ${{ github.ref != 'refs/heads/main' }} # never restore on main
368+ uses : actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
369+ with :
370+ key : prek-${{ hashFiles('.pre-commit-config.yaml') }}
371+ path : ~/.cache/prek
370372
371- - name : install prettier
372- run : |
373- yarn global add prettier
374- yarn global bin >> "$GITHUB_PATH"
373+ - name : prek
374+ id : prek
375+ uses : j178/prek-action@79f765515bd648eb4d6bb1b17277b7cb22cb6468 # v2.0.0
376+ with :
377+ cache : false
378+ show-verbose-logs : false
379+ continue-on-error : true
375380
376- - name : check wasm code with prettier
377- # prettier doesn't handle ignore files very well: https://github.com/prettier/prettier/issues/8506
378- run : cd wasm && git ls-files -z | xargs -0 prettier --check -u
379- # Keep cspell check as the last step. This is optional test.
380- - name : install extra dictionaries
381- run : npm install @cspell/dict-en_us @cspell/dict-cpp @cspell/dict-python @cspell/dict-rust @cspell/dict-win32 @cspell/dict-shell
382- - name : spell checker
383- uses : streetsidesoftware/cspell-action@v8
381+ - name : save prek cache
382+ if : ${{ github.ref == 'refs/heads/main' }} # only save on main
383+ uses : actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
384384 with :
385- files : " **/*.rs"
386- incremental_files_only : true
385+ key : prek-${{ hashFiles('.pre-commit-config.yaml') }}
386+ path : ~/.cache/prek
387+
388+ - name : reviewdog
389+ uses : reviewdog/action-suggester@aa38384ceb608d00f84b4690cacc83a5aba307ff # 1.24.0
390+ with :
391+ level : warning
392+ fail_level : error
393+ cleanup : false
387394
388395 miri :
389396 if : ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
@@ -425,12 +432,16 @@ jobs:
425432
426433 - uses : dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
427434 with :
435+ components : clippy
428436 toolchain : stable
429437
430438 - uses : Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
431439 with :
432440 save-if : ${{ github.ref == 'refs/heads/main' }}
433441
442+ - name : cargo clippy
443+ run : cargo clippy --manifest-path=crates/wasm/Cargo.toml -- -Dwarnings
444+
434445 - name : install wasm-pack
435446 run : curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
436447 - name : install geckodriver
@@ -520,29 +531,3 @@ jobs:
520531 run : wasmer run --dir "$(pwd)" target/wasm32-wasip1/release/rustpython.wasm -- "$(pwd)/extra_tests/snippets/stdlib_random.py"
521532 - name : run cpython unittest
522533 run : wasmer run --dir "$(pwd)" target/wasm32-wasip1/release/rustpython.wasm -- "$(pwd)/Lib/test/test_int.py"
523-
524- cargo-shear :
525- name : cargo shear
526- runs-on : ubuntu-latest
527- steps :
528- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
529- with :
530- persist-credentials : false
531-
532- - uses : cargo-bins/cargo-binstall@113a77a4ce971c41332f2129c3d995df993cf746 # v1.17.8
533-
534- - run : cargo binstall --no-confirm cargo-shear
535-
536- - run : cargo shear
537-
538- security-lint :
539- runs-on : ubuntu-latest
540- permissions :
541- security-events : write
542- steps :
543- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
544- with :
545- persist-credentials : false
546-
547- - name : Run zizmor
548- uses : zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
0 commit comments