Typecheck with mypy, lint and format with ruff #38
Workflow file for this run
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: pypi-publish | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
version: [3.7, 3.12] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.version }} | |
- name: Install dependencies | |
run: | | |
pip install -e .[dev] | |
- name: Lint | |
run: ruff check | |
- name: Format check | |
run: ruff format --check | |
- name: Type check | |
run: mypy | |
- name: Test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }} | |
run: | | |
pytest | |
publish: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
pip install -e . | |
- name: Build package | |
run: | | |
pip install --upgrade build | |
python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |