Skip to content

Quick Tests

Quick Tests #971

Workflow file for this run

name: Quick Tests
on:
push:
branches: [ master ]
tags: [ v* ]
pull_request:
schedule:
- cron: '0 10 * * 3'
jobs:
#
# Run unit tests
#
unit_tests:
name: Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
go:
- "" # Latest
- "1.22"
- "1.21"
- "1.20"
- "1.19"
steps:
# Install Go and Terraform
- uses: actions/setup-go@v2
with:
go-version: '${{ matrix.go }}'
# Checkout
- uses: actions/checkout@v2
# Restore cache
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-v${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
# Run unit tests
- name: Unit tests
run: make test
#
# Verify Terraform compatibility
#
terraform:
name: Terraform
runs-on: ubuntu-latest
strategy:
matrix:
terraform:
- "" # Latest
- "1.2.2"
- "1.1.9"
- "1.0.11"
- "0.15.5"
- "0.14.11"
- "0.13.7"
- "0.12.31"
env:
ROLLBAR_API_KEY: ${{ secrets.ROLLBAR_API_KEY }}
ROLLBAR_PROJECT_API_KEY: ${{ secrets.ROLLBAR_PROJECT_API_KEY }}
steps:
# Install Go and Terraform
- uses: hashicorp/setup-terraform@v1
with:
terraform_wrapper: false
terraform_version: "${{ matrix.terraform }}"
- uses: actions/setup-go@v2
# Checkout
- uses: actions/checkout@v2
# Restore cache
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
# Blank version number means latest version of Go.
key: ${{ runner.os }}-go-v-${{ hashFiles('**/go.sum') }}
# Install Provider
- name: Install
if: ${{ !startsWith(matrix.terraform, '0.12') }}
run: make install
- name: Install for Terraform 0.12
if: ${{ startsWith(matrix.terraform, '0.12') }}
run: make install012
# Setup Terraform configuration for local testing
- name: Overwrite configuration to use locally built provider
run: cp provider.tf.local provider.tf
working-directory: ./example
# Verify Terraform plan does not error
- name: Initialize Terraform
run: terraform init
working-directory: ./example
- name: Terraform plan
run: terraform plan -var 'rollbar_token=${{ secrets.ROLLBAR_TOKEN }}' -var 'rollbar_project_token=${{ secrets.ROLLBAR_TOKEN }}'
working-directory: ./example
env:
ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }}