forked from huaweicloud/terraform-provider-huaweicloud
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (100 loc) · 3.82 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
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
# This is a ci workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
pull_request:
paths-ignore:
- 'docs/**'
- 'examples/**'
- '*.md'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ">=1.18"
- run: go version
- name: Build
run: make build FLAGS='-mod=readonly'
- name: Vet
run: make vet
golangci:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: ">=1.18"
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
# This workflow contains a job called "tfproviderlint"
# Ignoring bflad/tfproviderlint until https://github.com/bflad/tfproviderlint/issues/255 is fixed...
# using ShiChangkuo/tfproviderlint instead
# Ignore rules:
# + R019: d.HasChanges() has many arguments, consider d.HasChangesExcept()
# + S018: schema should use TypeList with MaxItems 1
# + V011: custom SchemaValidateFunc should be replaced with validation.StringLenBetween()
# + V012: want "custom SchemaValidateFunc should be replaced with validation.IntAtLeast(), validation.IntAtMost(),
# or validation.IntBetween()
# + V013: custom SchemaValidateFunc should be replaced with validation.StringInSlice() or
# validation.StringNotInSlice()
# + V014: custom SchemaValidateFunc should be replaced with validation.IntInSlice() or validation.IntNotInSlice()
tfproviderlint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: ">=1.18"
- name: Checkout provider
uses: actions/checkout@v3
with:
path: terraform-provider-huaweicloud
- name: Checkout tfproviderlint
uses: actions/checkout@v3
with:
repository: ShiChangkuo/tfproviderlint
path: tfproviderlint
- name: Install tfproviderlint and Check
run: |
cd ${{ github.workspace }}/tfproviderlint/cmd/tfproviderlint
go install
cd ${{ github.workspace }}/terraform-provider-huaweicloud
tfproviderlint -R019=false -S018=false -V011=false -V012=false -V013=false -V014=false ./...
schema-markdown-check:
runs-on: ubuntu-latest
env:
# when HW_SCHEMA is not empty, custom schema config will be contained in the description of parameters
# for the schema-markdown-check
HW_SCHEMA: "true"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ">=1.18"
- name: Check schemas and markdown docs
shell: bash {0}
run: |
cd scripts/markdown_check
go build -o markdown_check main.go
./markdown_check >check_result.log
# There are three known issues for huaweicloud_mapreduce_cluster
ret=$(($?-3))
if [ $ret -gt 0 ]; then
echo "ERROR: find $ret inconsistencies between schemas and markdown docs"
echo -e "please ignore the errors in huaweicloud_mapreduce_cluster\n"
grep -B1 "\[ERROR\]" check_result.log
fi
exit $ret