Skip to content

Commit 96e7ebd

Browse files
authored
Feature/cleanup travis scripts (#21)
1 parent 4d7dc55 commit 96e7ebd

File tree

14 files changed

+36
-498
lines changed

14 files changed

+36
-498
lines changed

.circleci/config.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Exclude unnecessary files from Docker build context
22
.git
33
.gitignore
4-
.travis.yml
54
.github
65
*.md
76
*.sh

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ jobs:
224224
env:
225225
GOFLAGS: -mod=vendor
226226
TF_ACC: 1
227-
GOTOOLCHAIN: auto
228227
run: |
229228
export PATH="${{ github.workspace }}/bin:$PATH"
230229
echo "Running ${{ matrix.db_type }} ${{ matrix.db_version }} tests using Makefile target: ${{ matrix.make_target }}"

.testcontainers-build-flags.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

Makefile

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ test-sequential: acceptance
9090
# Run testcontainers tests with a matrix of all database versions
9191
# Usage: make testcontainers-matrix TESTARGS="TestAccUser"
9292
testcontainers-matrix: fmtcheck bin/terraform ## Run test matrix across all database versions
93-
@cd $(CURDIR) && PATH="$(CURDIR)/bin:${PATH}" PARALLEL=4 GOTOOLCHAIN=auto TF_ACC=1 go run scripts/test-runner.go $(if $(TESTARGS),$(TESTARGS),WithTestcontainers)
93+
@cd $(CURDIR) && PATH="$(CURDIR)/bin:${PATH}" PARALLEL=4 TF_ACC=1 go run scripts/test-runner.go $(if $(TESTARGS),$(TESTARGS),WithTestcontainers)
9494

9595
# Run testcontainers tests for a specific database image
9696
# Usage: make testcontainers-image DOCKER_IMAGE=mysql:8.0
9797
# make testcontainers-image DOCKER_IMAGE=tidb:8.5.3
9898
testcontainers-image: fmtcheck bin/terraform ## Run tests for a specific database image (set DOCKER_IMAGE)
99-
@PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers $(TEST) -v $(TESTARGS) -timeout=15m
99+
@PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers $(TEST) -v $(TESTARGS) -timeout=15m
100100

101101
bin/terraform: ## Download Terraform binary
102102
mkdir -p "$(CURDIR)/bin"
@@ -124,13 +124,13 @@ testversion%: ## Run tests against MySQL version (e.g., testversion8.0) [backwar
124124
docker rmi mysql:$* 2>/dev/null || true; \
125125
docker manifest rm mysql:$* 2>/dev/null || true; \
126126
docker pull --platform linux/amd64 mysql:$* 2>&1 | grep -v "no match" || true; \
127-
DOCKER_DEFAULT_PLATFORM=linux/amd64 DOCKER_IMAGE=mysql:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m; \
127+
DOCKER_DEFAULT_PLATFORM=linux/amd64 DOCKER_IMAGE=mysql:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m; \
128128
else \
129-
DOCKER_IMAGE=mysql:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m; \
129+
DOCKER_IMAGE=mysql:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m; \
130130
fi
131131

132132
testversion: ## Run tests against MySQL version (set MYSQL_VERSION)
133-
@DOCKER_IMAGE=mysql:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
133+
@DOCKER_IMAGE=mysql:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
134134

135135
# Percona test targets - use testcontainers
136136
# Preferred format: test-percona-VERSION (e.g., test-percona-8.0)
@@ -145,10 +145,10 @@ testpercona%: ## Run tests against Percona version (e.g., testpercona8.0) [backw
145145
docker manifest rm percona:$* 2>/dev/null || true; \
146146
docker pull --platform linux/amd64 percona:$* || true; \
147147
fi
148-
@DOCKER_IMAGE=percona:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
148+
@DOCKER_IMAGE=percona:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
149149

150150
testpercona: ## Run tests against Percona version (set MYSQL_VERSION)
151-
@DOCKER_IMAGE=percona:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
151+
@DOCKER_IMAGE=percona:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
152152

153153
testrdsdb%: ## Run tests against RDS MySQL version (requires MYSQL_ENDPOINT env vars)
154154
$(MAKE) MYSQL_VERSION=$* MYSQL_USERNAME=${MYSQL_USERNAME} MYSQL_HOST=$(shell echo ${MYSQL_ENDPOINT} | cut -d: -f1) MYSQL_PASSWORD=${MYSQL_PASSWORD} MYSQL_PORT=$(shell echo ${MYSQL_ENDPOINT} | cut -d: -f2) testrdsdb
@@ -164,21 +164,21 @@ test-tidb-%: ## Run tests against TiDB version (e.g., test-tidb-8.5.3)
164164
@$(MAKE) testtidb$*
165165

166166
testtidb%: ## Run tests against TiDB version (e.g., testtidb8.5.3) [backwards compatible]
167-
@DOCKER_IMAGE=tidb:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
167+
@DOCKER_IMAGE=tidb:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
168168

169169
testtidb: ## Run tests against TiDB version (set MYSQL_VERSION)
170-
@DOCKER_IMAGE=tidb:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
170+
@DOCKER_IMAGE=tidb:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
171171

172172
# MariaDB test targets - use testcontainers
173173
# Preferred format: test-mariadb-VERSION (e.g., test-mariadb-10.10)
174174
test-mariadb-%: ## Run tests against MariaDB version (e.g., test-mariadb-10.10)
175175
@$(MAKE) testmariadb$*
176176

177177
testmariadb%: ## Run tests against MariaDB version (e.g., testmariadb10.10) [backwards compatible]
178-
@DOCKER_IMAGE=mariadb:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
178+
@DOCKER_IMAGE=mariadb:$* PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
179179

180180
testmariadb: ## Run tests against MariaDB version (set MYSQL_VERSION)
181-
@DOCKER_IMAGE=mariadb:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 GOTOOLCHAIN=auto go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
181+
@DOCKER_IMAGE=mariadb:$(MYSQL_VERSION) PATH="$(CURDIR)/bin:${PATH}" TF_ACC=1 go test -tags=testcontainers ./mysql/... -v $(if $(TESTARGS),-run "$(TESTARGS)",) -timeout=30m
182182

183183
vet: ## Run go vet
184184
@echo "go vet ."
@@ -197,10 +197,32 @@ deps: ## Update dependencies and vendor
197197
go mod vendor
198198

199199
fmtcheck: ## Check Go code formatting
200-
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
200+
@echo "==> Checking that code complies with gofmt requirements..."
201+
@gofmt_files=$$(gofmt -l `find . -name '*.go' | grep -v vendor`); \
202+
if [ -n "$$gofmt_files" ]; then \
203+
echo 'gofmt needs running on the following files:'; \
204+
echo "$$gofmt_files"; \
205+
echo "You can use the command: \`make fmt\` to reformat code."; \
206+
exit 1; \
207+
fi
201208

202209
errcheck: ## Run errcheck
203-
@sh -c "'$(CURDIR)/scripts/errcheck.sh'"
210+
@echo "==> Checking for unchecked errors..."
211+
@if ! which errcheck > /dev/null; then \
212+
echo "==> Installing errcheck..."; \
213+
go install github.com/kisielk/errcheck@latest; \
214+
fi
215+
@err_files=$$(errcheck -ignoretests \
216+
-ignore 'github.com/hashicorp/terraform/helper/schema:Set' \
217+
-ignore 'bytes:.*' \
218+
-ignore 'io:Close|Write' \
219+
$$(go list ./... | grep -v /vendor/)); \
220+
if [ -n "$$err_files" ]; then \
221+
echo 'Unchecked errors found in the following places:'; \
222+
echo "$$err_files"; \
223+
echo "Please handle returned errors. You can check directly with \`make errcheck\`"; \
224+
exit 1; \
225+
fi
204226

205227
vendor-status: ## Show vendor status
206228
@govendor status

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ I incorporated changes by winebarrel/terraform-provider-mysql. Because I found
202202
out about that repo only after some work, PR cannot be created easily now.
203203
Feel free to create a PR with my code to their repo or the other way around.
204204
205-
[![Build Status](https://www.travis-ci.com/petoju/terraform-provider-mysql.svg?branch=master)](https://www.travis-ci.com/petoju/terraform-provider-mysql)
206205
207206
Terraform Provider
208207
==================

scripts/changelog-links.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

scripts/errcheck.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

scripts/gofmtcheck.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)