generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 23
85 lines (72 loc) · 2.06 KB
/
ci.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
name: CI
on:
pull_request:
paths-ignore:
- 'README.md'
push:
branches:
- 'main'
jobs:
docs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.19'
- uses: hashicorp/setup-terraform@v3
with:
# This setting is necessary to avoid errors during doc generation. See https://github.com/hashicorp/terraform-plugin-docs/issues/127
terraform_wrapper: false
- uses: actions/checkout@v4
- name: Run doc generation
id: doc_gen
run: |
make docs && echo "uncommitted_files=$(git status --porcelain ./docs ./examples | wc -l)" >> $GITHUB_OUTPUT
- name: Show uncommitted changes
if: ${{ steps.doc_gen.outputs.uncommitted_files != 0 }}
run:
echo "Found uncommitted doc changes"
git status --porcelain ./docs ./examples
- name: Uncommitted changes check
if: ${{ steps.doc_gen.outputs.uncommitted_files != 0 }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('tfplugindocs generated uncommitted doc changes. Please run 'make docs' and add doc changes to your commits.')
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.19'
- uses: actions/checkout@v4
- name: Build
run: |
make build
# run acceptance tests in a matrix with Terraform core versions
terraform-acceptance-test:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
max-parallel: 2
matrix:
# Test with min and max supported Terraform versions
terraform:
- '1.0.11'
- '1.5.3'
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- uses: actions/checkout@v4
- name: Run tests
timeout-minutes: 15
env:
ASTRA_API_TOKEN: ${{ secrets.TEST_ASTRA_API_TOKEN }}
TF_ACC: "1"
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}
run: |
make testacc