-
Notifications
You must be signed in to change notification settings - Fork 13
116 lines (97 loc) · 2.67 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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 }}