[pre-commit.ci] auto fixes from pre-commit.com hooks #1545
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, workflow_dispatch] | |
jobs: | |
tests: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
# - "3.12" | |
# Service containers to run | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # fetch all history | |
- name: Apt update | |
run: sudo apt-get update | |
- name: Apt install | |
run: sudo apt-get install -y libxmlsec1-dev | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Pin python-version ${{ matrix.python-version }} | |
run: uv python pin ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: uv sync | |
- name: Tests | |
run: uv run pytest | |
- name: Changelog | |
if: ${{ !contains(github.event.head_commit.author, 'renovate') }} | |
run: PYTHONPATH=build-support/bin uv run build changelog check | |
# - name: Upload coverage to CodeCov | |
# uses: codecov/codecov-action@v1 | |
# with: | |
# directory: ${{ matrix.app-name }}/coverage/ | |
# flags: ${{ matrix.app-name }} | |
release: | |
needs: tests | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
# extract the app name out of the tag's ref value | |
- id: get-app-name | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const appName = context.ref.match(/refs\/tags\/([a-z\-]+)\/v\S+$/)[1] | |
core.setOutput('app-name', appName) | |
core.setOutput('app-package', appName.replace("mitol-django-", "").replace(/-/g, "_")) | |
- name: Build | |
run: PYTHONPATH=build-support/bin uv build "src/${{steps.get-app-name.outputs.app-package}}" | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |