This repository has been archived by the owner on May 12, 2024. It is now read-only.
chore: add PSR branch groups to test releases on feature branches (#541) #1253
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
commitlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: wagoid/commitlint-github-action@v5.4.4 | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
versions: | |
- python: "3.8" | |
django: "3.2" | |
- python: "3.8" | |
django: "4.0" | |
- python: "3.8" | |
django: "4.1" | |
- python: "3.8" | |
django: "4.2" | |
- python: "3.9" | |
django: "3.2" | |
- python: "3.9" | |
django: "4.0" | |
- python: "3.9" | |
django: "4.1" | |
- python: "3.9" | |
django: "4.2" | |
- python: "3.10" | |
django: "3.2" | |
- python: "3.10" | |
django: "4.0" | |
- python: "3.10" | |
django: "4.1" | |
- python: "3.10" | |
django: "4.2" | |
- python: "3.11" | |
django: "4.1" | |
- python: "3.11" | |
django: "4.2" | |
runs-on: ubuntu-latest | |
name: "Python ${{ matrix.versions.python }} - Django ${{ matrix.versions.django }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.versions.python }} | |
- uses: snok/install-poetry@v1.3.4 | |
- name: Install Dependencies | |
run: | | |
poetry install -E spellcheck | |
poetry run pip install "Django~=${{ matrix.versions.django }}.0" | |
- name: Run Tests | |
run: poetry run pytest --cov-report=xml | |
- uses: codecov/codecov-action@v3.1.4 | |
release: | |
needs: | |
- test | |
- commitlint | |
runs-on: ubuntu-latest | |
environment: release | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref || github.ref_name }} | |
# Do a dry run of PSR | |
- name: Test release | |
uses: python-semantic-release/python-semantic-release@v8.3.0 | |
if: github.ref_name != 'main' | |
with: | |
root_options: --noop | |
# On main branch: actual PSR + upload to PyPI & GitHub | |
- name: Release | |
uses: python-semantic-release/python-semantic-release@v8.3.0 | |
id: release | |
if: github.ref_name == 'main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: steps.release.outputs.released == 'true' | |
- name: Publish package distributions to GitHub Releases | |
uses: python-semantic-release/upload-to-gh-release@main | |
if: steps.release.outputs.released == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |