1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
name: CI
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# Make sure commit messages follow the conventional commits convention:
# https://www.conventionalcommits.org
commitlint:
name: Lint Commit Messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v6.2.1
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- uses: pre-commit/action@v3.0.1
test:
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
- "3.14"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- run: uv pip install pip
- name: Test with Pytest
run: uv run pytest --log-cli-level=DEBUG -vv -s
shell: bash
build:
name: Build Package
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
activate-environment: true
- name: Build package
run: uv build
# Test semantic-release configuration on PR branches
test-release:
name: Test Semantic Release
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Git for Semantic Release Testing
run: |
# Setup a temp branch to test
git checkout -B temp-main-branch
git merge ${{ github.event.pull_request.head.sha }} --no-edit
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Test Semantic Release (No-op)
id: test-release
uses: python-semantic-release/python-semantic-release@v10.5.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
changelog: true
# Use noop mode to test without making changes
no_operation_mode: true
- name: Test Semantic Release (Dry Run)
id: test-release-dry
uses: python-semantic-release/python-semantic-release@v10.5.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
changelog: true
# Use dry run mode to test without committing
commit: false
tag: false
push: false
vcs_release: false
release:
runs-on: ubuntu-latest
needs:
- test
concurrency: release
if: github.ref == 'refs/heads/main'
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
actions: write
packages: write
environment:
name: release
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v10.5.2
with:
github_token: ${{ secrets.GH_TOKEN }}
changelog: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.13.0
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
# See https://github.com/actions/runner/issues/1173
if: steps.release.outputs.released == 'true'
with:
packages-dir: dist
print-hash: true
verbose: true
- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/publish-action@v10.5.2
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
|