-
Notifications
You must be signed in to change notification settings - Fork 48
119 lines (114 loc) · 4.77 KB
/
ci-provider-docs.yaml
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
117
118
119
name: Terraform Provider Docs
on:
pull_request:
branches:
- master
env:
TERRAFORM_VERSION: "0.14.8"
GO_VERSION: "^1.17"
jobs:
go_build:
name: go build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
continue-on-error: true
id: cache-terraform-plugin-dir
timeout-minutes: 2
with:
path: terraform-plugin-dir
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
# See also: https://github.com/actions/setup-go/issues/54
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
name: go env
run: |
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
uses: actions/cache@v2
with:
path: ${{ env.GOCACHE }}
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
name: go build
run: go build -o terraform-plugin-dir/registry.terraform.io/sysdiglabs/sysdig/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-sysdig .
terraform_providers_schema:
name: terraform providers schema
needs: [ go_build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
continue-on-error: true
id: cache-terraform-providers-schema
timeout-minutes: 2
with:
path: terraform-providers-schema
key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
uses: actions/cache@v2
timeout-minutes: 2
with:
path: terraform-plugin-dir
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
name: terraform init
run: |
# We need a file to initialize the provider
cat <<EOF > main.tf
terraform {
required_providers { sysdig = { source = "sysdiglabs/sysdig" } }
}
EOF
terraform init -plugin-dir terraform-plugin-dir
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
name: terraform providers schema
run: |
mkdir terraform-providers-schema
terraform providers schema -json > terraform-providers-schema/schema.json
tfproviderdocs:
needs: [ terraform_providers_schema ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- uses: actions/cache@v2
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- run: cd /tmp && go install github.com/bflad/tfproviderdocs@latest
- uses: actions/cache@v2
timeout-minutes: 2
with:
path: terraform-providers-schema
key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
- name: tfproviderdocs check
run: |
tfproviderdocs check \
-allowed-resource-subcategories-file website/allowed-subcategories.txt \
-enable-contents-check \
-provider-source registry.terraform.io/sysdiglabs/sysdig \
-providers-schema-json terraform-providers-schema/schema.json \
-require-resource-subcategory