forked from microsoft/AzureTRE
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (125 loc) · 5 KB
/
build_validation_develop.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
name: Build Validation
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- main
- 'feature/**'
# for each ref (branch/pr) run just the most recent,
# cancel other pending/running ones
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref }}"
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of
# changed files within `super-linter`
fetch-depth: 0
persist-credentials: false
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
terraform:
# our Terraform uses more than just *.tf files, so need to check changes in the folder
- '**/terraform/**/*'
core:
- 'core/**/*'
core_version:
- 'core/version.txt'
docs:
- 'docs/**/*'
terraform_workspaces:
- templates/workspaces/**/terraform/**/*.tf
terraform_shared_services:
- templates/shared_services/**/terraform/**/*.tf
terraform_workspace_services:
- templates/workspace_services/**/terraform/**/*.tf
- name: Terraform format check
if: ${{ steps.filter.outputs.terraform == 'true' }}
run: terraform fmt -check -recursive
# find all terraform folders and run validate to catch
# configuration errors
- name: Terraform validation
if: ${{ steps.filter.outputs.terraform == 'true' }}
run: |
find . -type d -name 'terraform' -not -path '*cnab*' -print0 \
| xargs -0 -I{} sh -c 'echo "***** Validating: {} *****"; \
terraform -chdir={} init -backend=false; terraform -chdir={} validate'
- name: "Stale version: core"
if: ${{ steps.filter.outputs.core == 'true' &&
steps.filter.outputs.core_version == 'false' }}
run: echo "::error::Code update without version change" && exit 1
- name: Lint code base
# the slim image is 2GB smaller and we don't use the extra stuff
# Moved this after the Terraform checks above due something similar to this issue:
# https://github.com/github/super-linter/issues/2433
uses: github/super-linter/[email protected]
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_MARKDOWN: true
VALIDATE_PYTHON_FLAKE8: true
VALIDATE_YAML: true
VALIDATE_TERRAFORM_TFLINT: true
VALIDATE_JAVA: true
JAVA_FILE_NAME: checkstyle.xml
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_GITHUB_ACTIONS: true
VALIDATE_DOCKERFILE_HADOLINT: true
VALIDATE_TSX: true
VALIDATE_TYPESCRIPT_ES: true
- name: Docs validation
if: ${{ steps.filter.outputs.docs == 'true' }}
run: |
pip install -r docs/requirements.txt
mkdocs build --strict
- name: Workspace Tags
if: ${{ steps.filter.outputs.terraform_workspaces == 'true' }}
uses: github/super-linter/[email protected]
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_TERRAFORM_TFLINT: true
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_workspaces.hcl
LINTER_REGEX_INCLUDE: './templates/workspaces/.*'
- name: Workspace Services Tags
if: ${{ steps.filter.outputs.terraform_workspace_services == 'true' }}
uses: github/super-linter/[email protected]
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_TERRAFORM_TFLINT: true
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_workspace_services.hcl
LINTER_REGEX_INCLUDE: './templates/workspaces/.*'
FILTER_REGEX_EXCLUDE: '.*user_resource.*'
- name: User Resources Tags
if: ${{ steps.filter.outputs.terraform_workspace_services == 'true' }}
uses: github/super-linter/[email protected]
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_TERRAFORM_TFLINT: true
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_user_resources.hcl
LINTER_REGEX_INCLUDE: './templates/workspace_services/.*/user_resources/.*'
- name: Shared Services Tags
if: ${{ steps.filter.outputs.terraform_shared_services == 'true' }}
uses: github/super-linter/[email protected]
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_TERRAFORM_TFLINT: true
TERRAFORM_TFLINT_CONFIG_FILE: .tflint_shared_services.hcl
LINTER_REGEX_INCLUDE: './templates/shared_services/.*'