From e53728e31d43ed084292bcf8469290266295d70a Mon Sep 17 00:00:00 2001 From: Roman Lutz Date: Thu, 26 Feb 2026 06:22:22 -0800 Subject: [PATCH 1/2] MAINT Add macos-latest to CI build and test pipeline Add macos-latest to the test matrix and add a pre-commit-macos job, matching the existing Linux and Windows pre-commit jobs. Closes #733 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/build_and_test.yml | 52 +++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 9e4ed6c7a4..470d035ff5 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -125,12 +125,62 @@ jobs: run: | uv run pre-commit run --all-files + pre-commit-macos: + runs-on: macos-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v3 + with: + python-version: ${{ env.PRE_COMMIT_PYTHON_VERSION }} + + - name: Cache pre-commit environments + uses: actions/cache@v3 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} + restore-keys: | + pre-commit-${{ runner.os }}- + + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + # Install a specific version of uv. + version: "0.9.17" + enable-cache: true + cache-dependency-glob: | + **/pyproject.toml + **/uv.lock + + - name: Install dev extras + run: uv sync --extra dev --extra all + + - name: disk space + run: df -all -h + + - name: Run pre-commit incrementally (on PR) + if: github.event_name == 'pull_request' + env: + RUN_LONG_PRECOMMIT: true + run: | + git fetch origin main + uv run pre-commit run --from-ref origin/main --to-ref HEAD + + - name: Run pre-commit fully (on main) + if: github.ref == 'refs/heads/main' + env: + RUN_LONG_PRECOMMIT: true + run: | + uv run pre-commit run --all-files + # Main job runs only if pre-commit succeeded main-job: strategy: fail-fast: true matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, windows-latest, macos-latest] python: ["3.10", "3.11", "3.12", "3.13"] package_name: ["pyrit"] package_extras: ["dev", "dev_all"] From 6038a78e0e03314bd6ac75abf7d10c5953af371a Mon Sep 17 00:00:00 2001 From: Roman Lutz Date: Thu, 26 Feb 2026 11:05:38 -0800 Subject: [PATCH 2/2] Consolidate pre-commit into single matrix job Replace three separate pre-commit-linux/windows/macos jobs with a single pre-commit job using a matrix strategy over all three OSes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/build_and_test.yml | 112 ++------------------------- 1 file changed, 7 insertions(+), 105 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 470d035ff5..3f677f2767 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -22,111 +22,12 @@ concurrency: cancel-in-progress: true jobs: - pre-commit-linux: - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v3 - with: - python-version: ${{ env.PRE_COMMIT_PYTHON_VERSION }} - - - name: Cache pre-commit environments - uses: actions/cache@v3 - with: - path: ~/.cache/pre-commit - key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} - restore-keys: | - pre-commit-${{ runner.os }}- - - - name: Install uv - uses: astral-sh/setup-uv@v7 - with: - # Install a specific version of uv. - version: "0.9.17" - enable-cache: true - cache-dependency-glob: | - **/pyproject.toml - **/uv.lock - - - name: Install dev extras - run: uv sync --extra dev --extra all - - - name: disk space - run: df -all -h - - - name: Run pre-commit incrementally (on PR) - if: github.event_name == 'pull_request' - env: - RUN_LONG_PRECOMMIT: true - run: | - git fetch origin main - uv run pre-commit run --from-ref origin/main --to-ref HEAD - - - name: Run pre-commit fully (on main) - if: github.ref == 'refs/heads/main' - env: - RUN_LONG_PRECOMMIT: true - run: | - uv run pre-commit run --all-files - - pre-commit-windows: - runs-on: windows-latest - permissions: - contents: read - defaults: - run: - shell: pwsh - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v3 - with: - python-version: ${{ env.PRE_COMMIT_PYTHON_VERSION }} - - - name: Cache pre-commit environments - uses: actions/cache@v3 - with: - path: ~/.cache/pre-commit - key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} - restore-keys: | - pre-commit-${{ runner.os }}- - - - name: Install uv - uses: astral-sh/setup-uv@v7 - with: - # Install a specific version of uv. - version: "0.9.17" - enable-cache: true - cache-dependency-glob: | - **/pyproject.toml - **/uv.lock - - - name: Install dev extras - run: uv sync --extra dev --extra all - - - name: disk space - run: df -all -h - - - name: Run pre-commit incrementally (on PR) - if: github.event_name == 'pull_request' - env: - RUN_LONG_PRECOMMIT: true - run: | - git fetch origin main - uv run pre-commit run --from-ref origin/main --to-ref HEAD - - - name: Run pre-commit fully (on main) - if: github.ref == 'refs/heads/main' - env: - RUN_LONG_PRECOMMIT: true - run: | - uv run pre-commit run --all-files - - pre-commit-macos: - runs-on: macos-latest + pre-commit: + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} permissions: contents: read steps: @@ -158,6 +59,7 @@ jobs: run: uv sync --extra dev --extra all - name: disk space + shell: bash run: df -all -h - name: Run pre-commit incrementally (on PR)