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: 3 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
directories:
- "/" # pyproject.toml and poetry.lock
- "/.github" # tools the workflows install
schedule:
interval: "daily"
assignees:
Expand Down
2 changes: 2 additions & 0 deletions .github/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Tools that the workflows install. Dependabot keeps the versions current.
poetry==2.5.1
11 changes: 8 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@v7
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install poetry
pip install -r .github/requirements.txt
poetry install
- name: Check for syntax errors
run: |
python -m compileall .
- name: Run tests
run: |
PYTHONPATH=src poetry run pytest
# publish.yaml builds the release this way, so a Poetry update that
# breaks it fails here, not in the release.
- name: Build the package
run: |
poetry build
31 changes: 31 additions & 0 deletions .github/workflows/osv-scanner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Fails a pull request that adds a dependency version that OSV.dev lists an
# advisory for, such as a known vulnerability or a malicious release.
# Advisories the base branch already has do not fail it. Prow merges only
# once all checks pass, so this also stops such a Dependabot update.
name: OSV-Scanner

on:
pull_request:
branches: [ 'main', 'release-*' ]

permissions: {}

jobs:
scan:
# The reusable workflow asks for these, even with upload-sarif off.
permissions:
actions: read
contents: read
security-events: write
uses: google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@32d3cd482bdadfb38b186c0ad1b031902d55d932 # v2.7.1
with:
# Results show as pull request annotations and in the job's artifacts.
# We do not want code scanning alerts.
upload-sarif: false
# .github/requirements.txt names only Poetry. Without --no-resolve the
# scanner guesses versions for Poetry's dependencies, older than the
# ones pip installs, and fails on their advisories.
scan-args: |-
--no-resolve
-r
./
33 changes: 16 additions & 17 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,20 @@ jobs:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@v7
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
# The version ci.yaml tests "poetry build" with.
python-version: "3.12"
# Poetry requires one exact poetry-core version, so pinning Poetry also
# pins the build backend.
- name: Install Poetry
run: pip install -r .github/requirements.txt
- name: Build a binary wheel and a source tarball
run: python3 -m build
run: poetry build
- name: Store the distribution packages
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: python-package-distributions
path: dist/
Expand All @@ -50,12 +49,12 @@ jobs:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3

# A GitHub release will be created (and signed) for all PyPI releases.
github-release:
Expand All @@ -75,12 +74,12 @@ jobs:
sudo apt install gh -y
gh --version
- name: Download all the dists
uses: actions/download-artifact@v8
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.5.0
uses: sigstore/gh-action-sigstore-python@790bc6befb9d733738f18d8f895854b453640ec9 # v3.5.0
with:
inputs: >-
./dist/*.tar.gz
Expand Down Expand Up @@ -118,12 +117,12 @@ jobs:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: python-package-distributions
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
repository-url: https://test.pypi.org/legacy/

Loading