Skip to content

Bump pytest from 8.3.2 to 8.3.3 #2292

Bump pytest from 8.3.2 to 8.3.3

Bump pytest from 8.3.2 to 8.3.3 #2292

Workflow file for this run

name: Python package
on:
push:
branches:
- "**"
tags:
- "v*"
pull_request:
branches:
- "main"
permissions:
contents: read
jobs:
upload-event-file:
name: Upload event file
runs-on: ubuntu-latest
steps:
- name: Harden runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: block
- name: Upload
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: event-file
path: ${{ github.event_path }}
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
attestations: write
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
steps:
- name: Harden runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.codecov.io:443
api.github.com:443
cli.codecov.io:443
codecov.io:443
files.pythonhosted.org:443
fulcio.sigstore.dev:443
github.com:443
objects.githubusercontent.com:443
pypi.org:443
raw.githubusercontent.com:443
registry.npmjs.org:443
rekor.sigstore.dev:443
storage.googleapis.com:443
uploader.codecov.io:443
uploads.github.com:443
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Make venv
run: make venv
- name: Lint
run: make lint
- name: Test
run: make test
- name: Upload test results
if: always()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: test-results-${{ matrix.python-version }}
path: test-results.xml
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: ./coverage.xml
flags: python-${{ matrix.python-version }}
use_oidc: true
- name: Build
run: make build
- name: Generate SBOM
if: ${{ matrix.python-version == '3.11' }}
uses: anchore/sbom-action@61119d458adab75f756bc0b9e4bde25725f86a7a # v0.17.2
with:
format: spdx-json
artifact-name: sbom-python.spdx.json
output-file: sbom-python.spdx.json
- name: Generate SBOM attestation
if: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' && matrix.python-version == '3.11' }}
uses: actions/attest-sbom@5026d3663739160db546203eeaffa6aa1c51a4d6 # v1.4.1
with:
subject-path: dist/*.whl
sbom-path: sbom-python.spdx.json
- name: Generate artifact attestation
if: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' && matrix.python-version == '3.11' }}
uses: actions/attest-build-provenance@6149ea5740be74af77f260b9db67e633f6b0a9a1 # v1.4.2
with:
subject-path: dist/*.whl
- name: Generate hashes
id: hash
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.11' }}
run: cd dist && echo "hashes=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
- name: Store the distribution packages
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.11' }}
with:
name: python-package-distributions
path: dist/
provenance-and-draft-release:
name: Generate provenance and create draft release
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
needs:
- build
- upload-event-file
permissions:
actions: read
id-token: write
contents: write
# Can't pin with hash due to how this workflow works.
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
base64-subjects: ${{ needs.build.outputs.hashes }}
upload-assets: true
draft-release: true
publish-to-test-pypi:
name: Publish to TestPyPI
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
needs:
- provenance-and-draft-release
runs-on: ubuntu-latest
environment:
name: test-pypi
url: https://test.pypi.org/p/cf-ips-to-hcloud-fw
permissions:
id-token: write
steps:
- name: Harden runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
test.pypi.org:443
- name: Download all the distribution packages
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: python-package-distributions
path: dist
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@8a08d616893759ef8e1aa1f2785787c0b97e20d6 # v1.10.0
with:
repository-url: https://test.pypi.org/legacy/
publish-to-pypi:
name: Publish to PyPI
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
needs:
- provenance-and-draft-release
- publish-to-test-pypi
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/cf-ips-to-hcloud-fw
permissions:
id-token: write
steps:
- name: Harden runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
upload.pypi.org:443
- name: Download all the distribution packages
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: python-package-distributions
path: dist
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@8a08d616893759ef8e1aa1f2785787c0b97e20d6 # v1.10.0
upload-dist-to-github-release:
name: Upload distribution packages to GitHub Release
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }}
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Harden runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
uploads.github.com:443
- name: Download all the distribution packages
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: python-package-distributions
path: dist
- name: Upload distribution packages to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'