Skip to content

Tests

Tests #3026

Workflow file for this run

# This GitHub action runs your tests for each commit push and/or PR. Optionally
# you can turn it on using a cron schedule for regular testing.
#
name: Tests
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 * * * *'
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'
jobs:
# ensure the code builds...
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.18'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: |
go mod download
- name: Build
run: |
go build -v .
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.18'
- 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 core versions
test:
name: Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 100
concurrency: acctests-${{ github.event_name }}
strategy:
max-parallel: 1
fail-fast: true
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '0.13.*'
- '0.14.*'
- '0.15.*'
- '1.0.*'
- '1.1.*'
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.18'
id: go
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: |
go mod download
- name: Build CLI
run: |
cd cmd
go build -o inext -v .
- name: TF acceptance tests push
if: ${{ github.event_name == 'push' }}
timeout-minutes: 20
env:
INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_PUSH }}
INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_PUSH }}
TF_ACC: "1"
run: |
cmd/inext discard
go test --timeout 20m -v -cover ./internal/resources/tests/
cmd/inext discard
- name: TF acceptance tests pull request
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 20
env:
INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_PR }}
INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_PR }}
TF_ACC: "1"
run: |
cmd/inext discard
go test --timeout 20m -v -cover ./internal/resources/tests/
cmd/inext discard
# - name: TF acceptance tests schedule
# if: ${{ github.event_name == 'schedule' }}
# timeout-minutes: 20
# env:
# INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_SCHEDULE }}
# INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_SCHEDULE }}
# TF_ACC: "1"
# run: |
# cmd/inext discard
# go test --timeout 20m -v -cover ./internal/resources/tests/
# cmd/inext discard
test-dev:
name: Test Dev
needs: build
environment:
name: Dev
url: https://q.portal.checkpoint.com
runs-on: ubuntu-latest
timeout-minutes: 100
concurrency: acctests-${{ github.event_name }}-dev
strategy:
max-parallel: 1
fail-fast: true
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '0.13.*'
- '0.14.*'
- '0.15.*'
- '1.0.*'
- '1.1.*'
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.18'
id: go
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: |
go mod download
- name: Build CLI
run: |
cd cmd
go build -o inext -v .
- name: TF acceptance tests push
if: ${{ github.event_name == 'push' }}
timeout-minutes: 20
env:
INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_PUSH }}
INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_PUSH }}
INEXT_REGION: dev
TF_ACC: "1"
run: |
cmd/inext discard
go test --timeout 20m -v -cover ./internal/resources/tests/
cmd/inext discard
- name: TF acceptance tests pull request
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 20
env:
INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_PR }}
INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_PR }}
INEXT_REGION: dev
TF_ACC: "1"
run: |
cmd/inext discard
go test --timeout 20m -v -cover ./internal/resources/tests/
cmd/inext discard
- name: TF acceptance tests schedule
if: ${{ github.event_name == 'schedule' }}
timeout-minutes: 20
env:
INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_SCHEDULE }}
INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_SCHEDULE }}
INEXT_REGION: dev
TF_ACC: "1"
run: |
cmd/inext discard
go test --timeout 20m -v -cover ./internal/resources/tests/
cmd/inext discard
test-preprod:
name: Test PreProd
needs: build
environment:
name: PreProd
url: https://q.portal.checkpoint.com
runs-on: ubuntu-latest
timeout-minutes: 100
concurrency: acctests-${{ github.event_name }}-preprod
strategy:
max-parallel: 1
fail-fast: true
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '0.13.*'
- '0.14.*'
- '0.15.*'
- '1.0.*'
- '1.1.*'
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.18'
id: go
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: |
go mod download
- name: Build CLI
run: |
cd cmd
go build -o inext -v .
- name: TF acceptance tests push
if: ${{ github.event_name == 'push' }}
timeout-minutes: 20
env:
INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_PUSH }}
INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_PUSH }}
INEXT_REGION: preprod
TF_ACC: "1"
run: |
cmd/inext discard
go test --timeout 20m -v -cover ./internal/resources/tests/
cmd/inext discard
- name: TF acceptance tests pull request
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 20
env:
INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_PR }}
INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_PR }}
INEXT_REGION: preprod
TF_ACC: "1"
run: |
cmd/inext discard
go test --timeout 20m -v -cover ./internal/resources/tests/
cmd/inext discard
# - name: TF acceptance tests schedule
# if: ${{ github.event_name == 'schedule' }}
# timeout-minutes: 20
# env:
# INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_SCHEDULE }}
# INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_SCHEDULE }}
# INEXT_REGION: preprod
# TF_ACC: "1"
# run: |
# cmd/inext discard
# go test --timeout 20m -v -cover ./internal/resources/tests/
# cmd/inext discard
test-produs:
name: Test Prod US
needs: build
environment:
name: ProdUS
url: https://portal.checkpoint.com
runs-on: ubuntu-latest
timeout-minutes: 100
concurrency: acctests-${{ github.event_name }}-produs
strategy:
max-parallel: 1
fail-fast: true
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '0.13.*'
- '0.14.*'
- '0.15.*'
- '1.0.*'
- '1.1.*'
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.18'
id: go
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: |
go mod download
- name: Build CLI
run: |
cd cmd
go build -o inext -v .
- name: TF acceptance tests push
if: ${{ github.event_name == 'push' }}
timeout-minutes: 20
env:
INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_PUSH }}
INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_PUSH }}
INEXT_REGION: us
TF_ACC: "1"
run: |
cmd/inext discard
go test --timeout 20m -v -cover ./internal/resources/tests/
cmd/inext discard
- name: TF acceptance tests pull request
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 20
env:
INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_PR }}
INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_PR }}
INEXT_REGION: us
TF_ACC: "1"
run: |
cmd/inext discard
go test --timeout 20m -v -cover ./internal/resources/tests/
cmd/inext discard
# - name: TF acceptance tests schedule
# if: ${{ github.event_name == 'schedule' }}
# timeout-minutes: 20
# env:
# INEXT_CLIENT_ID: ${{ secrets.INEXT_CLIENT_ID_SCHEDULE }}
# INEXT_ACCESS_KEY: ${{ secrets.INEXT_ACCESS_KEY_SCHEDULE }}
# INEXT_REGION: us
# TF_ACC: "1"
# run: |
# cmd/inext discard
# go test --timeout 20m -v -cover ./internal/resources/tests/
# cmd/inext discard