Merge pull request #214 from SukiCZ/dependabot/github_actions/pypa/gh… #515
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: CI | |
| # Enable Buildkit and let compose use it to speed up image building | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| COMPOSE_DOCKER_CLI_BUILD: 1 | |
| on: | |
| pull_request: | |
| branches: [ 'master', 'main' ] | |
| push: | |
| branches: [ 'master', 'main' ] | |
| tags: | |
| - 'v*' | |
| concurrency: | |
| group: ${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| linter: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code Repository | |
| uses: actions/checkout@v6.0.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6.2.0 | |
| with: | |
| python-version: '3.12' | |
| - name: Install xmllint | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libxml2-utils | |
| - name: Run pre-commit | |
| uses: pre-commit/action@v3.0.1 | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code Repository | |
| uses: actions/checkout@v6.0.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6.2.0 | |
| with: | |
| python-version: '3.12' | |
| - name: Install tox | |
| run: pip install tox | |
| - name: Run tox | |
| run: tox | |
| - name: Upload coverage to Codecov | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| uses: codecov/codecov-action@v6.0.0 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: [linter, test] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| # Specifying a GitHub environment is optional, but strongly encouraged | |
| environment: release | |
| permissions: | |
| # IMPORTANT: this permission is mandatory for trusted publishing | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6.2.0 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build setuptools wheel twine | |
| - name: Build a binary wheel and a source tarball | |
| run: >- | |
| python -m | |
| build | |
| --sdist | |
| --wheel | |
| --outdir dist/ | |
| - name: Build and publish 📦 to PyPI | |
| uses: pypa/gh-action-pypi-publish@v1.14.0 |