Skip to content

Commit

Permalink
Merge pull request #357 from terraform-providers/github-actions
Browse files Browse the repository at this point in the history
GitHub actions for linting and testing, drop Travis
  • Loading branch information
manicminer authored Nov 19, 2020
2 parents 63f8ab3 + 4ea0a65 commit a1114ad
Show file tree
Hide file tree
Showing 14 changed files with 213 additions and 48 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/depscheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Vendor Dependencies Check
on:
pull_request:
types: ['opened', 'synchronize']
paths:
- '**.go'
- 'vendor/**'
- '.github/workflows/**'

jobs:
depscheck:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.5'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make depscheck
23 changes: 23 additions & 0 deletions .github/workflows/golint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: GoLang Linting
on:
pull_request:
types: ['opened', 'synchronize']
paths:
- '**.go'
- 'vendor/**'
- '.github/workflows/**'

jobs:
golint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.5'
- uses: golangci/golangci-lint-action@v2
with:
version: 'v1.32'
29 changes: 29 additions & 0 deletions .github/workflows/teamcity-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: TeamCity Config Test
on:
pull_request:
types: ['opened', 'synchronize']
paths:
- '!.teamcity/components/generated/**'
- '!.teamcity/target/**'
- '.teamcity/**'
- '.github/workflows/**'

jobs:
teamcity-test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '13'
java-package: jdk
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- run: make teamcity-test
23 changes: 23 additions & 0 deletions .github/workflows/tflint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Terraform Schema Linting
on:
pull_request:
types: ['opened', 'synchronize']
paths:
- '**.go'
- 'vendor/**'
- '.github/workflows/**'

jobs:
tflint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.5'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make tflint
23 changes: 23 additions & 0 deletions .github/workflows/thirty-two-bit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: 32 Bit Build
on:
pull_request:
types: ['opened', 'synchronize']
paths:
- '**.go'
- 'vendor/**'
- '.github/workflows/**'

jobs:
compatability-32bit-test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.5'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: GOARCH=386 GOOS=linux go build -o 32bitbuild .
23 changes: 23 additions & 0 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Unit Tests
on:
pull_request:
types: ['opened', 'synchronize']
paths:
- '**.go'
- 'vendor/**'
- '.github/workflows/**'

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.5'
- run: bash scripts/gogetcookie.sh
- run: make test

22 changes: 22 additions & 0 deletions .github/workflows/website-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Website Linting
on:
pull_request:
types: ['opened', 'synchronize']
paths:
- 'website/**'
- '.github/workflows/**'

jobs:
website-lint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.5'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make website-lint
22 changes: 22 additions & 0 deletions .github/workflows/website-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Website Checks
on:
pull_request:
types: ['opened', 'synchronize']
paths:
- 'website/**'
- '.github/workflows/**'

jobs:
website-test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.14.5'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make website-test
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.13.15
1.14.5
2 changes: 2 additions & 0 deletions .teamcity/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target/
*.iml
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

18 changes: 14 additions & 4 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ tools:
GO111MODULE=off go get -u github.com/bflad/tfproviderlint/cmd/tfproviderlintx
GO111MODULE=off go get -u github.com/bflad/tfproviderdocs
GO111MODULE=off go get -u github.com/katbyte/terrafmt
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.27.0
GO111MODULE=off go get -u mvdan.cc/gofumpt
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH || $$GOPATH)/bin v1.32.0

build: fmtcheck
go install

fumpt:
@echo "==> Fixing source code with gofmt..."
# This logic should match the search logic in scripts/gofmtcheck.sh
find . -name '*.go' | grep -v vendor | xargs gofumpt -s -w

fmt:
@echo "==> Fixing source code with gofmt..."
# This logic should match the search logic in scripts/gofmtcheck.sh
Expand Down Expand Up @@ -70,7 +76,7 @@ depscheck:
test: fmtcheck
go test -i $(TEST) || exit 1
echo $(TEST) | \
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=10

testacc: fmtcheck
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azuread/version.ProviderVersion=acc"
Expand Down Expand Up @@ -107,8 +113,12 @@ endif
website-test:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
git clone https://$(WEBSITE_REPO) $$(go env GOPATH || $$GOPATH)/src/$(WEBSITE_REPO)
endif
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PROVIDER)
@$(MAKE) -C $$(go env GOPATH || $$GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PROVIDER)

teamcity-test:
@$(MAKE) -C .teamcity tools
@$(MAKE) -C .teamcity test

.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile website website-test
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ require (
github.com/hashicorp/terraform-plugin-sdk v1.6.0
)

go 1.13
go 1.14
7 changes: 7 additions & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ cloud.google.com/go/internal/trace
cloud.google.com/go/internal/version
cloud.google.com/go/storage
# github.com/Azure/azure-sdk-for-go v45.0.0+incompatible
## explicit
github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac
github.com/Azure/azure-sdk-for-go/version
# github.com/Azure/go-autorest v14.2.0+incompatible
github.com/Azure/go-autorest
# github.com/Azure/go-autorest/autorest v0.11.3
## explicit
github.com/Azure/go-autorest/autorest
github.com/Azure/go-autorest/autorest/azure
# github.com/Azure/go-autorest/autorest/adal v0.9.0
github.com/Azure/go-autorest/autorest/adal
# github.com/Azure/go-autorest/autorest/azure/cli v0.4.0
github.com/Azure/go-autorest/autorest/azure/cli
# github.com/Azure/go-autorest/autorest/date v0.3.0
## explicit
github.com/Azure/go-autorest/autorest/date
# github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/Azure/go-autorest/autorest/to
Expand Down Expand Up @@ -100,12 +103,14 @@ github.com/google/go-cmp/cmp/internal/flags
github.com/google/go-cmp/cmp/internal/function
github.com/google/go-cmp/cmp/internal/value
# github.com/google/uuid v1.1.1
## explicit
github.com/google/uuid
# github.com/googleapis/gax-go/v2 v2.0.5
github.com/googleapis/gax-go/v2
# github.com/hashicorp/errwrap v1.0.0
github.com/hashicorp/errwrap
# github.com/hashicorp/go-azure-helpers v0.12.0
## explicit
github.com/hashicorp/go-azure-helpers/authentication
github.com/hashicorp/go-azure-helpers/response
github.com/hashicorp/go-azure-helpers/sender
Expand All @@ -124,6 +129,7 @@ github.com/hashicorp/go-plugin/internal/plugin
# github.com/hashicorp/go-safetemp v1.0.0
github.com/hashicorp/go-safetemp
# github.com/hashicorp/go-uuid v1.0.1
## explicit
github.com/hashicorp/go-uuid
# github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/go-version
Expand Down Expand Up @@ -155,6 +161,7 @@ github.com/hashicorp/logutils
# github.com/hashicorp/terraform-config-inspect v0.0.0-20191115094559-17f92b0546e8
github.com/hashicorp/terraform-config-inspect/tfconfig
# github.com/hashicorp/terraform-plugin-sdk v1.6.0
## explicit
github.com/hashicorp/terraform-plugin-sdk/helper/acctest
github.com/hashicorp/terraform-plugin-sdk/helper/hashcode
github.com/hashicorp/terraform-plugin-sdk/helper/logging
Expand Down

0 comments on commit a1114ad

Please sign in to comment.