Merge pull request #23 from crossplane/renovate/debian-bookworm-slim #41
This file contains 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: | |
push: | |
branches: | |
- main | |
- release-* | |
pull_request: {} | |
workflow_dispatch: {} | |
env: | |
# Common versions | |
GO_VERSION: '1.21.0' | |
GOLANGCI_VERSION: 'v1.54.1' | |
DOCKER_BUILDX_VERSION: 'v0.10.0' | |
UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} | |
jobs: | |
detect-noop: | |
runs-on: ubuntu-22.04 | |
outputs: | |
noop: ${{ steps.noop.outputs.should_skip }} | |
steps: | |
- name: Detect No-op Changes | |
id: noop | |
uses: fkirc/skip-duplicate-actions@12aca0a884f6137d619d6a8a09fcc3406ced5281 # v5.3.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
paths_ignore: '["**.md", "**.png", "**.jpg"]' | |
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | |
concurrent_skipping: false | |
lint: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
with: | |
submodules: true | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
# We could run 'make lint' to ensure our desired Go version, but we prefer | |
# this action because it leaves 'annotations' (i.e. it comments on PRs to | |
# point out linter violations). | |
- name: Lint | |
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3 | |
with: | |
version: ${{ env.GOLANGCI_VERSION }} | |
skip-go-installation: true | |
args: --timeout 3m | |
check-diff: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
with: | |
submodules: true | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Check Diff | |
run: make check-diff | |
build: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build Go Artifacts | |
run: | | |
make build.code.platform PLATFORM=linux_amd64 | |
make build.code.platform PLATFORM=linux_arm64 | |
unit-tests: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run Unit Tests | |
run: make test | |
- name: Publish Unit Test Coverage | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3 | |
with: | |
flags: unittests | |
file: _output/tests/linux_amd64/coverage.txt | |
publish-artifacts: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2 | |
with: | |
platforms: all | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2 | |
with: | |
version: ${{ env.DOCKER_BUILDX_VERSION }} | |
install: true | |
- name: Checkout | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build Artifacts | |
run: make -j2 build.all | |
env: | |
# We're using docker buildx, which doesn't actually load the images it | |
# builds by default. Specifying --load does so. | |
BUILD_ARGS: "--load" | |
- name: Login to Upbound | |
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 | |
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != '' | |
with: | |
registry: xpkg.upbound.io | |
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} | |
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }} | |
- name: Publish Artifacts | |
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != '' | |
run: make publish BRANCH_NAME=${GITHUB_REF##*/} |