Release 0.6.4 #48
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: CI | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
jobs: | |
test: | |
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Hatch | |
run: pip install --upgrade hatch | |
- name: Run tests and track code coverage | |
run: hatch run test:cov | |
# TODO: Enforce quality, security and style checks. | |
bump_and_build: | |
needs: test | |
name: Bump and Build version [${{ github.head_ref || github.ref_name }}] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT }} | |
- run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade hatch | |
- name: Generate SLUG | |
id: generate_slug | |
run: | | |
if [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then | |
SLUG="release" | |
else | |
SLUG=$(echo "$BRANCH_NAME" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z) | |
fi | |
echo "SLUG=$SLUG" >> $GITHUB_OUTPUT | |
# Bump for PRs with local a PEP440 version | |
- name: Local bump | |
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/main' | |
run: hatch run local-bump $(hatch version)+${{ steps.generate_slug.outputs.SLUG }} | |
continue-on-error: true | |
# Bump for PRs with a dev a PEP440 version | |
- name: Dev bump | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, 'bump:') | |
run: hatch run dev-bump $GITHUB_RUN_NUMBER && git push --follow-tags && echo "Bumped to dev version $(hatch version)" | |
continue-on-error: true | |
- name: Release bump | |
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' | |
run: hatch run beta-bump && git push --follow-tags && echo "Bumped versions $(hatch version)" | |
- name: Build package | |
run: hatch build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: "dist-${{ steps.generate_slug.outputs.SLUG }}" | |
path: dist/* | |
if-no-files-found: error | |
retention-days: 7 |