Skip to content

Update retrieval of Package Manager dev versions #337

Update retrieval of Package Manager dev versions

Update retrieval of Package Manager dev versions #337

Workflow file for this run

name: CI
on:
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
steps:
- name: Checkout
uses: actions/checkout@v5
- 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: Install poetry
working-directory: ./posit-bakery
run: |
pipx install poetry
- name: Setup python
uses: actions/setup-python@v5
with:
python-version-file: "posit-bakery/pyproject.toml"
cache: "poetry"
- name : Install dependencies
working-directory: ./posit-bakery
run: |
poetry install
- name: Run pytest
working-directory: ./posit-bakery
run: |
GOSS_PATH=${GITHUB_WORKSPACE}/tools/goss \
DGOSS_PATH=${GITHUB_WORKSPACE}/tools/dgoss \
poetry run pytest -n auto \
--dist loadgroup \
--cov=posit_bakery \
--cov-report=xml \
--junit-xml=results.xml \
test/
- name: Build
working-directory: ./posit-bakery
run: |
poetry 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')
needs:
- test
- bakery
- bakery-native
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Install poetry
run: |
pipx install poetry
pipx inject poetry "poetry-dynamic-versioning[plugin]"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "posit-bakery/pyproject.toml"
cache: "poetry"
- name: Install dependencies
working-directory: ./posit-bakery
run: |
poetry install
- name: Build
working-directory: ./posit-bakery
run: |
poetry 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/*