77
88env :
99 TERRAFORM_VERSION : " 0.14.8"
10- GO_VERSION : " ^1.17"
1110
1211jobs :
1312 go_build :
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
16+ - uses : actions/checkout@v4
17+ - name : Set up Go
18+ uses : actions/setup-go@v5
2219 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
43- 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
20+ go-version-file : go.mod
21+ - name : go build
4822 run : go build -o terraform-plugin-dir/registry.terraform.io/sysdiglabs/sysdig/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-sysdig .
4923
5024 terraform_providers_schema :
5125 name : terraform providers schema
5226 needs : [ go_build ]
5327 runs-on : ubuntu-latest
5428 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
29+ - uses : actions/checkout@v4
30+ - uses : hashicorp/setup-terraform@v1
7131 with :
7232 terraform_version : ${{ env.TERRAFORM_VERSION }}
7333 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
34+ - name : terraform init
7635 run : |
7736 # We need a file to initialize the provider
7837 cat <<EOF > main.tf
8140 }
8241 EOF
8342 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
43+ - name : terraform providers schema
8644 run : |
8745 mkdir terraform-providers-schema
8846 terraform providers schema -json > terraform-providers-schema/schema.json
@@ -91,24 +49,12 @@ jobs:
9149 needs : [ terraform_providers_schema ]
9250 runs-on : ubuntu-latest
9351 steps :
94- - uses : actions/checkout@v2
95- - uses : actions/setup-go@v3
52+ - uses : actions/checkout@v4
53+ - name : Set up Go
54+ uses : actions/setup-go@v5
9655 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') }}
56+ go-version-file : go.mod
10657 - 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/**') }}
11258 - name : tfproviderdocs check
11359 run : |
11460 tfproviderdocs check \
0 commit comments