Skip to content

Drop io -> generic fwd dependency #127

Drop io -> generic fwd dependency

Drop io -> generic fwd dependency #127

Workflow file for this run

name: CI
on: [push, pull_request]
permissions:
contents: read
jobs:
build:
name: Build (CMake) on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
max-size: 250M
- name: Configure (CMake)
run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/.local
- name: Build
run: cmake --build build -j"$(nproc)"
- name: Install
run: cmake --install build
docker:
name: Build and push Docker image to GHCR
# Always build image; push and attest only on default branch or tags
needs: build
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
id-token: write
attestations: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
PLATFORMS: linux/amd64,linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Determine if we should push
id: should_push
run: |
should_push="${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) }}"
if [ "$should_push" = "true" ]; then
echo "push=true" >> "$GITHUB_OUTPUT"
else
echo "push=false" >> "$GITHUB_OUTPUT"
fi
- name: Compute platforms
id: platforms
run: |
if [ "${{ steps.should_push.outputs.push }}" = "true" ]; then
echo "value=${{ env.PLATFORMS }}" >> "$GITHUB_OUTPUT"
else
echo "value=linux/amd64" >> "$GITHUB_OUTPUT"
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ steps.platforms.outputs.value }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ steps.platforms.outputs.value }}
- name: Log in to the Container registry
if: ${{ steps.should_push.outputs.push == 'true' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Build Docker image (push on default branch or tags)
id: push
uses: docker/build-push-action@v6
with:
context: .
platforms: ${{ steps.buildx.outputs.platforms }}
push: ${{ steps.should_push.outputs.push == 'true' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
load: ${{ steps.should_push.outputs.push != 'true' }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
if: ${{ steps.should_push.outputs.push == 'true' }}
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true