CI #153
Workflow file for this run
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.22.3' | |
GOLANGCI_VERSION: 'v1.55.2' | |
DOCKER_BUILDX_VERSION: 'v0.8.2' | |
XPKG_ACCESS_ID: ${{ secrets.XPKG_ACCESS_ID }} | |
jobs: | |
detect-noop: | |
runs-on: ubuntu-20.04 | |
outputs: | |
noop: ${{ steps.noop.outputs.should_skip }} | |
steps: | |
- name: Detect No-op Changes | |
id: noop | |
uses: fkirc/skip-duplicate-actions@v4.0.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
paths_ignore: '["**.md", "**.png", "**.jpg"]' | |
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | |
lint: | |
runs-on: ubuntu-20.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.go.outputs.cache }} | |
key: ${{ runner.os }}-build-lint-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-build-lint- | |
- name: Cache Go Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-pkg- | |
- name: Vendor Dependencies | |
run: make vendor vendor.check | |
- name: Setup Go (again) | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: ${{ env.GOLANGCI_VERSION }} | |
skip-go-installation: true | |
check-diff: | |
runs-on: ubuntu-20.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.go.outputs.cache }} | |
key: ${{ runner.os }}-build-check-diff-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-build-check-diff- | |
- name: Cache Go Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-pkg- | |
- name: Vendor Dependencies | |
run: make vendor vendor.check | |
- name: Check Diff | |
run: make check-diff | |
unit-tests: | |
runs-on: ubuntu-20.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.go.outputs.cache }} | |
key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-build-unit-tests- | |
- name: Cache Go Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-pkg- | |
- name: Vendor Dependencies | |
run: make vendor vendor.check | |
- name: Run Unit Tests | |
run: make -j2 test | |
- name: Publish Unit Test Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: unittests | |
file: _output/tests/linux_amd64/coverage.txt | |
e2e-tests: | |
runs-on: ubuntu-20.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: ${{ env.DOCKER_BUILDX_VERSION }} | |
install: true | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.go.outputs.cache }} | |
key: ${{ runner.os }}-build-e2e-tests-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-build-e2e-tests- | |
- name: Cache Go Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-pkg- | |
- name: Vendor Dependencies | |
run: make vendor vendor.check | |
- name: Run the end-to-end tests | |
run: make e2e | |
env: | |
# We're using docker buildx, which doesn't actually load the images it | |
# builds by default. Specifying --load does so. | |
BUILD_ARGS: "--load" | |
publish-artifacts: | |
runs-on: ubuntu-20.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: ${{ env.DOCKER_BUILDX_VERSION }} | |
install: true | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.go.outputs.cache }} | |
key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-build-publish-artifacts- | |
- name: Cache Go Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-pkg- | |
- name: Vendor Dependencies | |
run: make vendor vendor.check | |
- 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: Publish Artifacts to GitHub | |
uses: actions/upload-artifact@v3 | |
with: | |
name: output | |
path: _output/** | |
- name: Login to Upbound | |
uses: docker/login-action@v2 | |
if: env.XPKG_ACCESS_ID != '' | |
with: | |
registry: xpkg.upbound.io | |
username: ${{ secrets.XPKG_ACCESS_ID }} | |
password: ${{ secrets.XPKG_TOKEN }} | |
- name: Publish Artifacts to Upbound | |
run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} | |
if: env.XPKG_ACCESS_ID != '' | |
env: | |
GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} |