Bumping up terraform provider version to v0.22.0. (#38) #120
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: | |
inputs: | |
tag: | |
description: 'Semver release tag (e.g. v0.1.0)' | |
required: true | |
env: | |
# Common versions | |
GO_VERSION: '1.22' | |
GOLANGCI_VERSION: 'v1.54.0' | |
DOCKER_BUILDX_VERSION: 'v0.8.2' | |
# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a | |
# step 'if env.XXX != ""', so we copy these to succinctly test whether | |
# credentials have been provided before trying to run steps that need them. | |
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@v5.3.1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
paths_ignore: '["**.md", "**.png", "**.jpg"]' | |
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | |
lint: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "::set-output name=cache::$(make go.cachedir)" | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v2 | |
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@v2 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-pkg- | |
- name: Vendor Dependencies | |
run: make vendor vendor.check | |
# We could run 'make lint' 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@v3 | |
with: | |
version: ${{ env.GOLANGCI_VERSION }} | |
check-diff: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install goimports | |
run: go install golang.org/x/tools/cmd/goimports | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "::set-output name=cache::$(make go.cachedir)" | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v2 | |
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@v2 | |
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-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "::set-output name=cache::$(make go.cachedir)" | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v2 | |
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@v2 | |
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@v1 | |
with: | |
flags: unittests | |
file: _output/tests/linux_amd64/coverage.txt | |
integration-tests: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "::set-output name=cache::$(make go.cachedir)" | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v2 | |
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@v2 | |
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 Integration Tests | |
run: make -j2 test-integration | |
local-deploy: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "::set-output name=cache::$(make go.cachedir)" | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v2 | |
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@v2 | |
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: Deploying locally built provider package | |
run: make local-deploy | |
release-vars: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' && github.event.inputs.tag != '' | |
steps: | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
make_latest: true | |
tag_name: ${{ github.event.inputs.tag }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
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@v1 | |
with: | |
platforms: all | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
with: | |
version: ${{ env.DOCKER_BUILDX_VERSION }} | |
install: true | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Find the Go Build Cache | |
id: go | |
run: echo "::set-output name=cache::$(make go.cachedir)" | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v2 | |
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@v2 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-pkg- | |
- name: Vendor Dependencies | |
run: make vendor vendor.check | |
# The xpkg will only be indexed on Upbound Marketplace | |
# if version is a semver tag. Set a tag via workflow dispatch | |
# to publish a formal release. VERSION is picked up by the | |
# Build Artifacts and Publish Artifacts to Upbound Marketplace steps. | |
- name: Set release version | |
if: needs.detect-noop.outputs.noop != 'true' && github.event.inputs.tag != '' | |
run: echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV | |
- 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@v4 | |
with: | |
name: output | |
path: _output/** | |
- name: Login to Upbound | |
uses: docker/login-action@v1 | |
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 to Upbound Marketplace | |
run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} | |
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != '' | |
env: | |
GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Trigger docs.crd.dev index | |
if: needs.detect-noop.outputs.noop != 'true' && github.event.inputs.tag != '' | |
run: | | |
curl -v https://doc.crds.dev/github.com/crossplane-contrib/provider-palette@${{ github.event.inputs.tag }} | |
echo "Triggered docs.crd.dev to index provider-palette@${{ github.event.inputs.tag }}" |