Chore: add golangci-lint (linter) support #2240
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
env: | |
ENV0_API_ENDPOINT: ${{ secrets.ENV0_API_ENDPOINT }} | |
ENV0_API_KEY: ${{ secrets.TF_PROVIDER_INTEGRATION_TEST_API_KEY }} # API Key for organization 'TF-provider-integration-tests' @ dev | |
ENV0_API_SECRET: ${{ secrets.TF_PROVIDER_INTEGRATION_TEST_API_SECRET }} | |
GO_VERSION: "1.21" | |
TERRAFORM_VERSION: 1.1.7 | |
jobs: | |
unit-tests: | |
name: Unit Tests | |
timeout-minutes: 10 | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Generate mocks | |
run: | | |
go install go.uber.org/mock/mockgen@v0.3.0 | |
go generate client/api_client.go | |
- name: Go fmt | |
run: | | |
! go fmt ./... | read | |
- name: Go vet | |
run: | | |
! go vet ./... | read | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.60 | |
- name: Go Test | |
run: go test -v ./... | |
# See terraform-provider-env0 README for integration tests prerequisites | |
integration-tests: | |
name: Integration Tests | |
runs-on: ubuntu-20.04 | |
container: golang:1.21-alpine3.18 | |
timeout-minutes: 20 | |
steps: | |
- name: Install Terraform | |
run: apk add terraform | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run Harness tests | |
run: go run tests/harness.go |