mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
[3.12] Add zizmor to pre-commit and fix most findings (GH-127749) (#127788)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
This commit is contained in:
parent
8159d0c39e
commit
381eb04c17
16 changed files with 75 additions and 24 deletions
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
|
|
@ -55,6 +55,8 @@ jobs:
|
|||
if: needs.check_source.outputs.run_tests == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-python@v5
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
|
@ -109,6 +111,7 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
persist-credentials: false
|
||||
- name: Runner image version
|
||||
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
||||
- name: Check Autoconf and aclocal versions
|
||||
|
|
@ -145,6 +148,8 @@ jobs:
|
|||
if: needs.check_source.outputs.run_tests == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
|
@ -299,6 +304,8 @@ jobs:
|
|||
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Runner image version
|
||||
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
||||
- name: Restore config.cache
|
||||
|
|
@ -351,6 +358,8 @@ jobs:
|
|||
PYTHONSTRICTEXTENSIONBUILD: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Register gcc problem matcher
|
||||
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
|
||||
- name: Install dependencies
|
||||
|
|
@ -433,7 +442,7 @@ jobs:
|
|||
#
|
||||
# (GH-104097) test_sysconfig is skipped because it has tests that are
|
||||
# failing when executed from inside a virtual environment.
|
||||
${{ env.VENV_PYTHON }} -m test \
|
||||
"${VENV_PYTHON}" -m test \
|
||||
-W \
|
||||
-o \
|
||||
-j4 \
|
||||
|
|
@ -465,6 +474,8 @@ jobs:
|
|||
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Runner image version
|
||||
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
||||
- name: Restore config.cache
|
||||
|
|
|
|||
6
.github/workflows/documentation-links.yml
vendored
6
.github/workflows/documentation-links.yml
vendored
|
|
@ -10,9 +10,6 @@ on:
|
|||
- 'Doc/**'
|
||||
- '.github/workflows/doc.yml'
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
|
@ -20,6 +17,9 @@ concurrency:
|
|||
jobs:
|
||||
documentation-links:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: readthedocs/actions/preview@v1
|
||||
with:
|
||||
|
|
|
|||
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
|
|
@ -20,6 +20,8 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
|
|
|||
2
.github/workflows/mypy.yml
vendored
2
.github/workflows/mypy.yml
vendored
|
|
@ -31,6 +31,8 @@ jobs:
|
|||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
|
|
|||
7
.github/workflows/require-pr-label.yml
vendored
7
.github/workflows/require-pr-label.yml
vendored
|
|
@ -4,15 +4,14 @@ on:
|
|||
pull_request:
|
||||
types: [opened, reopened, labeled, unlabeled, synchronize]
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
label:
|
||||
name: DO-NOT-MERGE / unresolved review
|
||||
if: github.repository_owner == 'python'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ jobs:
|
|||
- run: >-
|
||||
echo '${{ github.event_name }}'
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Check for source changes
|
||||
id: check
|
||||
run: |
|
||||
|
|
|
|||
14
.github/workflows/reusable-docs.yml
vendored
14
.github/workflows/reusable-docs.yml
vendored
|
|
@ -19,12 +19,14 @@ jobs:
|
|||
env:
|
||||
branch_base: 'origin/${{ github.event.pull_request.base.ref }}'
|
||||
branch_pr: 'origin/${{ github.event.pull_request.head.ref }}'
|
||||
commits: ${{ github.event.pull_request.commits }}
|
||||
refspec_base: '+${{ github.event.pull_request.base.sha }}:remotes/origin/${{ github.event.pull_request.base.ref }}'
|
||||
refspec_pr: '+${{ github.event.pull_request.head.sha }}:remotes/origin/${{ github.event.pull_request.head.ref }}'
|
||||
steps:
|
||||
- name: 'Check out latest PR branch commit'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
ref: >-
|
||||
${{
|
||||
github.event_name == 'pull_request'
|
||||
|
|
@ -36,15 +38,15 @@ jobs:
|
|||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
# Fetch enough history to find a common ancestor commit (aka merge-base):
|
||||
git fetch origin ${{ env.refspec_pr }} --depth=$(( ${{ github.event.pull_request.commits }} + 1 )) \
|
||||
git fetch origin "${refspec_pr}" --depth=$(( commits + 1 )) \
|
||||
--no-tags --prune --no-recurse-submodules
|
||||
|
||||
# This should get the oldest commit in the local fetched history (which may not be the commit the PR branched from):
|
||||
COMMON_ANCESTOR=$( git rev-list --first-parent --max-parents=0 --max-count=1 ${{ env.branch_pr }} )
|
||||
COMMON_ANCESTOR=$( git rev-list --first-parent --max-parents=0 --max-count=1 "${branch_pr}" )
|
||||
DATE=$( git log --date=iso8601 --format=%cd "${COMMON_ANCESTOR}" )
|
||||
|
||||
# Get all commits since that commit date from the base branch (eg: master or main):
|
||||
git fetch origin ${{ env.refspec_base }} --shallow-since="${DATE}" \
|
||||
git fetch origin "${refspec_base}" --shallow-since="${DATE}" \
|
||||
--no-tags --prune --no-recurse-submodules
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
|
|
@ -66,7 +68,7 @@ jobs:
|
|||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
python Doc/tools/check-warnings.py \
|
||||
--annotate-diff '${{ env.branch_base }}' '${{ env.branch_pr }}' \
|
||||
--annotate-diff "${branch_base}" "${branch_pr}" \
|
||||
--fail-if-regression \
|
||||
--fail-if-improved \
|
||||
--fail-if-new-news-nit
|
||||
|
|
@ -78,6 +80,8 @@ jobs:
|
|||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
|
|
@ -96,6 +100,8 @@ jobs:
|
|||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
|
|
|
|||
2
.github/workflows/reusable-macos.yml
vendored
2
.github/workflows/reusable-macos.yml
vendored
|
|
@ -28,6 +28,8 @@ jobs:
|
|||
runs-on: ${{ inputs.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Runner image version
|
||||
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
||||
- name: Restore config.cache
|
||||
|
|
|
|||
6
.github/workflows/reusable-tsan.yml
vendored
6
.github/workflows/reusable-tsan.yml
vendored
|
|
@ -15,8 +15,12 @@ jobs:
|
|||
name: 'Thread sanitizer'
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
OPTIONS: ${{ inputs.options }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Runner image version
|
||||
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
|
||||
- name: Restore config.cache
|
||||
|
|
@ -44,7 +48,7 @@ jobs:
|
|||
save: ${{ github.event_name == 'push' }}
|
||||
max-size: "200M"
|
||||
- name: Configure CPython
|
||||
run: ${{ inputs.options }}
|
||||
run: "${OPTIONS}"
|
||||
- name: Build CPython
|
||||
run: make -j4
|
||||
- name: Display build info
|
||||
|
|
|
|||
2
.github/workflows/reusable-ubuntu.yml
vendored
2
.github/workflows/reusable-ubuntu.yml
vendored
|
|
@ -26,6 +26,8 @@ jobs:
|
|||
PYTHONSTRICTEXTENSIONBUILD: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Register gcc problem matcher
|
||||
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
|
||||
- name: Install dependencies
|
||||
|
|
|
|||
5
.github/workflows/reusable-windows-msi.yml
vendored
5
.github/workflows/reusable-windows-msi.yml
vendored
|
|
@ -17,8 +17,11 @@ jobs:
|
|||
runs-on: windows-latest
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
ARCH: ${{ inputs.arch }}
|
||||
IncludeFreethreaded: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Build CPython installer
|
||||
run: .\Tools\msi\build.bat --doc -${{ inputs.arch }}
|
||||
run: .\Tools\msi\build.bat --doc -"${ARCH}"
|
||||
|
|
|
|||
14
.github/workflows/reusable-windows.yml
vendored
14
.github/workflows/reusable-windows.yml
vendored
|
|
@ -24,24 +24,30 @@ jobs:
|
|||
(${{ inputs.arch }})
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
ARCH: ${{ inputs.arch }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Register MSVC problem matcher
|
||||
if: inputs.arch != 'Win32'
|
||||
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
|
||||
- name: Build CPython
|
||||
run: >-
|
||||
.\PCbuild\build.bat
|
||||
.\\PCbuild\\build.bat
|
||||
-e -d
|
||||
-p ${{ inputs.arch }}
|
||||
-p "${ARCH}"
|
||||
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
|
||||
shell: bash
|
||||
- name: Display build info
|
||||
if: inputs.arch != 'arm64'
|
||||
run: .\python.bat -m test.pythoninfo
|
||||
- name: Tests
|
||||
if: inputs.arch != 'arm64'
|
||||
run: >-
|
||||
.\PCbuild\rt.bat
|
||||
-p ${{ inputs.arch }}
|
||||
.\\PCbuild\\rt.bat
|
||||
-p "${ARCH}"
|
||||
-d -q -uall -u-cpu -rwW
|
||||
--slowest --timeout=1200 -j0
|
||||
shell: bash
|
||||
|
|
|
|||
5
.github/workflows/stale.yml
vendored
5
.github/workflows/stale.yml
vendored
|
|
@ -4,14 +4,13 @@ on:
|
|||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
if: github.repository_owner == 'python'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ jobs:
|
|||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3'
|
||||
|
|
|
|||
6
.github/zizmor.yml
vendored
Normal file
6
.github/zizmor.yml
vendored
Normal 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:
|
||||
- documentation-links.yml
|
||||
Loading…
Add table
Add a link
Reference in a new issue