Skip to content

changes needed for 2.6.1, also new data sources and tests #163

changes needed for 2.6.1, also new data sources and tests

changes needed for 2.6.1, also new data sources and tests #163

Workflow file for this run

# Terraform Provider testing workflow.
name: Tests
# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
pull_request:
branches: ["main"]
paths-ignore:
- "README.md"
push:
branches: ["main"]
paths-ignore:
- "README.md"
# Testing only needs permissions to read the repository contents.
permissions:
contents: read
# Default values to simplify job configurations below.
env:
# Go language version to use for building. This value should also be updated
# in the release workflow if changed.
GO_VERSION: "1.19"
jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
- run: go mod download
- run: go build -v .
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
- run: go generate ./...
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Terraform Provider Acceptance Tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# list whatever Terraform versions here you would like to support
terraform:
# - "1.0.*"
# - "1.1.*"
# - "1.3.*"
- "1.4.*"
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- uses: actions/checkout@v3
- run: go mod download
- env:
# for the time being, only do unit tests, below needs to be changed
# to secrets when used with the tunnel.sh script.
# TF_ACC: "0"
NGROK_URL: ${{ secrets.NGROK_URL }}
run: |
echo "setting env vars"
echo "TF_VAR_address=https://localhost" >>$GITHUB_ENV
if [ -n "$NGROK_URL" ]; then
echo "TF_ACC=1" >> $GITHUB_ENV
echo "TF_VAR_address=${NGROK_URL}" >> $GITHUB_ENV
fi
- env:
TF_VAR_username: ${{ secrets.USERNAME }}
TF_VAR_password: ${{ secrets.PASSWORD }}
run: go test -timeout 600s -race -v -covermode atomic -coverprofile=covprofile ./internal/...
timeout-minutes: 20
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=covprofile -service=github