From 968f775cf68888aed3d42464ffaea5428c81bdc2 Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Wed, 8 Sep 2021 21:48:02 -0400 Subject: [PATCH] update various project configs, mostly for CI --- .github/dependabot.yml | 31 +++++++++++++ .github/workflows/test.yml | 90 +++++++++++++++++++++++++++----------- .go-version | 1 + .goreleaser.yml | 51 +++++++++++---------- README.md | 2 +- 5 files changed, 122 insertions(+), 53 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .go-version diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..9d24fb90 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,31 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "gomod" + directory: "/" + ignore: + - dependency-name: "golang.org/x/tools" + - dependency-name: "google.golang.org/grpc" + schedule: + interval: "daily" + - package-ecosystem: "gomod" + directory: "/awsproviderlint" + ignore: + - dependency-name: "golang.org/x/tools" + - dependency-name: "google.golang.org/grpc" + schedule: + interval: "daily" + - package-ecosystem: "gomod" + directory: "/tools" + ignore: + - dependency-name: "golang.org/x/tools" + - dependency-name: "google.golang.org/grpc" + schedule: + interval: "daily" + - package-ecosystem: "terraform" + directory: "/infrastructure/repository" + schedule: + interval: "daily" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f57a235..d5b9ec28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,34 +1,72 @@ -name: Test changes + +# This GitHub action runs your tests for each commit push and/or PR. Optionally +# you can turn it on using a cron schedule for regular testing. +# +name: Tests on: pull_request: - branches: - - main - - master - - 'release/v*' + paths-ignore: + - 'README.md' + push: + paths-ignore: + - 'README.md' jobs: - test: - name: Pull Request - runs-on: ubuntu-20.04 + # ensure the code builds... + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 5 steps: - - - name: Checkout the code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Install and configure Go + + - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.15 - - - name: Install and configure GoReleaser + go-version: '1.16' + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go mod download + - name: Build + run: | + go build -v . + # run acceptance tests in a matrix with Terraform core versions + test: + name: Matrix Test + needs: build + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + # list whatever Terraform versions here you would like to support + terraform: + - '0.14.11' + - '0.15.5' + - '1.0.6' + steps: + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.16' + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go mod download + + - name: TF acceptance tests + timeout-minutes: 10 env: - GORELEASER_VERSION: '0.155.1' + TF_ACC: "1" + TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }} + run: | - curl -sL -o goreleaser_amd64.deb "https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_amd64.deb" - sudo dpkg -i goreleaser_amd64.deb - rm -f goreleaser_amd64.deb - - - name: Create snapshot - run: | - goreleaser build --parallelism 2 --rm-dist --snapshot --timeout 1h + go test -v -cover ./... diff --git a/.go-version b/.go-version new file mode 100644 index 00000000..15b989e3 --- /dev/null +++ b/.go-version @@ -0,0 +1 @@ +1.16.0 diff --git a/.goreleaser.yml b/.goreleaser.yml index 59cdb41b..fe1eb97f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,48 +1,47 @@ +archives: + - files: + - none* + format: zip + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' before: hooks: - - go mod tidy + - go mod download builds: - - env: - - CGO_ENABLED=0 - mod_timestamp: '{{ .CommitTimestamp }}' + - binary: '{{ .ProjectName }}_{{ .Version }}' flags: - -trimpath - ldflags: - - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' - goos: - - freebsd - - windows - - linux - - darwin goarch: - - amd64 - '386' + - amd64 - arm - arm64 + goos: + - darwin + - freebsd + - linux + - windows ignore: - - goos: darwin - goarch: '386' - binary: '{{ .ProjectName }}_v{{ .Version }}' -archives: - - format: zip - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' + - goarch: '386' + goos: darwin + ldflags: + - -s -w -X version.ProviderVersion={{.Version}} + mod_timestamp: '{{ .CommitTimestamp }}' +changelog: + skip: true checksum: name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' algorithm: sha256 +env: + - CGO_ENABLED=0 +release: + disable: true signs: - artifacts: checksum args: - "--batch" - "--local-user" - - "{{ .Env.GPG_FINGERPRINT }}" + - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key - "--output" - "${signature}" - - "--passphrase-fd" - - "0" - "--detach-sign" - "${artifact}" - stdin_file: /tmp/.gpg_passphrase -release: - draft: false -changelog: - skip: true diff --git a/README.md b/README.md index 7a8e3efd..47e3fe65 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A Terraform Provider which adds support for Proxmox solutions. ## Requirements - [Terraform](https://www.terraform.io/downloads.html) 0.13+ -- [Go](https://golang.org/doc/install) 1.15+ (to build the provider plugin) +- [Go](https://golang.org/doc/install) 1.16+ (to build the provider plugin) - [GoReleaser](https://goreleaser.com/install/) 0.155+ (to build the provider plugin) ## Table of Contents