From e0059e8be6d7ef1f6fda519d6538e971697719a7 Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Mon, 24 Jan 2022 16:45:41 -0800 Subject: [PATCH 1/6] Initial commit of small CI cleanup --- .github/workflows/ci.yml | 4 +--- .gitignore | 1 + GNUmakefile | 4 ++-- tools.go | 1 + 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85143a2cce..9ec2d402b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,13 +5,11 @@ on: [push, pull_request] jobs: ci: runs-on: ubuntu-latest - env: - GOFLAGS: "-mod=vendor" steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '1.13' + go-version: '1.17.6' - run: make tools - run: make lint - run: make test diff --git a/.gitignore b/.gitignore index ec2e74137b..a95e5c0672 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ website/node_modules *.iml *.tfvars .vscode/ +testdata/ website/vendor diff --git a/GNUmakefile b/GNUmakefile index c336bcbf9f..477668d4fc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,8 +6,8 @@ PKG_NAME=github default: build tools: - GO111MODULE=on go install github.com/client9/misspell/cmd/misspell - GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint + go install github.com/client9/misspell/cmd/misspell + go install github.com/golangci/golangci-lint/cmd/golangci-lint build: fmtcheck go install diff --git a/tools.go b/tools.go index ea88daa189..59e025a855 100644 --- a/tools.go +++ b/tools.go @@ -1,3 +1,4 @@ +//go:build tools // +build tools package main From 4ea761384c95c94977c68425e1ff588a1436c19f Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Mon, 24 Jan 2022 16:59:27 -0800 Subject: [PATCH 2/6] CONTRIBUTING.md tweaks --- CONTRIBUTING.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e89ae47014..67648975e0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -156,13 +156,7 @@ $ $GOPATH/bin/terraform-provider-github ... ``` -In order to test the provider, you can simply run `make test`. - -```sh -$ make test -``` - -In order to run the full suite of Acceptance tests, run `make testacc`. +In order to run the full suite of provider acceptance tests, run `make testacc`. *Note:* Acceptance tests create real resources, and often cost money to run. @@ -201,6 +195,8 @@ export GITHUB_TEST_USER_TOKEN= See [this project](https://github.com/terraformtesting/acceptance-tests) for more information on how tests are run automatically. +There are also a small amount of unit tests in the provider. Due to the nature of the provider, such tests are currently only recommended for exercising functionality completely internal to the provider. These may be executed by running `make test`. + ### GitHub Personal Access Token You will need to create a [personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) for From 9ce67c94634b5f7d4434558472f44443d4af594b Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Mon, 24 Jan 2022 16:59:53 -0800 Subject: [PATCH 3/6] Run fmtcheck in CI --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ec2d402b7..c0c40aa6c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,5 +12,6 @@ jobs: go-version: '1.17.6' - run: make tools - run: make lint - - run: make test - run: make website-lint + - run: make fmtcheck + - run: make test From 068bae7b9072a709d8a27cc3456d98cb21c95e8f Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Mon, 24 Jan 2022 17:00:12 -0800 Subject: [PATCH 4/6] Build actually builds; test actually tests --- GNUmakefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 477668d4fc..264516aa1c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -10,7 +10,7 @@ tools: go install github.com/golangci/golangci-lint/cmd/golangci-lint build: fmtcheck - go install + go build ./... fmt: @echo "==> Fixing source code with gofmt..." @@ -23,7 +23,8 @@ lint: @echo "==> Checking source code against linters..." golangci-lint run ./... -test: fmtcheck +test: + go test ./... # commenting this out for release tooling, please run testacc instead testacc: fmtcheck From faf48abf3cf24ef6f740ab27c5a32812f535964c Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Mon, 24 Jan 2022 17:04:21 -0800 Subject: [PATCH 5/6] Limit push builds to main branch only --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0c40aa6c3..43d0b8df0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,9 @@ name: GitHub Actions CI -on: [push, pull_request] +on: + push: + branches: [main] + pull_request: {} jobs: ci: From e4773c9113b6495a9eaf32e00e09d83fddc26fb5 Mon Sep 17 00:00:00 2001 From: Keegan Campbell Date: Wed, 26 Jan 2022 13:14:54 -0800 Subject: [PATCH 6/6] Run make build in CI checks --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43d0b8df0c..cd2d105177 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,5 +16,5 @@ jobs: - run: make tools - run: make lint - run: make website-lint - - run: make fmtcheck + - run: make build - run: make test