name: CI on: push: branches: [main, master] pull_request: branches: [main, master] jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip pip install flake8 black - name: Lint with flake8 run: | flake8 . - name: Format with black run: | black --check . test: runs-on: ubuntu-latest needs: lint steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e ".[dev]" - name: Run tests run: | pytest -v --cov=.{% raw %}{{ project_slug }}{% endraw %} --cov-report=xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: files: ./coverage.xml fail_ci_if_error: false build: runs-on: ubuntu-latest needs: test steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install build run: | python -m pip install --upgrade pip pip install build - name: Build package run: | python -m build - name: Publish to PyPI if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: pypa/gh-action-pypi-publish@release/v1 with: password: {% raw %}${{ secrets.PYPI_API_TOKEN }}{% endraw %}