Use native runners instead of QEMU for builder image #22
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
| # SPDX-FileCopyrightText: Copyright 2025 Stacklok, Inc. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| packages: read | |
| env: | |
| GO_VERSION: "1.25" | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Run tests (excluding CGO packages) | |
| run: | | |
| go test -v -race $(go list ./... | grep -v krun | grep -v propolis-runner) | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v7 | |
| with: | |
| args: --timeout=5m | |
| env: | |
| CGO_ENABLED: "0" | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Verify compilation (pure Go packages) | |
| run: | | |
| CGO_ENABLED=0 go build $(go list ./... | grep -v krun | grep -v propolis-runner) | |
| test-macos: | |
| name: Test (macOS) | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Run tests (excluding CGO packages) | |
| run: | | |
| go test -v -race $(go list ./... | grep -v krun | grep -v propolis-runner) | |
| lint-macos: | |
| name: Lint (macOS) | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v7 | |
| with: | |
| args: --timeout=5m | |
| env: | |
| CGO_ENABLED: "0" | |
| build-macos: | |
| name: Build (macOS) | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Verify compilation (pure Go packages) | |
| run: | | |
| CGO_ENABLED=0 go build $(go list ./... | grep -v krun | grep -v propolis-runner) | |
| - name: Install libkrun | |
| run: | | |
| brew tap slp/krun | |
| brew install libkrun libkrunfw | |
| - name: Build CGO packages | |
| run: | | |
| CGO_ENABLED=1 go build ./krun/... | |
| - name: Build runner binary | |
| run: | | |
| CGO_ENABLED=1 go build -ldflags "-X github.com/stacklok/propolis/internal/version.Version=ci" -o bin/propolis-runner ./runner/cmd/propolis-runner | |
| - name: Sign runner with entitlements | |
| run: | | |
| codesign --entitlements assets/entitlements.plist --force -s - bin/propolis-runner | |
| build-cgo: | |
| name: Build (Linux CGO) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Read builder image version | |
| id: versions | |
| run: | | |
| source versions.env | |
| echo "LIBKRUN_VERSION=${LIBKRUN_VERSION}" >> "$GITHUB_OUTPUT" | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull builder image | |
| run: | | |
| docker pull ghcr.io/stacklok/propolis-builder:${{ steps.versions.outputs.LIBKRUN_VERSION }} | |
| - name: Build CGO packages | |
| run: | | |
| docker run --rm -v "${{ github.workspace }}:/src:z" -w /src \ | |
| -e CGO_ENABLED=1 \ | |
| ghcr.io/stacklok/propolis-builder:${{ steps.versions.outputs.LIBKRUN_VERSION }} \ | |
| go build ./krun/... | |
| - name: Build runner binary | |
| run: | | |
| docker run --rm -v "${{ github.workspace }}:/src:z" -w /src \ | |
| -e CGO_ENABLED=1 \ | |
| ghcr.io/stacklok/propolis-builder:${{ steps.versions.outputs.LIBKRUN_VERSION }} \ | |
| go build -ldflags "-X github.com/stacklok/propolis/internal/version.Version=ci" \ | |
| -o bin/propolis-runner ./runner/cmd/propolis-runner |