Skip to content

ci(.github): revamp workflows and add hatch #1

ci(.github): revamp workflows and add hatch

ci(.github): revamp workflows and add hatch #1

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened]
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.7", "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:
needs: test
name: Bump version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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: Bump version
if: github.ref == 'refs/heads/main'
run: hatch run bump
- name: Local bump
if: github.ref != 'refs/heads/main'
run: hatch run local-bump
build:
needs: bump
name: Build ${{ github.ref_name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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: Build package
run: hatch build
- uses: actions/upload-artifact@v3
with:
name: dist-${{ github.ref }}
path: dist/*
if-no-files-found: error
retention-days: 7