CI/CD - test pushing tag #36
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: CI/CD | |
| # Workflow triggers: Pushes to master, any tag, or pull requests to master | |
| on: | |
| push: | |
| branches: ["master"] | |
| tags: ["*"] | |
| pull_request: | |
| branches: ["master"] | |
| # Ensure only one workflow run per ref, canceling in-progress runs | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Lint job: Runs linters, skipped on tag pushes | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: "3.13" | |
| enable-cache: true | |
| - run: uv sync --frozen --group lint | |
| # Test job: Runs tests in parallel across multiple Python versions, skipped on tag pushes | |
| test: | |
| runs-on: ubuntu-24.04 | |
| needs: lint | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [ "3.9", "3.12", "3.13" ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| - run: uv sync --frozen --group lint --group test | |
| - run: uv run pytest -q | |
| # Build job: Builds the project, skipped on non-tag pushes | |
| build: | |
| runs-on: ubuntu-24.04 | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: "3.13" | |
| enable-cache: true | |
| - run: uv sync --frozen | |
| - run: uv build | |
| - uses: actions/upload-artifact@v4 | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| with: | |
| name: dist | |
| path: dist | |
| # Docs job: Builds documentation, skipped on tag pushes | |
| docs: | |
| runs-on: ubuntu-24.04 | |
| needs: lint | |
| if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: "3.13" | |
| enable-cache: true | |
| - run: uv sync --frozen --group docs | |
| - run: uv run mkdocs build --config-file mkdocs.yaml | |
| working-directory: .config | |
| # Release job: Creates GitHub release, runs only on tag pushes | |
| release: | |
| runs-on: ubuntu-24.04 | |
| needs: build | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: asimov-platform/release-action@v2 | |
| with: | |
| app_id: ${{ secrets.APP_ID }} | |
| app_private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
| changelog-path: CHANGES.md | |
| compute-checksum: false | |
| # Publish job: Publishes to PyPI, runs only on tag pushes | |
| publish: | |
| runs-on: ubuntu-24.04 | |
| needs: release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist | |
| continue-on-error: true | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: "3.13" | |
| enable-cache: true | |
| - env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| run: echo "Hello world" | |
| # run: uv publish --token $UV_PUBLISH_TOKEN dist/* | |
| working-directory: . | |