Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ updates:
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
groups:
github-actions:
patterns:
Expand All @@ -13,3 +15,5 @@ updates:
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
24 changes: 17 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@ on:
- '*'
merge_group:

permissions: {}

jobs:

run-type-checking:

name: Run tests for type-checking
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
- name: Install just
uses: extractions/setup-just@v3
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3
- name: Install graphviz
run: |
sudo apt-get update
Expand All @@ -38,6 +44,8 @@ jobs:

name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
permissions:
contents: read

strategy:
fail-fast: false
Expand All @@ -46,13 +54,15 @@ jobs:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']

steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install just
uses: extractions/setup-just@v3
uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3

- if: matrix.os == 'ubuntu-latest'
run: |
Expand All @@ -71,7 +81,7 @@ jobs:
run: uv run --group test pytest --cov=src --cov=tests --cov-report=xml -n auto

- name: Upload test coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5

- name: Run tests with lowest resolution
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'
Expand Down
47 changes: 27 additions & 20 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@ name: Publish Python 🐍 distribution 📦 to PyPI

on: push

permissions: {}

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: "3.13"
- name: Build a binary wheel and a source tarball
run: python3 -m build
run: uv build
- name: Store the distribution packages
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: python-package-distributions
path: dist/
Expand All @@ -41,12 +42,14 @@ jobs:

steps:
- name: Download all the dists
uses: actions/download-artifact@v8
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: python-package-distributions
path: dist/
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
run: uv publish

github-release:
name: >-
Expand All @@ -62,30 +65,34 @@ jobs:

steps:
- name: Download all the dists
uses: actions/download-artifact@v8
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.2.0
uses: sigstore/gh-action-sigstore-python@a5caf349bc536fbef3668a10ed7f5cd309a4b53d # v3.2.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ github.ref_name }}
REPOSITORY: ${{ github.repository }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
"$RELEASE_TAG"
--repo "$REPOSITORY"
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ github.ref_name }}
REPOSITORY: ${{ github.repository }}
# Upload to GitHub Release using the `gh` CLI. `dist/` contains the built
# packages, and the sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
"$RELEASE_TAG" dist/**
--repo "$REPOSITORY"
14 changes: 5 additions & 9 deletions .github/workflows/update-plugin-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,18 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Python
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
python-version: 3.12

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install packaging httpx tabulate[widechars] tqdm

- name: Update Plugin List
run: python scripts/update_plugin_list.py
run: uv run --group plugin-list python scripts/update_plugin_list.py

- name: Create Pull Request
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: zizmor

on:
push:
branches:
- main
pull_request:
branches:
- '*'
schedule:
- cron: '0 7 * * 1'
workflow_dispatch:

permissions: {}

jobs:
zizmor:
name: Scan GitHub Actions
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
with:
enable-cache: true
python-version: '3.13'

- name: Run zizmor
run: uvx --from zizmor zizmor --format=github .

- name: Generate SARIF report
if: always()
run: uvx --from zizmor zizmor --format=sarif --no-exit-codes . > zizmor.sarif

- name: Upload SARIF report
if: >
always() &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4
with:
sarif_file: zizmor.sarif
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ coverage.*
.ipynb_checkpoints
.tox
.vscode
.claude
.codex
_build
__pycache__
_generated
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and

## Unreleased

- [#836](https://github.com/pytask-dev/pytask/pull/836) hardens GitHub Actions
workflows with zizmor, pinned action SHAs, explicit permissions, and a dedicated
code-scanning upload workflow.
- [#830](https://github.com/pytask-dev/pytask/pull/830) replaces the internal
`networkx` dependency with a pytask-owned DAG implementation, lazy-loads
`networkx` only for DAG export and visualization, and makes the `networkx`
Expand Down
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ typing:
lint:
uvx prek run -a

# Run static analysis for GitHub Actions
zizmor:
uvx --from zizmor zizmor .

# Run all checks (format, lint, typing, test)
check: lint typing test

Expand Down
Loading