Skip to content

Update python-package.yml #18

Update python-package.yml

Update python-package.yml #18

Workflow file for this run

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 .[dev]
- name: pytest
run: pytest
deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [test, lint]
runs-on: ubuntu-latest
name: Upload release to PyPI
environment:
name: pypi
url: https://pypi.org/p/parserator
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
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 distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1