Skip to content

Commit

Permalink
add skip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-swinkler committed Oct 25, 2023
1 parent 5167f02 commit 949af08
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 61 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/acc-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Run secret-dependent integration tests only after /ok-to-test approval
on:
pull_request:
branches: [ main ]
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
name: acceptance

jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: ./go.mod
cache: false
- name: Install dependencies
run: make tools
- name: Create and populate .snowflake/config file
run: mkdir $HOME/.snowflake && echo "${{ secrets.SNOWFLAKE_CONFIG_FILE }}" > $HOME/.snowflake/config
- run: make testacc
env:
SKIP_EMAIL_INTEGRATION_TESTS=true
SKIP_EXTERNAL_TABLE_TEST=true
SKIP_NOTIFICATION_INTEGRATION_TESTS=true
SKIP_SAML_INTEGRATION_TESTS=true
SKIP_STREAM_TEST=true
2 changes: 1 addition & 1 deletion .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:

jobs:
generate:
name: generate
name: docs and copywrite check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/reviewdog-golanglint-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: reviewdog-golangci-lint
name: golangci-lint
on:
push:
branches:
Expand All @@ -11,8 +11,8 @@ permissions:
# pull-requests: read

jobs:
lint:
name: lint
reviewdog:
name: reviewdog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/reviewdog-staticcheck.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: reviewdog-staticcheck
name: staticcheck
on: [pull_request]
jobs:
staticcheck:
name: staticcheck
reviewdog:
name: reviewdog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ on:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
name: test
name: unit

jobs:
test:
unit:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -21,4 +22,3 @@ jobs:
- name: Create and populate .snowflake/config file
run: mkdir $HOME/.snowflake && echo "${{ secrets.SNOWFLAKE_CONFIG_FILE }}" > $HOME/.snowflake/config
- run: make test
- run: make testacc
100 changes: 49 additions & 51 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,87 +1,73 @@

default: install

help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-23s\033[0m %s\n", $$1, $$2}'

build:
go build -v ./...

install: build
go install -v ./...

mod: ## add missing and remove unused modules
go mod tidy -compat=1.20
.PHONY: mod

mod-check: mod ## check if there are any missing/unused modules
git diff --exit-code -- go.mod go.sum
.PHONY: mod-check

# See https://golangci-lint.run/
lint:
golangci-lint run ./... -v
clean-generator-poc:
rm -f ./internal/sdk/poc/example/*_gen.go
rm -f ./internal/sdk/poc/example/*_gen_test.go

lint-fix: ## Run static code analysis, check formatting and try to fix findings
golangci-lint run ./... -v --fix
.PHONY: lint-fix
clean-generator-%: ## Clean generated files for specified resource
rm -f ./internal/sdk/$**_gen.go
rm -f ./internal/sdk/$**_gen_*test.go

pre-push: fmt lint mod docs ## Run a few checks before pushing a change (docs, fmt, mod, etc.)
docs:
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate

pre-push-check: docs-check lint-check mod-check; ## Run a few checks before pushing a change (docs, fmt, mod, etc.)
.PHONY: pre-push
docs-check: docs ## check that docs have been generated
git diff --exit-code -- docs
.PHONY: docs-check

fmt: ## Run gofumpt
@echo "==> Fixing source code with gofumpt..."
gofumpt -l -w .

fumpt: fmt

test:
go test -v -cover -timeout=30m -parallel=4 ./...

testacc:
TF_ACC=1 go test -v -cover -timeout 30m -parallel=4 ./...

docs:
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate

docs-check: docs ## check that docs have been generated
git diff --exit-code -- docs
.PHONY: docs-check

# Generate docs, terraform fmt the examples folder, and create copywrite headers
generate:
cd tools && go generate ./...

tools:
cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint
cd tools && go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
cd tools && go install github.com/hashicorp/copywrite
cd tools && go install mvdan.cc/gofumpt

generate-all-dto: ## Generate all DTOs for SDK interfaces
go generate ./internal/sdk/*_dto.go

generate-dto-%: ./internal/sdk/%_dto.go ## Generate DTO for given SDK interface
go generate $<

help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-23s\033[0m %s\n", $$1, $$2}'

install: build
go install -v ./...

# See https://golangci-lint.run/
lint:
golangci-lint run ./... -v

lint-fix: ## Run static code analysis, check formatting and try to fix findings
golangci-lint run ./... -v --fix

mod: ## add missing and remove unused modules
go mod tidy -compat=1.20

mod-check: mod ## check if there are any missing/unused modules
git diff --exit-code -- go.mod go.sum

pre-push: fmt lint mod docs ## Run a few checks before pushing a change (docs, fmt, mod, etc.)

pre-push-check: docs-check lint-check mod-check; ## Run a few checks before pushing a change (docs, fmt, mod, etc.)
.PHONY: pre-push


run-generator-poc:
go generate ./internal/sdk/poc/example/*_def.go
go generate ./internal/sdk/poc/example/*_dto_gen.go

clean-generator-poc:
rm -f ./internal/sdk/poc/example/*_gen.go
rm -f ./internal/sdk/poc/example/*_gen_test.go

run-generator-%: ./internal/sdk/%_def.go ## Run go generate on given object definition
go generate $<
go generate ./internal/sdk/$*_dto_gen.go

clean-generator-%: ## Clean generated files for specified resource
rm -f ./internal/sdk/$**_gen.go
rm -f ./internal/sdk/$**_gen_*test.go

sweep: ## destroy the whole architecture; USE ONLY FOR DEVELOPMENT ACCOUNTS
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
@echo "Are you sure? [y/n]" >&2
Expand All @@ -91,4 +77,16 @@ sweep: ## destroy the whole architecture; USE ONLY FOR DEVELOPMENT ACCOUNTS
else echo "Aborting..."; \
fi;

.PHONY: build install lint generate fmt test testacc tools docs sweep
test:
go test -v -cover -timeout=30m -parallel=4 ./...

testacc:
TF_ACC=1 go test -v -cover -timeout 30m -parallel=4 `go list ./... | grep -v internal/sdk`

tools:
cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint
cd tools && go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
cd tools && go install github.com/hashicorp/copywrite
cd tools && go install mvdan.cc/gofumpt

.PHONY: build clean-generator-poc clean-generator-% docs docs-check fmt fumpt generate generate-all-dto generate-dto-% help install lint lint-fix mod mod-check pre-push pre-push-check run-generator-poc run-generator-% sweep test testacc tools

0 comments on commit 949af08

Please sign in to comment.