diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85143a2cce..cd2d105177 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,20 @@ name: GitHub Actions CI -on: [push, pull_request] +on: + push: + branches: [main] + 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 - run: make website-lint + - run: make build + - 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/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 diff --git a/GNUmakefile b/GNUmakefile index c336bcbf9f..264516aa1c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,11 +6,11 @@ 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 + 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 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