-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (87 loc) · 2.89 KB
/
Copy pathmaster.yml
File metadata and controls
91 lines (87 loc) · 2.89 KB
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
name: build
on:
push:
branches:
- master
paths-ignore:
- 'CHANGELOG.md'
jobs:
pre-commit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.14'
- name: Install Go deps
run: |
go get -u golang.org/x/lint/golint
- name: Install pre-commit
run: |
pip install pre-commit
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
curl -L "$(curl -s https://api.github.com/repos/tfsec/tfsec/releases/latest | grep -o -E "https://.+?tfsec-linux-amd64")" > tfsec && chmod +x tfsec && sudo mv tfsec /usr/bin/
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/tags/v0.9.1 | grep -o -E "https://.+?-linux-amd64")" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
pre-commit install
pre-commit install-hooks
- name: Run pre-commit tests
run: pre-commit run --all-files
fmt:
name: Code Format
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:latest
steps:
- uses: actions/checkout@master
- run: terraform fmt --recursive -check=true
validate:
name: Validate
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:0.12.29
steps:
- uses: actions/checkout@master
- name: Validate Code
env:
AWS_REGION: 'us-east-1'
TF_WARN_OUTPUT_ERRORS: 1
TF_VAR_vpc_id: 'vpc-123456'
TF_VAR_subnets: '["subnet-12345a"]'
run: |
terraform init
terraform validate
- name: Validate Examples
run: |
for example in $(find examples -maxdepth 1 -mindepth 1 -type d); do
cd $example
terraform init
terraform validate
cd -
done
release:
name: Update un-released commits
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.14'
- name: Generate changelog
run: |
go get -u github.com/git-chglog/git-chglog/cmd/git-chglog
git fetch origin --prune --tags
git-chglog -o CHANGELOG.md
- name: Commit release change log
run: |
git add CHANGELOG.md
git config user.name github-actions
git config user.email github-actions@github.com
git commit CHANGELOG.md -m 'ci: update changelog'
git push -u origin master