|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.head_ref || github.run_id }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + - uses: actions/setup-python@v4 |
| 19 | + with: |
| 20 | + python-version: "3.9" |
| 21 | + - uses: pre-commit/[email protected] |
| 22 | + |
| 23 | + # Make sure commit messages follow the conventional commits convention: |
| 24 | + # https://www.conventionalcommits.org |
| 25 | + commitlint: |
| 26 | + name: Lint Commit Messages |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v3 |
| 30 | + with: |
| 31 | + fetch-depth: 0 |
| 32 | + |
| 33 | + |
| 34 | + test: |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + python-version: |
| 39 | + - "3.8" |
| 40 | + - "3.9" |
| 41 | + - "3.10" |
| 42 | + - "3.11" |
| 43 | + os: |
| 44 | + - ubuntu-latest |
| 45 | + # - windows-latest |
| 46 | + # - macOS-latest |
| 47 | + runs-on: ${{ matrix.os }} |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v3 |
| 50 | + - name: Set up Python |
| 51 | + uses: actions/setup-python@v4 |
| 52 | + with: |
| 53 | + python-version: ${{ matrix.python-version }} |
| 54 | + |
| 55 | + - name: Install Dependencies |
| 56 | + run: poetry install |
| 57 | + shell: bash |
| 58 | + - name: Test with Pytest |
| 59 | + run: poetry run pytest --cov-report=xml |
| 60 | + shell: bash |
| 61 | + - name: Upload coverage to Codecov |
| 62 | + uses: codecov/codecov-action@v3 |
| 63 | + with: |
| 64 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 65 | + |
| 66 | + release: |
| 67 | + runs-on: ubuntu-latest |
| 68 | + environment: release |
| 69 | + if: github.ref == 'refs/heads/main' |
| 70 | + needs: |
| 71 | + - test |
| 72 | + - lint |
| 73 | + - commitlint |
| 74 | + |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v3 |
| 77 | + with: |
| 78 | + fetch-depth: 0 |
| 79 | + |
| 80 | + # Run semantic release: |
| 81 | + # - Update CHANGELOG.md |
| 82 | + # - Update version in code |
| 83 | + # - Create git tag |
| 84 | + # - Create GitHub release |
| 85 | + # - Publish to PyPI |
| 86 | + - name: Python Semantic Release |
| 87 | + |
| 88 | + with: |
| 89 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + pypi_token: ${{ secrets.PYPI_TOKEN }} |
0 commit comments