This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
Workflow file for this run
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: Test & Release | |
on: | |
push: | |
branches: | |
- main | |
- 'feature/**' | |
paths: [ 'src/**.py', 'tests/**.py' ] | |
pull_request: | |
branches: | |
- main | |
- 'feature/**' | |
paths: [ 'src/**.py', 'tests/**.py' ] | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
strategy: | |
matrix: | |
python-version: [ 3.12.1 ] | |
poetry-version: [ 1.8.2 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python, Poetry, and Dependencies | |
uses: packetcoders/action-setup-cache-python-poetry@main | |
with: | |
python-version: ${{ matrix.python-version}} | |
poetry-version: ${{ matrix.poetry-version}} | |
- name: Run Tests | |
run: | | |
poetry install --only-root | |
poetry run pytest | |
outputs: | |
python-version: ${{ matrix.python-version }} | |
poetry-version: ${{ matrix.poetry-version }} | |
release: | |
name: Semantic Release | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'pull_request') | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python, Poetry, and Dependencies | |
uses: packetcoders/action-setup-cache-python-poetry@main | |
with: | |
python-version: ${{ needs.test.outputs.python-version }} | |
poetry-version: ${{ needs.test.outputs.poetry-version }} | |
- name: Python Semantic Release | |
id: release | |
uses: python-semantic-release/python-semantic-release@composite-github-action | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish GitHub Release | |
uses: python-semantic-release/upload-to-gh-release@main | |
if: ${{ steps.release.outputs.released }} == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.release.outputs.version }} |