From 1159e2de73571c82aef10fc98b6b21156849be9d Mon Sep 17 00:00:00 2001 From: Manuel Vogel Date: Thu, 18 Mar 2021 15:21:49 +0100 Subject: [PATCH] feat: support darwin arm builds and golang 1.16 (#140) * chore: bump to golang 1.16 * fix(ci): remove fail fast from non-matrix builds * chore: rename release workflow from yml to yaml * fix: use goreleaser for compile tests * fix(make): use gorelease in compile target * fix(ci): add gpg import step for compile --- .github/workflows/acc-test.yaml | 4 +-- .github/workflows/compile.yaml | 22 +++++++++----- .../workflows/{release.yml => release.yaml} | 2 +- .github/workflows/unit-test.yaml | 6 ++-- .github/workflows/website-lint.yaml | 6 ++-- .go-version | 2 +- GNUmakefile | 2 +- go.mod | 2 +- scripts/compile.sh | 30 ------------------- 9 files changed, 25 insertions(+), 51 deletions(-) rename .github/workflows/{release.yml => release.yaml} (98%) delete mode 100755 scripts/compile.sh diff --git a/.github/workflows/acc-test.yaml b/.github/workflows/acc-test.yaml index 9932f510..c62503f7 100644 --- a/.github/workflows/acc-test.yaml +++ b/.github/workflows/acc-test.yaml @@ -13,7 +13,7 @@ on: - '.github/workflows/**' env: - GO_VERSION: "1.15" + GO_VERSION: "1.16" GOPROXY: https://gocenter.io,https://proxy.golang.org,direct DEBIAN_FRONTEND: noninteractive @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '1.15' + go-version: '1.16' - run: cat /etc/issue - run: bash scripts/gogetcookie.sh # locally: docker run -it ubuntu-20.04 bash (https://ubuntu.pkgs.org/20.04/docker-ce-stable-amd64/) diff --git a/.github/workflows/compile.yaml b/.github/workflows/compile.yaml index f2f983fa..63461005 100644 --- a/.github/workflows/compile.yaml +++ b/.github/workflows/compile.yaml @@ -13,20 +13,28 @@ on: - '.github/workflows/**' env: - GO_VERSION: "1.15" + GO_VERSION: "1.16" GOPROXY: https://gocenter.io,https://proxy.golang.org,direct jobs: compile: runs-on: ubuntu-20.04 - strategy: - fail-fast: true steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '1.15' - - run: cat /etc/issue - - run: bash scripts/gogetcookie.sh - - run: make compile + go-version: '1.16' + - name: Import GPG key + id: import_gpg + uses: paultyng/ghaction-import-gpg@v2.1.0 + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + PASSPHRASE: ${{ secrets.PASSPHRASE }} + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist --skip-publish --snapshot + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yaml similarity index 98% rename from .github/workflows/release.yml rename to .github/workflows/release.yaml index f03295e1..fdce4d27 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yaml @@ -25,7 +25,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.15 + go-version: 1.16 - name: Import GPG key id: import_gpg uses: paultyng/ghaction-import-gpg@v2.1.0 diff --git a/.github/workflows/unit-test.yaml b/.github/workflows/unit-test.yaml index 4871bc10..c60e140a 100644 --- a/.github/workflows/unit-test.yaml +++ b/.github/workflows/unit-test.yaml @@ -13,19 +13,17 @@ on: - '.github/workflows/**' env: - GO_VERSION: "1.15" + GO_VERSION: "1.16" GOPROXY: https://gocenter.io,https://proxy.golang.org,direct jobs: unit-test: runs-on: ubuntu-20.04 - strategy: - fail-fast: true steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '1.15' + go-version: '1.16' - run: cat /etc/issue - run: bash scripts/gogetcookie.sh - run: make vet diff --git a/.github/workflows/website-lint.yaml b/.github/workflows/website-lint.yaml index b112856f..ae2c05a0 100644 --- a/.github/workflows/website-lint.yaml +++ b/.github/workflows/website-lint.yaml @@ -12,19 +12,17 @@ on: - website/docs/** env: - GO_VERSION: "1.15" + GO_VERSION: "1.16" GOPROXY: https://gocenter.io,https://proxy.golang.org,direct jobs: website-lint-spellcheck-tffmt: runs-on: ubuntu-20.04 - strategy: - fail-fast: true steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '1.15' + go-version: '1.16' - run: cat /etc/issue - run: bash scripts/gogetcookie.sh # locally: docker run -it ubuntu-20.04 bash (https://ubuntu.pkgs.org/20.04/docker-ce-stable-amd64/) diff --git a/.go-version b/.go-version index 42cf0675..4a02d2c3 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.15.2 +1.16.2 diff --git a/GNUmakefile b/GNUmakefile index b3836ad1..72aab413 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -34,7 +34,7 @@ testacc_cleanup: fmtcheck @sh -c "'$(CURDIR)/scripts/testacc_cleanup.sh'" compile: fmtcheck - @sh -c "'$(CURDIR)/scripts/compile.sh'" + @sh -c "curl -sL https://git.io/goreleaser | bash -s -- --rm-dist --skip-publish --snapshot" vet: @echo "go vet ." diff --git a/go.mod b/go.mod index 988419ec..19a08a32 100644 --- a/go.mod +++ b/go.mod @@ -18,4 +18,4 @@ require ( gotest.tools/v3 v3.0.3 // indirect ) -go 1.15 +go 1.16 diff --git a/scripts/compile.sh b/scripts/compile.sh deleted file mode 100755 index f63b67fa..00000000 --- a/scripts/compile.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -set -e -# Prerequisites -if ! command -v gox > /dev/null; then - GO111MODULE=off go get -u github.com/mitchellh/gox -fi - -# setup environment -PROVIDER_NAME="docker" -TARGET_DIR="$(pwd)/results" -XC_ARCH=${XC_ARCH:-"386 amd64 arm"} -XC_OS=${XC_OS:=linux darwin windows openbsd solaris} -XC_EXCLUDE_OSARCH="!darwin/arm !darwin/386 !solaris/amd64" -LD_FLAGS="-s -w" -export CGO_ENABLED=0 - -rm -rf "${TARGET_DIR}" -mkdir -p "${TARGET_DIR}" - -# Compile -gox \ - -os="${XC_OS}" \ - -arch="${XC_ARCH}" \ - -osarch="${XC_EXCLUDE_OSARCH}" \ - -ldflags "${LD_FLAGS}" \ - -output "$TARGET_DIR/{{.OS}}_{{.Arch}}/terraform-provider-${PROVIDER_NAME}_v0.0.0_x4" \ - -verbose \ - -rebuild \ - .