Skip to content

Merge pull request #32 from KitwareMedical/feedbacks-alerts #82

Merge pull request #32 from KitwareMedical/feedbacks-alerts

Merge pull request #32 from KitwareMedical/feedbacks-alerts #82

name: Test and Release
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
# Install and run pre-commit
- run: |
pip install pre-commit
pre-commit install
pre-commit run --all-files
pytest:
name: Pytest ${{ matrix.config.name }} ${{ matrix.python-version }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
config:
- { name: "Linux", os: ubuntu-latest }
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
if: matrix.config.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
libsdl2-ttf-2.0-0 \
libsdl2-2.0-0
- name: Install and Run Tests
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
python -m pytest -s tests
release:
needs: [pre-commit, pytest]
runs-on: ubuntu-latest
if: github.event_name == 'push'
environment: release
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
contents: write # IMPORTANT: mandatory for making GitHub Releases
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}