Skip to content

tidying up

tidying up #9

name: Test and Publish Python Package
on: [push, pull_request]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[dev]
- name: flake8
run: flake8 parserator
- name: isort
if: always()
run: isort --check-only .
- name: black
if: always()
run: black . --check
test:
timeout-minutes: 40
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e .
- name: Install test dependencies
run: pip install -r requirements.txt
- name: pytest
run: pytest
- name: Code Coverage
uses: codecov/codecov-action@v4
env:
OS: ${{ matrix.os }}
PYTHON: '3.12'
with:
env_vars: OS,PYTHON
deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [test, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- 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 }}