Skip to content

Commit

Permalink
refactor pyproject and workflows (#97)
Browse files Browse the repository at this point in the history
* refactor pyproject and workflows

* remove flake8 dependency
  • Loading branch information
Ravencentric authored Sep 18, 2024
1 parent 312e4cc commit 9a79c79
Show file tree
Hide file tree
Showing 6 changed files with 372 additions and 232 deletions.
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

34 changes: 14 additions & 20 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
Expand All @@ -17,23 +9,25 @@ permissions:

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
python -m pip install pipx
pipx install poetry
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
run: poetry build

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: poetry publish
36 changes: 17 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Tests

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

env:
TMP_EMAIL_DIR: /tmp/tmp_email_dir
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -18,37 +16,37 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
python -m poetry install --with dev
python -m pip install flake8 pytest pytest_httpx coveralls
python -m pip install pipx
pipx install poetry
poetry install --sync
sudo apt-get install libarchive-tools -y
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Start a pocketbase database instance for api testing
run: |
mkdir $TMP_EMAIL_DIR
bash ./tests/integration/pocketbase &
sleep 1
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
sleep 1
- name: Lint with ruff
run: poetry run ruff check .

- name: Test with pytest
run: |
poetry run coverage run --source=pocketbase --branch -m pytest tests/
poetry run coverage report -m
- name: Report coverage results to coveralls.io
run: |
coveralls --verbose
poetry run coveralls --verbose
Loading

0 comments on commit 9a79c79

Please sign in to comment.