ci: add publish workflow #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- dev | |
jobs: | |
linting: | |
name: "Linting and formatting checks" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11"] | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "actions/setup-python@v4" | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- name: "Install dependencies" | |
run: | | |
python -m pip install --upgrade pip poetry | |
poetry install | |
- name: "Run pyupgrade" | |
run: | | |
poetry run pre-commit run pyupgrade --all-files | |
- name: "Run black" | |
run: | | |
poetry run pre-commit run black --all-files | |
- name: "Run ruff" | |
uses: chartboost/ruff-action@v1 | |
tests: | |
name: "Python ${{ matrix.python-version}} on ${{ matrix.os }}" | |
needs: linting | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "actions/setup-python@v4" | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- name: "Install dependencies" | |
run: | | |
python -m pip install --upgrade pip poetry | |
poetry install | |
- name: "Run tests" | |
run: | | |
poetry run pytest --cov pydiscovergy --cov-report xml | |
- name: "Upload coverage to Codecov" | |
uses: "codecov/codecov-action@v3" | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} |