Skip to content

Commit

Permalink
Use poetry, update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nx10 committed May 21, 2024
1 parent fefe8bc commit dbfe14e
Show file tree
Hide file tree
Showing 9 changed files with 878 additions and 718 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: monthly
groups:
production-dependencies:
dependency-type: production
development-dependencies:
dependency-type: development
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
34 changes: 34 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and publish docs

permissions:
contents: write

on:
workflow_run:
workflows: [Python Tests]
types:
- completed
branches:
- main

jobs:
build-and-publish-docs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install dependencies
run: |
python -m pip install poetry
poetry install --with docs
- name: Build docs
run: |
APP_MODULE_NAME=$(ls src -U | head -1) # Get the first module name in the src directory
poetry run pdoc src/"$APP_MODULE_NAME" -o docs_build -t docs/pdoc-theme --docformat google
touch docs_build/.nojekyll
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs_build
35 changes: 35 additions & 0 deletions .github/workflows/publish-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish to PyPi

permissions:
actions: write

on:
push:
tags:
- '*'

jobs:
pypi-release:
name: PyPi Release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: poetry
- name: Install dependencies and build
run: |
poetry install
poetry build
- name: Publish to PyPi
id: pypi_publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
69 changes: 69 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Python Tests

on:
push:
branches:
- main
pull_request:

jobs:
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: poetry
- name: Install dependencies
run: |
poetry install
- name: Run tests
id: run-tests
run: >
poetry run pytest \
--junitxml=pytest.xml \
--cov-report=term-missing:skip-covered \
--cov-report=xml:coverage.xml \
--cov=src tests \
--log-level=DEBUG \
--verbose
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
cache: poetry
- name: Install dependencies
run: |
poetry install
- name: Ruff format
run: poetry run ruff format --check
- name: Ruff check
run: poetry run ruff check

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: poetry
- run: |
poetry install
poetry run mypy .
56 changes: 0 additions & 56 deletions .github/workflows/workflows.yml

This file was deleted.

Loading

0 comments on commit dbfe14e

Please sign in to comment.