Use self-hosted runner for merge jobs #530
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 | |
| on: | |
| merge_group: | |
| pull_request: | |
| push: | |
| tags: | |
| - "v*" | |
| concurrency: | |
| # Only cancel in-progress runs for pull_request events, this prevents cancelling workflows against main or tags | |
| # A pull_request will reuse the same group thus enabling cancelation, all others receive a unique run_id | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| name: CI | |
| # This should be the only action checked as required in the repo settings. | |
| # | |
| # This is a meta-job, here to express the conditions we require | |
| # in order to consider a CI run to be successful. | |
| if: always() | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: | |
| - test | |
| - bakery | |
| - bakery-native | |
| - release | |
| steps: | |
| - uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest-4x | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup goss | |
| uses: ./setup-goss | |
| - name: Set up Docker | |
| uses: docker/setup-docker-action@v4 | |
| with: | |
| daemon-config: | | |
| { | |
| "features": { | |
| "containerd-snapshotter": true | |
| } | |
| } | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| - name: Setup docker buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Setup ORAS CLI | |
| uses: oras-project/setup-oras@v1 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version-file: "posit-bakery/pyproject.toml" | |
| - name: Install dependencies | |
| working-directory: ./posit-bakery | |
| run: | | |
| uv sync | |
| - name: Run pytest | |
| working-directory: ./posit-bakery | |
| run: | | |
| GOSS_PATH=${GITHUB_WORKSPACE}/tools/goss \ | |
| DGOSS_PATH=${GITHUB_WORKSPACE}/tools/dgoss \ | |
| uv run pytest -n auto \ | |
| --dist loadgroup \ | |
| --cov=posit_bakery \ | |
| --cov-report=xml \ | |
| --junit-xml=results.xml \ | |
| test/ | |
| - name: Build | |
| working-directory: ./posit-bakery | |
| run: | | |
| uv build | |
| - name: Publish results | |
| if: always() | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: ./posit-bakery/results.xml | |
| bakery: | |
| name: Bakery | |
| permissions: | |
| contents: read | |
| packages: write | |
| uses: "./.github/workflows/bakery-build.yml" | |
| with: | |
| version: ${{ github.head_ref || github.ref_name }} | |
| context: "./posit-bakery/test/resources/with-macros/" | |
| dev-versions: include | |
| bakery-native: | |
| name: Bakery Native Build | |
| permissions: | |
| contents: read | |
| packages: write | |
| uses: "./.github/workflows/bakery-build-native.yml" | |
| with: | |
| version: ${{ github.head_ref || github.ref_name }} | |
| context: "./posit-bakery/test/resources/multiplatform/" | |
| dev-versions: include | |
| with-macros-clean-caches: | |
| name: Clean Caches (with-macros suite) | |
| permissions: | |
| contents: read | |
| packages: write | |
| needs: | |
| - bakery | |
| - bakery-native | |
| uses: "./.github/workflows/clean.yml" | |
| with: | |
| version: ${{ github.head_ref || github.ref_name }} | |
| context: "./posit-bakery/test/resources/with-macros/" | |
| remove-dangling-caches: true | |
| remove-caches-older-than: 14 | |
| clean-temporary-images: false # TODO: flip to true if this build starts using the native workflow | |
| multiplatform-clean-caches: | |
| name: Clean Caches (multiplatform suite) | |
| permissions: | |
| contents: read | |
| packages: write | |
| needs: | |
| - bakery | |
| - bakery-native | |
| uses: "./.github/workflows/clean.yml" | |
| with: | |
| version: ${{ github.head_ref || github.ref_name }} | |
| context: "./posit-bakery/test/resources/multiplatform/" | |
| remove-dangling-caches: true | |
| remove-caches-older-than: 14 | |
| remove-dangling-temporary-images: false | |
| remove-temporary-images-older-than: 3 | |
| release: | |
| name: Release/Snapshot | |
| if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'pull_request' || github.event_name == 'merge_group') | |
| needs: | |
| - test | |
| - bakery | |
| - bakery-native | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version-file: "posit-bakery/pyproject.toml" | |
| - name: Install dependencies | |
| working-directory: ./posit-bakery | |
| run: | | |
| uv sync | |
| - name: Build | |
| working-directory: ./posit-bakery | |
| run: | | |
| uv build | |
| - name: Upload snapshot artifacts | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bakery-snapshot-pr${{ github.event.pull_request.number }} | |
| path: ./posit-bakery/dist | |
| retention-days: 7 | |
| overwrite: true | |
| - name: Create a release draft | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create ${{ github.ref_name }} \ | |
| --draft \ | |
| --generate-notes \ | |
| --latest | |
| gh release upload ${{ github.ref_name }} \ | |
| ./posit-bakery/dist/* |