Skip to content

test

test #132

Workflow file for this run

name: Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
issue_comment:
types:
- created
- edited
pull_request_review_comment:
types:
- created
- edited
jobs:
build:
name: Build
runs-on: ubuntu-latest
if: github.event.issue.pull_request && contains(github.event.comment.body, 'retest please')
timeout-minutes: 5
strategy:
matrix:
go-version: [ '1.20', '1.19', '1.18' ]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ matrix.go-version }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
with:
terraform_version: '1.4.*'
terraform_wrapper: false
- name: Run linters
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
with:
version: latest
args: --timeout 3m
- name: Generate
run: make generate
- name: Confirm no diff
run: |
git diff --compact-summary --exit-code || \
(echo "*** Unexpected differences after code generation. Run 'make generate' and commit."; exit 1)
- name: Build
run: make build
lint:
name: 'Terraform Provider quality gate :: Code analysis.'
needs: build
runs-on: ubuntu-latest
if: github.event.issue.pull_request && contains(github.event.comment.body, 'retest please')
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version-file: 'go.mod'
- name: Run linters
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
with:
version: latest
args: --timeout 3m
test:
name: 'Terraform Provider Acceptance Tests (OS: ${{ matrix.os }} / TF: ${{ matrix.terraform }})'
needs: lint
runs-on: ${{ matrix.os }}
if: github.event.issue.pull_request && contains(github.event.comment.body, 'retest please')
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os:
- macos-latest
#- windows-latest
#- ubuntu-latest
terraform:
- '1.0.*'
#- '1.1.*'
#- '1.2.*'
#- '1.3.*'
#- '1.4.*'
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version-file: 'go.mod'
- name: Setup Terraform ${{ matrix.terraform }}
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Run acceptance test
run: make testacc
coverage:
name: 'Terraform Provider quality gate :: unit test coverage.'
needs: test
runs-on: ubuntu-latest
if: github.event.issue.pull_request && contains(github.event.comment.body, 'retest please')
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version-file: 'go.mod'
- name: Go Coverage
uses: gwatts/[email protected]
with:
coverage-threshold: 6.7 # current (2023.08.03) state, should be increased - ideally up to at least 50% - as soon as possible
#cover-pkg: ./...
# -----------------------
# test:
# name: 'Terraform Provider Acceptance Tests (OS: ${{ matrix.os }} / TF: ${{ matrix.terraform }})'
# needs: lint
# runs-on: ${{ matrix.os }}
# timeout-minutes: 15
#
# strategy:
# fail-fast: false
# matrix:
# os:
# - macos-latest
# - windows-latest
# - ubuntu-latest
# terraform:
# - '1.0.*'
# - '1.1.*'
# - '1.2.*'
# - '1.3.*'
# - '1.4.*'
#
# steps:
# - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
# - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
# with:
# go-version-file: 'go.mod'
#
# - name: Setup Terraform ${{ matrix.terraform }}
# uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
# with:
# terraform_version: ${{ matrix.terraform }}
# terraform_wrapper: false
#
# - name: Run acceptance test
# run: make testacc
# coverage:
# name: 'Terraform Provider quality gate :: unit test coverage.'
# needs: test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
# - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
# with:
# go-version-file: 'go.mod'
# - name: Go Coverage
# uses: gwatts/[email protected]
# with:
# coverage-threshold: 6.7 # current (2023.08.03) state, should be increased - ideally up to at least 50% - as soon as possible
# #cover-pkg: ./...