diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..c463ea01c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + 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 diff --git a/GNUmakefile b/GNUmakefile index 8e77476a6..8c7b88328 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -31,15 +31,15 @@ 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: 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 \