Skip to content

Commit

Permalink
Add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ianpittwood committed Jan 15, 2024
1 parent d123d21 commit 7a6f5f9
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
branches:
- main
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.10
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: poetry install
- name: Build
run: poetry build
- name: Publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
strategy:
matrix:
python-version: [3.10, 3.11, 3.12]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: poetry install
- uses: actions/cache@v3
name: Cache Poetry packages
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Run tests
env:
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
run: poetry run python -m unittest discover -s tests
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.10
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: poetry install
- name: Run black
run: poetry run black --line-length=120 --target-version=py310 .
- name: Run isort
run: poetry run isort --line-length=120 --python-version=310 --profile=black --atomic .
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ isort = "^5.13.2"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[virtualenvs]
create = true
in-project = true

0 comments on commit 7a6f5f9

Please sign in to comment.