API - minor refactoring #1603
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: | |
| push: | |
| paths: [ | |
| 'fittrackee/**', | |
| 'e2e/**', | |
| 'pyproject.toml', | |
| 'poetry.lock', | |
| 'VERSION', | |
| '.github/workflows/.tests-and-publish-python.yml', | |
| '.github/workflows/.e2e-tests.yml', | |
| '!fittrackee/dist/**' | |
| ] | |
| pull_request: | |
| paths: [ | |
| 'fittrackee/**', | |
| 'e2e/**', | |
| 'pyproject.toml', | |
| 'poetry.lock', | |
| 'VERSION', | |
| '.github/workflows/.tests-and-publish-python.yml', | |
| '.github/workflows/.e2e-tests.yml', | |
| '!fittrackee/dist/**' | |
| ] | |
| types: [opened, synchronize, reopened] | |
| env: | |
| GITHUB_REGISTRY: ghcr.io | |
| GITHUB_IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| python: | |
| if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }} | |
| name: python ${{ matrix.python-version }} (postgis 17-3.5) | |
| uses: ./.github/workflows/.workflow-python.yml | |
| strategy: | |
| matrix: | |
| python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] | |
| with: | |
| ubuntu-version: "ubuntu-latest" | |
| python-version: ${{ matrix.python-version }} | |
| postgis-version: "17-3.5" | |
| with-additional-check: true | |
| with-coverage: true | |
| postgis: | |
| if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }} | |
| name: postgis ${{ matrix.postgis-version }} (python 3.10) | |
| uses: ./.github/workflows/.workflow-python.yml | |
| strategy: | |
| matrix: | |
| postgis-version: [ "14-3.5", "15-3.5", "16-3.5", "17-3.4", "17-3.6", "18-3.6" ] | |
| with: | |
| ubuntu-version: "ubuntu-latest" | |
| python-version: "3.10" | |
| postgis-version: ${{ matrix.postgis-version }} | |
| with-additional-check: false | |
| with-coverage: false | |
| arm: | |
| if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }} | |
| name: postgis 17-3.5 on arm platform (python 3.13) | |
| uses: ./.github/workflows/.workflow-python.yml | |
| with: | |
| ubuntu-version: "ubuntu-24.04-arm" | |
| python-version: "3.13" | |
| postgis-version: "17-3.5" | |
| with-additional-check: false | |
| with-coverage: false | |
| end2end_with_sources: | |
| if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }} | |
| name: e2e tests with sources (Node 20) | |
| needs: ["python"] | |
| uses: ./.github/workflows/.workflow-e2e-with-sources.yml | |
| build_package: | |
| needs: ["python"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Use Node.js 24.x | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24.x | |
| - name: Install yarn and dependencies | |
| working-directory: fittrackee_client | |
| run: | | |
| npm install --global yarn | |
| yarn install --frozen-lockfile --ignore-scripts | |
| - name: Build dist files | |
| working-directory: fittrackee_client | |
| run: yarn build | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.13 | |
| - name: Install poetry | |
| run: >- | |
| python3 -m | |
| pip install | |
| poetry | |
| --user | |
| - name: Build a binary wheel and a source tarball | |
| run: poetry build | |
| - name: Store the distribution packages | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| retention-days: 5 | |
| end2end_package: | |
| if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }} | |
| name: e2e tests with package | |
| needs: ["build_package"] | |
| uses: ./.github/workflows/.workflow-e2e.yml | |
| end2end_package_update: | |
| if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }} | |
| name: e2e tests after FitTrackee update | |
| needs: ["build_package"] | |
| uses: ./.github/workflows/.workflow-e2e.yml | |
| with: | |
| previous-version: true | |
| publish-to-pypi: | |
| if: github.repository == 'SamR1/FitTrackee' && startsWith(github.ref, 'refs/tags/v') | |
| name: Publish Python distribution to PyPI | |
| needs: ["postgis", "arm", "end2end_with_sources", "end2end_package", "end2end_package_update"] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/fittrackee | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| github-release: | |
| if: github.repository == 'SamR1/FitTrackee' && startsWith(github.ref, 'refs/tags/v') | |
| name: Upload distribution to GitHub Release | |
| needs: ["publish-to-pypi"] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Sign the dists with Sigstore | |
| uses: sigstore/gh-action-sigstore-python@v3.0.0 | |
| with: | |
| inputs: >- | |
| ./dist/*.tar.gz | |
| ./dist/*.whl | |
| - name: Create GitHub draft release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: >- | |
| gh release create | |
| "$GITHUB_REF_NAME" | |
| --repo "$GITHUB_REPOSITORY" | |
| --draft | |
| --notes "wip" | |
| - name: Upload artifact signatures to GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: >- | |
| gh release upload | |
| "$GITHUB_REF_NAME" dist/** | |
| --repo "$GITHUB_REPOSITORY" | |
| push_to_registries: | |
| if: github.repository == 'SamR1/FitTrackee' && startsWith(github.ref, 'refs/tags/v') | |
| name: Push Docker image to multiple registries | |
| needs: ["postgis", "arm", "end2end_with_sources", "end2end_package", "end2end_package_update"] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.GITHUB_REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| fittrackee/fittrackee | |
| ${{ env.GITHUB_REGISTRY }}/${{ env.GITHUB_IMAGE_NAME}} | |
| tags: | | |
| type=pep440,pattern={{version}},prefix=v | |
| - name: Build and push Docker images | |
| id: push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-name: ${{ env.GITHUB_REGISTRY }}/${{ env.GITHUB_IMAGE_NAME}} | |
| subject-digest: ${{ steps.push.outputs.digest }} | |
| push-to-registry: true |