Skip to content

Switch to trusted publishing, renovate build and test env #331

Switch to trusted publishing, renovate build and test env

Switch to trusted publishing, renovate build and test env #331

Workflow file for this run

name: Build
on:
- push
- pull_request
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Lint
uses: astral-sh/ruff-action@v3
with:
args: "check"
version-file: "example/requirements.txt"
- name: Format
uses: astral-sh/ruff-action@v3
with:
args: "format --check"
version-file: "example/requirements.txt"
test:
name: Test
needs:
- linting

Check failure on line 35 in .github/workflows/workflow.yaml

View workflow run for this annotation

GitHub Actions / Build

Invalid workflow file

The workflow is not valid. .github/workflows/workflow.yaml (Line: 35, Col: 9): Job 'test' depends on unknown job 'linting'. .github/workflows/workflow.yaml (Line: 86, Col: 9): Job 'build' depends on job 'test' which creates a cycle in the dependency graph.
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
django:
- "4.2"
- "5.0"
- "5.1"
exclude:
- django: "4.2"
python-version: "3.13"
- django: "5.0"
python-version: "3.9"
- django: "5.0"
python-version: "3.13"
- django: "5.1"
python-version: "3.9"
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install Django ${{ matrix.django }}
run: pip install "Django~=${{ matrix.django }}"
- name: Install package
run: pip install -e .
- name: Run tests
run: python ./example/manage.py test
build:
name: Build package
needs:
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install pypa/build
run: python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish:
name: Publish to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/django-kafka
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download dists from artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: Sign packages and upload to GitHub releases
needs:
- publish
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download dists from artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign dists
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --notes ""
- name: Upload artifact signatures to GitHub release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh release upload "$GITHUB_REF_NAME" dist/** --repo "$GITHUB_REPOSITORY"