77
88env :
99 TERRAFORM_VERSION : " 0.14.8"
10- GO_VERSION : " ^1.17"
1110
1211jobs :
13- go_build :
12+ ci-provider-docs :
1413 name : go build
1514 runs-on : ubuntu-latest
1615 steps :
17- - uses : actions/checkout@v2
18- - uses : actions/cache@v4
19- continue-on-error : true
20- id : cache-terraform-plugin-dir
21- timeout-minutes : 2
22- with :
23- path : terraform-plugin-dir
24- key : ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
25- - if : steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
26- uses : actions/setup-go@v3
27- with :
28- go-version : ${{ env.GO_VERSION }}
29- check-latest : true
30- cache : true
31- # See also: https://github.com/actions/setup-go/issues/54
32- - if : steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
33- name : go env
34- run : |
35- echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
36- - if : steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
37- uses : actions/cache@v4
38- with :
39- path : ${{ env.GOCACHE }}
40- key : ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
41- - if : steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
42- uses : actions/cache@v4
16+ - uses : actions/checkout@v4
17+
18+ - name : Set up Go
19+ uses : actions/setup-go@v5
4320 with :
44- path : ~/go/pkg/mod
45- key : ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
46- - if : steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
47- name : go build
21+ go-version-file : go.mod
22+
23+ - name : go build
4824 run : go build -o terraform-plugin-dir/registry.terraform.io/sysdiglabs/sysdig/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-sysdig .
4925
50- terraform_providers_schema :
51- name : terraform providers schema
52- needs : [ go_build ]
53- runs-on : ubuntu-latest
54- steps :
55- - uses : actions/checkout@v2
56- - uses : actions/cache@v4
57- continue-on-error : true
58- id : cache-terraform-providers-schema
59- timeout-minutes : 2
60- with :
61- path : terraform-providers-schema
62- key : ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
63- - if : steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
64- uses : actions/cache@v4
65- timeout-minutes : 2
66- with :
67- path : terraform-plugin-dir
68- key : ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
69- - if : steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
70- uses : hashicorp/setup-terraform@v1
26+ - uses : hashicorp/setup-terraform@v1
7127 with :
7228 terraform_version : ${{ env.TERRAFORM_VERSION }}
7329 terraform_wrapper : false
74- - if : steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
75- name : terraform init
30+
31+ - name : terraform init
7632 run : |
7733 # We need a file to initialize the provider
7834 cat <<EOF > main.tf
@@ -81,34 +37,14 @@ jobs:
8137 }
8238 EOF
8339 terraform init -plugin-dir terraform-plugin-dir
84- - if : steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
85- name : terraform providers schema
40+
41+ - name : terraform providers schema
8642 run : |
87- mkdir terraform-providers-schema
43+ mkdir -p terraform-providers-schema
8844 terraform providers schema -json > terraform-providers-schema/schema.json
8945
90- tfproviderdocs :
91- needs : [ terraform_providers_schema ]
92- runs-on : ubuntu-latest
93- steps :
94- - uses : actions/checkout@v2
95- - uses : actions/setup-go@v3
96- with :
97- go-version : ${{ env.GO_VERSION }}
98- check-latest : true
99- cache : true
100- - uses : actions/cache@v4
101- continue-on-error : true
102- timeout-minutes : 2
103- with :
104- path : ~/go/pkg/mod
105- key : ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
10646 - run : cd /tmp && go install github.com/bflad/tfproviderdocs@latest
107- - uses : actions/cache@v4
108- timeout-minutes : 2
109- with :
110- path : terraform-providers-schema
111- key : ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
47+
11248 - name : tfproviderdocs check
11349 run : |
11450 tfproviderdocs check \
0 commit comments