ci: use official codecov action #69
Workflow file for this run
This file contains hidden or 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: Python CI | |
| on: | |
| pull_request: | |
| branches: [ main, master ] | |
| push: | |
| branches: [ main, master ] | |
| release: | |
| types: [ released ] | |
| workflow_dispatch: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| name: Lint | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install tox | |
| run: pipx install tox | |
| - name: Run linters | |
| run: tox -e lint | |
| test: | |
| name: Python ${{ matrix.python-version }} (${{ matrix.platform }}) | |
| needs: lint | |
| runs-on: ${{ matrix.platform }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - python-version: "3.10" | |
| platform: ubuntu-latest | |
| toxenv: py310 | |
| - python-version: "3.11" | |
| platform: ubuntu-latest | |
| toxenv: py311 | |
| - python-version: "3.12" | |
| platform: ubuntu-latest | |
| toxenv: py312 | |
| - python-version: "3.13" | |
| platform: ubuntu-latest | |
| toxenv: py313 | |
| - python-version: "3.14" | |
| platform: ubuntu-latest | |
| toxenv: py314 | |
| - python-version: "3.14" | |
| platform: macos-latest | |
| toxenv: py314 | |
| - python-version: "3.14" | |
| platform: windows-latest | |
| toxenv: py314 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: echo "PIPX_DEFAULT_PYTHON=$(which python)" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: pipx run tox -e ${{ matrix.toxenv }} | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Run release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| pipx run 'python-semantic-release~=10.0' -v version --no-changelog | |
| pipx run 'python-semantic-release~=10.0' -v publish | |
| - name: Upload to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| run: | | |
| shopt -s nullglob | |
| files=(dist/*) | |
| if [[ ${#files[@]} -gt 0 ]]; then | |
| echo "Uploading ${#files[@]} files to PyPI..." | |
| pipx run twine upload --skip-existing "${files[@]}" | |
| else | |
| echo "No distribution files found. Skipping upload." | |
| fi |