This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
forked from hashicorp/terraform-provider-random
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ContentSquare/feat/github-actions
feat: github actions
- Loading branch information
Showing
3 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
name: goreleaser | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15 | ||
- name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@v3 | ||
with: | ||
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 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# 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: [ master ] | ||
paths-ignore: | ||
- 'README.md' | ||
- 'CHANGELOG.md' | ||
- '.gitignore' | ||
- 'website/*' | ||
push: | ||
branches: [ master ] | ||
paths-ignore: | ||
- 'README.md' | ||
- 'CHANGELOG.md' | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
|
||
- name: Set up Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: '1.15' | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/[email protected] | ||
|
||
- name: Get dependencies | ||
env: | ||
GO111MODULE: on | ||
GOFLAGS: -mod=vendor | ||
run: | | ||
go mod download | ||
- name: Build | ||
env: | ||
GO111MODULE: on | ||
GOFLAGS: -mod=vendor | ||
run: | | ||
make build | ||
# 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.12.30' | ||
- '0.13.6' | ||
- '0.14.5' | ||
steps: | ||
- name: Set up Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: '1.15' | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/[email protected] | ||
|
||
- name: TF tests | ||
env: | ||
GO111MODULE: on | ||
GOFLAGS: -mod=vendor | ||
run: | | ||
make test | ||
- name: TF acceptance tests | ||
timeout-minutes: 10 | ||
env: | ||
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }} | ||
run: | | ||
make testacc | ||
- name: Go VET | ||
env: | ||
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }} | ||
run: | | ||
make vet |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Visit https://goreleaser.com for documentation on how to customize this | ||
# behavior. | ||
before: | ||
hooks: | ||
# this is just an example and not a requirement for provider building/publishing | ||
- go mod tidy | ||
builds: | ||
- env: | ||
# goreleaser does not work with CGO, it could also complicate | ||
# usage by users in CI/CD systems like Terraform Cloud where | ||
# they are unable to install libraries. | ||
- CGO_ENABLED=0 | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' | ||
goos: | ||
- freebsd | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- '386' | ||
- arm | ||
- arm64 | ||
ignore: | ||
- goos: darwin | ||
goarch: '386' | ||
binary: '{{ .ProjectName }}_v{{ .Version }}' | ||
archives: | ||
- format: zip | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' | ||
checksum: | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' | ||
algorithm: sha256 | ||
signs: | ||
- artifacts: checksum | ||
args: | ||
# if you are using this is a GitHub action or some other automated pipeline, you | ||
# need to pass the batch flag to indicate its not interactive. | ||
- "--batch" | ||
- "--local-user" | ||
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
release: | ||
# Visit your project's GitHub Releases page to publish this release. | ||
# draft: true | ||
changelog: | ||
skip: false |