-
Notifications
You must be signed in to change notification settings - Fork 42
97 lines (96 loc) · 3.38 KB
/
code-health.yaml
File metadata and controls
97 lines (96 loc) · 3.38 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
92
93
94
95
96
97
name: 'Code Health'
on:
push:
branches:
- master
pull_request:
merge_group:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: 'cfn-resources/go.mod'
- name: Setup and verify
run: make tools verify
mock-generation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: 'cfn-resources/go.mod'
- name: Generate mocks
run: |
make tools generate-mocks
- name: Check for uncommited files
run: |
FILES=$(git ls-files -o -m --directory --exclude-standard --no-empty-directory)
LINES=$(echo "$FILES" | awk 'NF' | wc -l)
if [ "$LINES" -ne 0 ]; then
echo "Detected files that need to be committed:"
echo "$FILES" | while IFS= read -r line; do echo " $line"; done
echo ""
echo "Mock skeletons are not up-to-date, you may have forgotten to run mockery before committing your changes."
exit 1
fi
github-linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: 'cfn-resources/go.mod'
- name: actionlint
run: |
make tools
actionlint -verbose -color
shell: bash
- name: Run ShellCheck
uses: bewuethr/shellcheck-action@80bac2daa9fcf95d648200a793d00060857e6dc4
check-copyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: 'cfn-resources/go.mod'
- name: install tools
run: make tools
- name: check copyright
run: ./.github/scripts/check-licenses.sh
shell: bash
dependency-review:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: 'Checkout Repository'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: 'Dependency Review'
uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48
cfn-lint:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: 'Setup cfn-lint'
uses: scottbrenner/cfn-lint-action@c5f18dc4be13042d564f3052f4067dc9ceafe355
- name: 'Run cfn-lint'
run: |
shopt -s globstar # enable globbing
cfn-lint --version
- run: cfn-lint ./cfn-resources/**/*.yml
- run: cfn-lint ./cfn-resources/**/*.yaml
if: always() # run even if previous step fails to lint all files
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: 'cfn-resources/go.mod'
- name: run-unit-test
run: make unit-test