Skip to content

Commit

Permalink
GitHub actions for linting and testing, drop Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Nov 19, 2020
1 parent e0d2687 commit 0e63312
Show file tree
Hide file tree
Showing 11 changed files with 204 additions and 46 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: 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

0 comments on commit 0e63312

Please sign in to comment.