Skip to content

Bump version

Bump version #7

Workflow file for this run

name: CI
on:
push:
branches:
- main
- release-*
tags:
- v*
pull_request: {}
env:
PYTHON_VERSION: "3.11"
HATCH_VERSION: "1.16.2"
DOCKER_BUILDX_VERSION: "v0.30.1"
XP_CHANNEL: stable
# XP_VERSION: v2.1.3 # the latest stable Crossplane CLI will be used
XPKG: xpkg.crossplane.io/${{ github.repository }}
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Hatch
run: pipx install hatch==${{ env.HATCH_VERSION }}
- name: Lint
run: hatch fmt
unit-test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Hatch
run: pipx install hatch==${{ env.HATCH_VERSION }}
- name: Run unit tests
run: hatch test --all --randomize
build:
runs-on: ubuntu-24.04
needs:
- lint
- unit-test
strategy:
fail-fast: true
matrix:
arch:
- amd64
- arm64
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Read version from Python package
run: |
echo "XPKG_VERSION=v$(python -c 'from function.__version__ import __version__; print(__version__)')" >> $GITHUB_ENV
- name: Build runtime image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/${{ matrix.arch }}
target: image
cache-from: type=gha
cache-to: type=gha,mode=max
build-args:
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
outputs: type=docker,dest=runtime-${{ matrix.arch }}.tar
- name: Install Crossplane CLI
run: |
curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh
- name: Build xpkg
run: |
./crossplane xpkg build \
--package-root=package \
--package-file=${{ matrix.arch }}.xpkg \
--embed-runtime-image-tarball=runtime-${{ matrix.arch }}.tar
- name: Upload package artifact
uses: actions/upload-artifact@v6
with:
name: package-${{ matrix.arch }}
path: "*.xpkg"
retention-days: 1
push:
if: github.event_name != 'pull_request'
runs-on: ubuntu-24.04
needs:
- build
steps:
- uses: actions/checkout@v6
- name: Download artifacts
uses: actions/download-artifact@v7
with:
path: .
merge-multiple: true
- name: Install Crossplane CLI
run: |
curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh
- name: Read version from Python package
run: |
echo "XPKG_VERSION=v$(python -c 'from function.__version__ import __version__; print(__version__)')" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push multi-arch xpkg
run: |
./crossplane --verbose xpkg push \
--package-files $(echo *.xpkg | tr ' ' ,) \
${{ env.XPKG }}:${{ env.XPKG_VERSION }}