-
Notifications
You must be signed in to change notification settings - Fork 247
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 #712 from newrelic/feat/build-system-updates
feat: update the release process to prepare for repo handoff
- Loading branch information
Showing
5,014 changed files
with
297 additions
and
1,252,079 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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,40 @@ | ||
{{ if .Versions -}} | ||
{{ if .Unreleased.CommitGroups -}} | ||
<a name="unreleased"></a> | ||
## [Unreleased] | ||
|
||
{{ range .Unreleased.CommitGroups -}} | ||
### {{ .Title }} | ||
{{ range .Commits -}} | ||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ end -}} | ||
|
||
{{ range .Versions -}} | ||
<a name="{{ .Tag.Name }}"></a> | ||
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }} | ||
{{ range .CommitGroups -}} | ||
### {{ .Title }} | ||
{{ range .Commits -}} | ||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} | ||
{{ end }} | ||
{{ end -}} | ||
|
||
{{ if .NoteGroups -}} | ||
{{ range .NoteGroups -}} | ||
### {{ .Title }} | ||
{{ range .Notes }} | ||
{{ .Body }} | ||
{{ end }} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ end -}} | ||
|
||
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD | ||
{{ range .Versions -}} | ||
{{ if .Tag.Previous -}} | ||
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ end -}} |
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,39 @@ | ||
style: github | ||
template: CHANGELOG.tpl.md | ||
info: | ||
title: CHANGELOG.md | ||
repository_url: https://github.com/newrelic/terraform-provider-newrelic | ||
options: | ||
commits: | ||
filters: | ||
Type: | ||
- docs | ||
- feat | ||
- fix | ||
|
||
commit_groups: | ||
title_maps: | ||
docs: Documentation Updates | ||
feat: Features | ||
fix: Bug Fixes | ||
|
||
refs: | ||
actions: | ||
- Closes | ||
- Fixes | ||
- Resolves | ||
|
||
issues: | ||
prefix: | ||
- # | ||
|
||
header: | ||
pattern: "^(\\w*)(?:\\(([\\/\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" | ||
pattern_maps: | ||
- Type | ||
- Scope | ||
- Subject | ||
|
||
notes: | ||
keywords: | ||
- BREAKING CHANGE |
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 |
---|---|---|
|
@@ -33,5 +33,5 @@ jobs: | |
uses: actions/checkout@v2 | ||
|
||
- name: Compile | ||
run: make build | ||
run: make compile-only | ||
|
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,33 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.14 | ||
|
||
- name: Install PGP private key | ||
shell: bash | ||
env: | ||
PGP_PRIVATE_KEY: ${{ secrets.PGP_PRIVATE_KEY }} | ||
run: echo "$PGP_PRIVATE_KEY" | gpg --batch --import | ||
|
||
- name: Publish Release | ||
shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.DEV_TOOLKIT_TOKEN }} | ||
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }} | ||
run: make release-publish |
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
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 |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
.vagrant/ | ||
/pkg/ | ||
bin/ | ||
tmp/* | ||
coverage/ | ||
example.tf | ||
modules-dev/ | ||
|
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
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,44 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- freebsd | ||
- openbsd | ||
- solaris | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- '386' | ||
- arm | ||
- arm64 | ||
ignore: | ||
- goos: darwin | ||
goarch: '386' | ||
- goos: openbsd | ||
goarch: arm | ||
- goos: openbsd | ||
goarch: arm64 | ||
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: | ||
- "--batch" | ||
- "-u" | ||
- "{{ .Env.GPG_FINGERPRINT }}" | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
changelog: | ||
skip: true |
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 |
---|---|---|
@@ -1,133 +1,44 @@ | ||
PKG_NAME = newrelic | ||
TEST ?= $$(go list ./... |grep -v 'vendor') | ||
GO_PKGS := $(shell go list ./... | grep -v -e "/vendor/" -e "/example") | ||
GOFMT_FILES ?= $$(find . -name '*.go' |grep -v vendor) | ||
WEBSITE_REPO = github.com/hashicorp/terraform-website | ||
|
||
# Commands | ||
GO := go | ||
GO_LINTER := golangci-lint | ||
TF_LINTER := tfproviderlint | ||
|
||
BUILD_DIR := ./bin/ | ||
COVERAGE_DIR := ./coverage/ | ||
COVERMODE = atomic | ||
|
||
default: clean build lint tidy vet test cover-report | ||
|
||
build: | ||
############################# | ||
# Global vars | ||
############################# | ||
PROJECT_NAME := $(shell basename $(shell pwd)) | ||
PROJECT_VER ?= $(shell git describe --tags --always --dirty | sed -e '/^v/s/^v\(.*\)$$/\1/g') # Strip leading 'v' if found | ||
# Last released version (not dirty) | ||
PROJECT_VER_TAGGED ?= $(shell git describe --tags --always --abbrev=0 | sed -e '/^v/s/^v\(.*\)$$/\1/g') # Strip leading 'v' if found | ||
|
||
SRCDIR ?= . | ||
GO = go | ||
|
||
# The root module (from go.mod) | ||
PROJECT_MODULE ?= $(shell $(GO) list -m) | ||
GO_PKGS ?= $(shell $(GO) list ./... | grep -v -e "/example") | ||
|
||
############################# | ||
# Targets | ||
############################# | ||
all: build | ||
|
||
# Humans running make: | ||
build: git-hooks check-version clean lint lint-terraform test cover-report compile | ||
@echo "=== $(PROJECT_NAME) === [ build ]: installing package..." | ||
@$(GO) install | ||
|
||
clean: | ||
@echo "=== $(PKG_NAME) === [ clean ]: removing binaries and coverage file..." | ||
@$(GO) clean $(GO_PKGS) | ||
@rm -rfv $(BUILD_DIR)/* $(COVERAGE_DIR)/* | ||
|
||
lint: tools | ||
@echo "=== $(PKG_NAME) === [ lint ]: running linters..." | ||
@echo "=== $(PKG_NAME) === [ lint ]: $(GO_LINTER) ..." | ||
@$(GO_LINTER) run ./$(PKG_NAME) | ||
@echo "=== $(PKG_NAME) === [ lint ]: $(TF_LINTER) ..." | ||
@$(TF_LINTER) \ | ||
-c 1 \ | ||
-AT001 \ | ||
-AT002 \ | ||
-S001 \ | ||
-S002 \ | ||
-S003 \ | ||
-S004 \ | ||
-S005 \ | ||
-S007 \ | ||
-S008 \ | ||
-S009 \ | ||
-S010 \ | ||
-S011 \ | ||
-S012 \ | ||
-S013 \ | ||
-S014 \ | ||
-S015 \ | ||
-S016 \ | ||
-S017 \ | ||
-S019 \ | ||
./$(PKG_NAME) | ||
|
||
test: clean fmtcheck | ||
@echo "=== $(PKG_NAME) === [ test ]: running test suite..." | ||
@mkdir -p $(COVERAGE_DIR) | ||
@$(GO) test -i $(TEST) || exit 1 | ||
@for d in $(GO_PKGS); do \ | ||
pkg=`basename $$d` ;\ | ||
$(GO) test $(TESTARGS) -timeout=30s -parallel=4 -covermode=$(COVERMODE) -coverprofile $(COVERAGE_DIR)/$$pkg.tmp $$d || exit 1; \ | ||
done | ||
|
||
testacc: fmtcheck | ||
TF_ACC=1 $(GO) test $(TEST) \ | ||
-v $(TESTARGS) \ | ||
-timeout 120m \ | ||
-ldflags="-X=github.com/terraform-providers/terraform-provider-newrelic/version.ProviderVersion=acc" | ||
|
||
vet: | ||
@echo "=== $(PKG_NAME) === [ vet ]: running go vet..." | ||
@go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \ | ||
echo ""; \ | ||
echo "Vet found suspicious constructs. Please check the reported constructs"; \ | ||
echo "and fix them if necessary before submitting the code for review."; \ | ||
exit 1; \ | ||
fi | ||
|
||
fmt: | ||
@echo "=== $(PKG_NAME) === [ format ]: Running gofmt..." | ||
gofmt -w -s $(GOFMT_FILES) | ||
# Build command for CI tooling | ||
build-ci: check-version clean lint lint-terraform test compile-only | ||
|
||
tools: | ||
@echo "=== $(PKG_NAME) === [ tools ]: installing required tooling..." | ||
@GO111MODULE=on $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint | ||
@GO111MODULE=on $(GO) install github.com/bflad/tfproviderlint/cmd/tfproviderlint | ||
@GO111MODULE=on $(GO) install github.com/client9/misspell/cmd/misspell | ||
|
||
tidy: | ||
@echo "=== $(PKG_NAME) === [ tidy ]: tidying modules..." | ||
@$(GO) mod tidy | ||
|
||
fmtcheck: | ||
@echo "=== $(PKG_NAME) === [ fmtcheck ]: Checking that code complies with gofmt requirements..." | ||
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" | ||
|
||
errcheck: | ||
@sh -c "'$(CURDIR)/scripts/errcheck.sh'" | ||
|
||
test-compile: | ||
@if [ "$(TEST)" = "./..." ]; then \ | ||
echo "ERROR: Set TEST to a specific package. For example,"; \ | ||
echo " make test-compile TEST=./$(PKG_NAME)"; \ | ||
exit 1; \ | ||
fi | ||
go test -c $(TEST) $(TESTARGS) | ||
|
||
cover-report: test | ||
@echo "=== $(PKG_NAME) === [ cover-report ]: generating test coverage..." | ||
@echo 'mode: $(COVERMODE)' > $(COVERAGE_DIR)/coverage.out | ||
@cat $(COVERAGE_DIR)/*.tmp | grep -v 'mode: $(COVERMODE)' >> $(COVERAGE_DIR)/coverage.out || true | ||
@$(GO) tool cover -html=$(COVERAGE_DIR)/coverage.out -o $(COVERAGE_DIR)/coverage.html | ||
@echo "=== $(PKG_NAME) === [ cover-report ]: $(COVERAGE_DIR)coverage.html" | ||
|
||
website: | ||
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO))) | ||
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..." | ||
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO) | ||
endif | ||
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME) | ||
|
||
website-test: | ||
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO))) | ||
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..." | ||
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO) | ||
endif | ||
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME) | ||
|
||
website-lint: | ||
@echo "=== $(PKG_NAME) === [ website-lint ]: linting website..." | ||
@misspell -error -source=text website/ | ||
|
||
.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile website website-test tools lint cover-report | ||
# All clean commands | ||
clean: cover-clean compile-clean release-clean | ||
@echo "=== $(PROJECT_NAME) === [ clean ]: removing go object files..." | ||
@$(GO) clean $(GO_PKGS) | ||
|
||
# Import fragments | ||
include build/compile.mk | ||
include build/deps.mk | ||
include build/document.mk | ||
include build/lint.mk | ||
include build/release.mk | ||
include build/terraform.mk | ||
include build/test.mk | ||
include build/util.mk | ||
|
||
.PHONY: all build build-ci clean |
Oops, something went wrong.