Skip to content

Commit bdf3d3f

Browse files
authored
Merge pull request #6 from rhythmictech/update-ci
Update ci
2 parents 8eda172 + f13a210 commit bdf3d3f

19 files changed

+465
-69
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @rhythmictech/engineering

.github/workflows/check.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/misspell.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: misspell
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
misspell:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: misspell
17+
uses: reviewdog/action-misspell@v1
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
locale: "US"
21+
reporter: github-check
22+
filter_mode: nofilter
23+
level: error

.github/workflows/pre-commit.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: pre-commit-check
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- prod
8+
- develop
9+
10+
jobs:
11+
pre-commit-check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
- name: Install prerequisites
18+
run: ./bin/install-ubuntu.sh
19+
- name: initialize Terraform
20+
run: terraform init --backend=false
21+
- name: pre-commit
22+
uses: pre-commit/[email protected]
23+
env:
24+
AWS_DEFAULT_REGION: us-east-1
25+
# many of these are covered by better reviewdog linters below
26+
SKIP: >-
27+
terraform_tflint_deep,
28+
no-commit-to-branch,
29+
terraform_tflint_nocreds,
30+
terraform_tfsec

.github/workflows/pullRequest.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: pull request
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
# TODO: #22 add job using https://github.com/reviewdog/action-alex
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
- name: Install prerequisites
15+
run: ./bin/install-ubuntu.sh
16+
- name: initialize Terraform
17+
run: terraform init --backend=false
18+
- name: pre-commit
19+
uses: pre-commit/[email protected]
20+
env:
21+
AWS_DEFAULT_REGION: us-east-1
22+
# many of these are covered by better reviewdog linters below
23+
SKIP: >-
24+
terraform_tflint_deep,
25+
no-commit-to-branch,
26+
terraform_tflint_nocreds,
27+
terraform_tfsec
28+
tflint:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
- name: Install prerequisites
33+
run: ./bin/install-ubuntu.sh
34+
- name: Terraform init
35+
run: terraform init --backend=false
36+
- name: tflint
37+
uses: reviewdog/action-tflint@master
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
reporter: github-pr-check
41+
filter_mode: added
42+
flags: --module
43+
level: error
44+
tfsec:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- name: Install prerequisites
49+
run: ./bin/install-ubuntu.sh
50+
- name: Terraform init
51+
run: terraform init --backend=false
52+
- name: tfsec
53+
uses: reviewdog/action-tfsec@master
54+
with:
55+
github_token: ${{ secrets.GITHUB_TOKEN }}
56+
reporter: github-pr-check
57+
filter_mode: added
58+
level: warning
59+
misspell:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v2
63+
- name: misspell
64+
uses: reviewdog/action-misspell@v1
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
locale: "US"
68+
reporter: github-pr-check
69+
filter_mode: added
70+
level: error
71+
yamllint:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v2
75+
- name: yamllint
76+
uses: reviewdog/action-yamllint@v1
77+
with:
78+
github_token: ${{ secrets.GITHUB_TOKEN }}
79+
reporter: github-pr-check
80+
filter_mode: added
81+
level: error

.github/workflows/tflint.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: tflint
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
tflint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Install prerequisites
17+
run: ./bin/install-ubuntu.sh
18+
- name: Terraform init
19+
run: terraform init --backend=false
20+
- name: tflint
21+
uses: reviewdog/action-tflint@master
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
reporter: github-check
25+
filter_mode: nofilter
26+
flags: --module
27+
level: error

.github/workflows/tfsec.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: tfsec
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
tfsec:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Install prerequisites
17+
run: ./bin/install-ubuntu.sh
18+
- name: Terraform init
19+
run: terraform init --backend=false
20+
- name: tfsec
21+
uses: reviewdog/action-tfsec@master
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
reporter: github-check
25+
filter_mode: nofilter
26+
level: error

.github/workflows/yamllint.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: yamllint
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
yamllint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: yamllint
17+
uses: reviewdog/action-yamllint@v1
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
reporter: github-check
21+
filter_mode: nofilter
22+
level: error

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Local .terraform directories
2+
**/.terraform/*
3+
4+
# .tfstate files
5+
*.tfstate
6+
*.tfstate.*
7+
8+
# .tfvars files
9+
*.tfvars
10+
11+
# macs
12+
.DS_Store
13+
14+
# temp folders
15+
tmp
16+
17+
.terraform.lock.hcl

.pre-commit-config.yaml

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,68 @@
1-
---
1+
exclude: ".terraform"
22
repos:
3-
- repo: git://github.com/antonbabenko/pre-commit-terraform
4-
rev: v1.24.0
5-
hooks:
6-
- id: terraform_fmt
7-
- id: terraform_docs
8-
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v2.4.0
10-
hooks:
11-
- id: end-of-file-fixer
12-
- id: trailing-whitespace
13-
- id: no-commit-to-branch
3+
- repo: https://github.com/antonbabenko/pre-commit-terraform
4+
rev: v1.77.0
5+
hooks:
6+
- id: terraform_docs
7+
always_run: true
8+
- id: terraform_fmt
9+
- id: terraform_tflint
10+
alias: terraform_tflint_nocreds
11+
name: terraform_tflint_nocreds
12+
- id: terraform_tfsec
13+
- repo: local
14+
hooks:
15+
- id: terraform_validate
16+
name: terraform_validate
17+
entry: |
18+
bash -c '
19+
AWS_DEFAULT_REGION=us-east-1
20+
declare -a DIRS
21+
for FILE in "$@"
22+
do
23+
DIRS+=($(dirname "$FILE"))
24+
done
25+
for DIR in $(printf "%s\n" "${DIRS[@]}" | sort -u)
26+
do
27+
cd $(dirname "$FILE")
28+
terraform init --backend=false
29+
terraform validate .
30+
cd ..
31+
done
32+
'
33+
language: system
34+
verbose: true
35+
files: \.tf(vars)?$
36+
exclude: examples
37+
- repo: https://github.com/pre-commit/pre-commit-hooks
38+
rev: v4.4.0
39+
hooks:
40+
- id: check-case-conflict
41+
- id: check-json
42+
- id: check-merge-conflict
43+
- id: check-symlinks
44+
- id: check-yaml
45+
args:
46+
- --unsafe
47+
- id: end-of-file-fixer
48+
- id: mixed-line-ending
49+
args:
50+
- --fix=lf
51+
- id: no-commit-to-branch
52+
args:
53+
- --branch
54+
- main
55+
- --branch
56+
- master
57+
- --branch
58+
- prod
59+
- id: pretty-format-json
60+
args:
61+
- --autofix
62+
- --top-keys=name,Name
63+
- id: trailing-whitespace
64+
args:
65+
- --markdown-linebreak-ext=md
66+
exclude: README.md
67+
ci:
68+
skip: [terraform_docs, terraform_fmt, terraform_tflint, terraform_tfsec, tflock]

0 commit comments

Comments
 (0)