From 5af9139b9f28caaf3ae87a6dc6ee71958e5d89b1 Mon Sep 17 00:00:00 2001 From: Tom Goodsell Date: Thu, 3 Feb 2022 19:47:25 -0600 Subject: [PATCH 1/4] chore: remove the make reqs for the checks, to make cleaner to use in CI --- GNUmakefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 8e77476a6..a8b4d6094 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -39,7 +39,7 @@ test: fmtcheck testacc: fmtcheck TF_ACC=1 go test $(TEST) -v $(TESTARGS) $(TEST_FILTER) -timeout 120m -vet: tools +vet: @echo "==> Checking source code against go vet and staticcheck" @go vet ./... @staticcheck ./... @@ -48,7 +48,7 @@ fmt: tools # Format the code @echo "formatting the code with $(GOFMT)..." @$(GOFMT) -l -w . -fmtcheck: dep +fmtcheck: @gofumpt -d -l . errcheck: @@ -62,7 +62,7 @@ test-compile: fi go test -c $(TEST) $(TESTARGS) -lint: tools +lint: @echo "==> Checking source code against linters..." @$(TFPROVIDERLINT) \ -c 1 \ From 826e184601af1c3907bba8c218b9776aa95cd46a Mon Sep 17 00:00:00 2001 From: Tom Goodsell Date: Thu, 3 Feb 2022 20:00:29 -0600 Subject: [PATCH 2/4] chore: add CI job for basic code checking on PRs & master branch --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ GNUmakefile | 4 ++-- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..2313257dc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2.4.0 + - + name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + - + name: Setup Go Tools + run: make tools + - + name: Check Formatting + run: make fmtcheck + - + name: Vet Code + run: make vet + - + name: Lint Code + run: make lint + - + name: Check Build + run: make build + - + name: Test + run: make test diff --git a/GNUmakefile b/GNUmakefile index a8b4d6094..8c7b88328 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -31,12 +31,12 @@ sweep: @echo "WARNING: This will destroy infrastructure. Use only in development accounts." go test $(TEST) -v -sweep=$(SWEEP) $(SWEEPARGS) -test: fmtcheck +test: go test -i $(TEST) || exit 1 echo $(TEST) | \ xargs -t -n4 go test $(TESTARGS) $(TEST_FILTER) -timeout=30s -parallel=4 -testacc: fmtcheck +testacc: TF_ACC=1 go test $(TEST) -v $(TESTARGS) $(TEST_FILTER) -timeout 120m vet: From 0cdddcf85f547c9f22cde131ddba3e8e4e1fc54f Mon Sep 17 00:00:00 2001 From: Tom Goodsell Date: Fri, 4 Feb 2022 09:34:06 -0800 Subject: [PATCH 3/4] chore: fix step formatting --- .github/workflows/ci.yml | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2313257dc..5c2c6cb9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,29 +8,21 @@ jobs: build: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v2.4.0 - - - name: Setup Go + - name: Setup Go uses: actions/setup-go@v2 with: go-version: 1.17 - - - name: Setup Go Tools - run: make tools - - - name: Check Formatting - run: make fmtcheck - - - name: Vet Code - run: make vet - - - name: Lint Code - run: make lint - - - name: Check Build - run: make build - - - name: Test - run: make test + - name: Setup Go Tools + run: make tools + - name: Check Formatting + run: make fmtcheck + - name: Vet Code + run: make vet + - name: Lint Code + run: make lint + - name: Check Build + run: make build + - name: Test + run: make test From 44d31ab41c87b5ace8fc57af45df9a96dea8c9d5 Mon Sep 17 00:00:00 2001 From: Tom Goodsell Date: Fri, 4 Feb 2022 09:38:00 -0800 Subject: [PATCH 4/4] chore: more formatting nicecities --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c2c6cb9d..c463ea01c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,20 +9,27 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v2 + - name: Setup Go uses: actions/setup-go@v2 with: go-version: 1.17 + - name: Setup Go Tools run: make tools + - name: Check Formatting run: make fmtcheck + - name: Vet Code run: make vet + - name: Lint Code run: make lint + - name: Check Build run: make build + - name: Test run: make test