Skip to content

Commit 968f4e7

Browse files
committed
CI: support test for tech-solution
1 parent 4820614 commit 968f4e7

File tree

13 files changed

+62
-15
lines changed

13 files changed

+62
-15
lines changed

.github/workflows/e2e.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@ on:
77
types: [ 'opened', 'synchronize' ]
88
paths:
99
- '.github/**'
10-
- '.github/workflows/**'
1110
- 'quickstarts/**'
11+
- 'tech-solution/**'
1212

1313
jobs:
1414
terraform-fmt:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
1918
- uses: hashicorp/setup-terraform@v3
20-
2119
- name: Terraform fmt
2220
id: fmt
23-
run: terraform -chdir=quickstarts fmt -check -recursive
21+
run: |
22+
terraform -chdir=quickstarts fmt -check -recursive
23+
terraform -chdir=tech-solution fmt -check -recursive
2424
2525
2626
terraform-validate:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- uses: actions/checkout@v4
30-
3130
- uses: hashicorp/setup-terraform@v3
32-
3331
- name: Get changed files
3432
id: changed-files
3533
uses: tj-actions/changed-files@v34
3634
with:
3735
dir_names: "true"
3836
separator: ","
39-
files: "quickstarts/*"
37+
files: |
38+
quickstarts/*
39+
tech-solution/*
4040
dir_names_max_depth: 3
41-
- name: pr-check
41+
- name: Terraform validate
4242
run: |
4343
CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}"
4444
if [ -z "$CHANGED_FOLDERS" ]; then
45-
echo "No changed quickstarts found"
45+
echo "No changed terraform code found"
4646
exit 0
4747
fi
4848
@@ -54,7 +54,7 @@ jobs:
5454
terraform -chdir=$f init -upgrade
5555
terraform -chdir=$f validate
5656
if [[ $? -ne 0 ]]; then
57-
echo -e "\033[31m[ERROR]\033[0m: Some quickstarts codes contain errors, and please running terraform validate command before pushing."
57+
echo -e "\033[31m[ERROR]\033[0m: Some terraform codes contain errors, and please running terraform validate command before pushing."
5858
exit 1
5959
fi
6060
done
@@ -63,7 +63,7 @@ jobs:
6363
e2e-check:
6464
needs: [terraform-fmt, terraform-validate]
6565
runs-on: ubuntu-latest
66-
name: 'e2e check'
66+
name: e2e check
6767
steps:
6868
- name: checkout
6969
uses: actions/checkout@v3
@@ -80,7 +80,9 @@ jobs:
8080
with:
8181
dir_names: "true"
8282
separator: ","
83-
files: "quickstarts/*"
83+
files: |
84+
quickstarts/*
85+
tech-solution/*
8486
dir_names_max_depth: 3
8587
- name: set id
8688
id: set-job-id
@@ -98,7 +100,7 @@ jobs:
98100
run: |
99101
CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}"
100102
if [ -z "$CHANGED_FOLDERS" ]; then
101-
echo "No changed quickstarts found"
103+
echo "No changed terraform code found"
102104
exit 0
103105
fi
104106
objectPath="github-action/${{github.repository}}/e2e/Action-${{github.run_number}}-${{github.run_id}}-${{ steps.set-job-id.outputs.jobId }}"

scripts/doc-generate.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
if [ $# -eq 0 ];then
44
exampleDir=$(find ./quickstarts -maxdepth 2 -mindepth 2 -type d)
5-
# echo $exampleDir
6-
for file in $exampleDir;do
5+
techSolutionDir=$(find ./tech-solution -maxdepth 1 -mindepth 1 -type d)
6+
all_dirs="$exampleDir $techSolutionDir"
7+
# echo $all_dirs
8+
for file in $all_dirs;do
79
# echo $file
810
if [ -f $file/"main.tf" ];then
911
terraform-docs $file -c scripts/.terraform-docs.yml
12+
sed -i '' 's|https://registry.terraform.io/providers/hashicorp/alicloud/latest/docs/|https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/|g' $file/README.md
1013
terraform fmt $file
1114
fi
1215
done
@@ -15,12 +18,14 @@ else
1518
do
1619
if [ -f $arg/"main.tf" ];then
1720
terraform-docs $arg -c scripts/.terraform-docs.yml
21+
sed -i '' 's|https://registry.terraform.io/providers/hashicorp/alicloud/latest/docs/|https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/|g' $arg/README.md
1822
terraform fmt $file
1923
else
2024
exampleDir=$(find $arg -maxdepth 2 -mindepth 1 -type d)
2125
for file in $exampleDir;do
2226
if [ -f $file/"main.tf" ];then
2327
terraform-docs $file -c scripts/.terraform-docs.yml
28+
sed -i '' 's|https://registry.terraform.io/providers/hashicorp/alicloud/latest/docs/|https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/|g' $file/README.md
2429
terraform fmt $file
2530
fi
2631
done
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)