Bump zizmor pre-commit hook to the latest version and fix new warnings (#15022)

This commit is contained in:
Alex Waygood 2024-12-16 17:45:46 +00:00 committed by GitHub
parent 712c886749
commit 6d72be2683
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 42 additions and 20 deletions

View File

@ -290,7 +290,9 @@ jobs:
file: "Cargo.toml" file: "Cargo.toml"
field: "workspace.package.rust-version" field: "workspace.package.rust-version"
- name: "Install Rust toolchain" - name: "Install Rust toolchain"
run: rustup default ${{ steps.msrv.outputs.value }} env:
MSRV: ${{ steps.msrv.outputs.value }}
run: rustup default "${MSRV}"
- name: "Install mold" - name: "Install mold"
uses: rui314/setup-mold@v1 uses: rui314/setup-mold@v1
- name: "Install cargo nextest" - name: "Install cargo nextest"
@ -306,7 +308,8 @@ jobs:
shell: bash shell: bash
env: env:
NEXTEST_PROFILE: "ci" NEXTEST_PROFILE: "ci"
run: cargo +${{ steps.msrv.outputs.value }} insta test --all-features --unreferenced reject --test-runner nextest MSRV: ${{ steps.msrv.outputs.value }}
run: cargo "+${MSRV}" insta test --all-features --unreferenced reject --test-runner nextest
cargo-fuzz-build: cargo-fuzz-build:
name: "cargo fuzz build" name: "cargo fuzz build"
@ -354,16 +357,18 @@ jobs:
name: ruff name: ruff
path: ruff-to-test path: ruff-to-test
- name: Fuzz - name: Fuzz
env:
DOWNLOAD_PATH: ${{ steps.download-cached-binary.outputs.download-path }}
run: | run: |
# Make executable, since artifact download doesn't preserve this # Make executable, since artifact download doesn't preserve this
chmod +x ${{ steps.download-cached-binary.outputs.download-path }}/ruff chmod +x "${DOWNLOAD_PATH}/ruff"
( (
uvx \ uvx \
--python=${{ env.PYTHON_VERSION }} \ --python="${PYTHON_VERSION}" \
--from=./python/py-fuzzer \ --from=./python/py-fuzzer \
fuzz \ fuzz \
--test-executable=${{ steps.download-cached-binary.outputs.download-path }}/ruff \ --test-executable="${DOWNLOAD_PATH}/ruff" \
--bin=ruff \ --bin=ruff \
0-500 0-500
) )
@ -429,14 +434,16 @@ jobs:
- name: Run `ruff check` stable ecosystem check - name: Run `ruff check` stable ecosystem check
if: ${{ needs.determine_changes.outputs.linter == 'true' }} if: ${{ needs.determine_changes.outputs.linter == 'true' }}
env:
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
run: | run: |
# Make executable, since artifact download doesn't preserve this # Make executable, since artifact download doesn't preserve this
chmod +x ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
# Set pipefail to avoid hiding errors with tee # Set pipefail to avoid hiding errors with tee
set -eo pipefail set -eo pipefail
ruff-ecosystem check ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-check-stable ruff-ecosystem check ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown | tee ecosystem-result-check-stable
cat ecosystem-result-check-stable > "$GITHUB_STEP_SUMMARY" cat ecosystem-result-check-stable > "$GITHUB_STEP_SUMMARY"
echo "### Linter (stable)" > ecosystem-result echo "### Linter (stable)" > ecosystem-result
@ -445,14 +452,16 @@ jobs:
- name: Run `ruff check` preview ecosystem check - name: Run `ruff check` preview ecosystem check
if: ${{ needs.determine_changes.outputs.linter == 'true' }} if: ${{ needs.determine_changes.outputs.linter == 'true' }}
env:
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
run: | run: |
# Make executable, since artifact download doesn't preserve this # Make executable, since artifact download doesn't preserve this
chmod +x ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
# Set pipefail to avoid hiding errors with tee # Set pipefail to avoid hiding errors with tee
set -eo pipefail set -eo pipefail
ruff-ecosystem check ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-check-preview ruff-ecosystem check ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-check-preview
cat ecosystem-result-check-preview > "$GITHUB_STEP_SUMMARY" cat ecosystem-result-check-preview > "$GITHUB_STEP_SUMMARY"
echo "### Linter (preview)" >> ecosystem-result echo "### Linter (preview)" >> ecosystem-result
@ -461,14 +470,16 @@ jobs:
- name: Run `ruff format` stable ecosystem check - name: Run `ruff format` stable ecosystem check
if: ${{ needs.determine_changes.outputs.formatter == 'true' }} if: ${{ needs.determine_changes.outputs.formatter == 'true' }}
env:
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
run: | run: |
# Make executable, since artifact download doesn't preserve this # Make executable, since artifact download doesn't preserve this
chmod +x ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
# Set pipefail to avoid hiding errors with tee # Set pipefail to avoid hiding errors with tee
set -eo pipefail set -eo pipefail
ruff-ecosystem format ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-format-stable ruff-ecosystem format ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown | tee ecosystem-result-format-stable
cat ecosystem-result-format-stable > "$GITHUB_STEP_SUMMARY" cat ecosystem-result-format-stable > "$GITHUB_STEP_SUMMARY"
echo "### Formatter (stable)" >> ecosystem-result echo "### Formatter (stable)" >> ecosystem-result
@ -477,14 +488,16 @@ jobs:
- name: Run `ruff format` preview ecosystem check - name: Run `ruff format` preview ecosystem check
if: ${{ needs.determine_changes.outputs.formatter == 'true' }} if: ${{ needs.determine_changes.outputs.formatter == 'true' }}
env:
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
run: | run: |
# Make executable, since artifact download doesn't preserve this # Make executable, since artifact download doesn't preserve this
chmod +x ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
# Set pipefail to avoid hiding errors with tee # Set pipefail to avoid hiding errors with tee
set -eo pipefail set -eo pipefail
ruff-ecosystem format ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-format-preview ruff-ecosystem format ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-format-preview
cat ecosystem-result-format-preview > "$GITHUB_STEP_SUMMARY" cat ecosystem-result-format-preview > "$GITHUB_STEP_SUMMARY"
echo "### Formatter (preview)" >> ecosystem-result echo "### Formatter (preview)" >> ecosystem-result
@ -541,7 +554,7 @@ jobs:
args: --out dist args: --out dist
- name: "Test wheel" - name: "Test wheel"
run: | run: |
pip install --force-reinstall --find-links dist ${{ env.PACKAGE_NAME }} pip install --force-reinstall --find-links dist "${PACKAGE_NAME}"
ruff --help ruff --help
python -m ruff --help python -m ruff --help
- name: "Remove wheels from cache" - name: "Remove wheels from cache"
@ -676,11 +689,13 @@ jobs:
just install just install
- name: Run ruff-lsp tests - name: Run ruff-lsp tests
env:
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
run: | run: |
# Setup development binary # Setup development binary
pip uninstall --yes ruff pip uninstall --yes ruff
chmod +x ${{ steps.ruff-target.outputs.download-path }}/ruff chmod +x "${DOWNLOAD_PATH}/ruff"
export PATH=${{ steps.ruff-target.outputs.download-path }}:$PATH export PATH="${DOWNLOAD_PATH}:${PATH}"
ruff version ruff version
just test just test

View File

@ -10,12 +10,11 @@ on:
description: The ecosystem workflow that triggers the workflow run description: The ecosystem workflow that triggers the workflow run
required: true required: true
permissions:
pull-requests: write
jobs: jobs:
comment: comment:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
pull-requests: write
steps: steps:
- uses: dawidd6/action-download-artifact@v7 - uses: dawidd6/action-download-artifact@v7
name: Download pull request number name: Download pull request number

6
.github/zizmor.yml vendored Normal file
View File

@ -0,0 +1,6 @@
# Configuration for the zizmor static analysis tool, run via pre-commit in CI
# https://woodruffw.github.io/zizmor/configuration/
rules:
dangerous-triggers:
ignore:
- pr-comment.yaml

View File

@ -87,8 +87,10 @@ repos:
- id: prettier - id: prettier
types: [yaml] types: [yaml]
# zizmor detects security vulnerabilities in GitHub Actions workflows.
# Additional configuration for the tool is found in `.github/zizmor.yml`
- repo: https://github.com/woodruffw/zizmor-pre-commit - repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v0.8.0 rev: v0.9.2
hooks: hooks:
- id: zizmor - id: zizmor
# `release.yml` is autogenerated by `dist`; security issues need to be fixed there # `release.yml` is autogenerated by `dist`; security issues need to be fixed there