Skip to content

Commit eaaba04

Browse files
committed
ci: improve e2e check
1 parent 394b154 commit eaaba04

File tree

4 files changed

+37
-18
lines changed

4 files changed

+37
-18
lines changed

.github/workflows/e2e.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ on:
44
branches:
55
- master
66
- main
7-
types: [ 'opened', 'synchronize' ]
7+
types: ["opened", "synchronize"]
88
paths:
9-
- 'quickstarts/**'
10-
- 'solution/**'
9+
- "quickstarts/**/**.tf"
10+
- "solution/**/**.tf"
1111

1212
jobs:
1313
terraform-fmt:
@@ -21,7 +21,6 @@ jobs:
2121
terraform -chdir=quickstarts fmt -check -recursive
2222
terraform -chdir=solution fmt -check -recursive
2323
24-
2524
terraform-validate:
2625
runs-on: ubuntu-latest
2726
steps:
@@ -34,8 +33,7 @@ jobs:
3433
dir_names: "true"
3534
separator: ","
3635
files: |
37-
quickstarts/*
38-
solution/*
36+
{quickstarts,solution}/**/*.tf
3937
dir_names_max_depth: 3
4038
- name: Terraform validate
4139
run: |
@@ -58,21 +56,13 @@ jobs:
5856
fi
5957
done
6058
61-
6259
e2e-check:
6360
needs: [terraform-fmt, terraform-validate]
6461
runs-on: ubuntu-latest
6562
name: e2e check
6663
steps:
6764
- name: checkout
6865
uses: actions/checkout@v3
69-
- name: Checking the max commits number
70-
run: |
71-
commitNum=${{ github.event.pull_request.commits }}
72-
if [[ ${commitNum} -gt 1 ]]; then
73-
echo -e "\nERROR: The PR has ${commitNum} commits, and please rebase it to 1.\n"
74-
exit 1
75-
fi
7666
- name: Get changed files
7767
id: changed-files
7868
uses: tj-actions/changed-files@v34
@@ -82,14 +72,17 @@ jobs:
8272
files: |
8373
quickstarts/*
8474
solution/*
75+
files_ignore: |
76+
quickstarts/**/**.md
77+
solution/**/**.md
8578
dir_names_max_depth: 3
8679
- name: set id
8780
id: set-job-id
8881
uses: ayachensiyuan/[email protected]
89-
env:
82+
env:
9083
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9184
with:
92-
job-name: 'e2e check'
85+
job-name: "e2e check"
9386
- name: get pull request info
9487
run: |
9588
echo "repo name is" ${{github.event.pull_request.head.repo.full_name}}
@@ -104,4 +97,4 @@ jobs:
10497
fi
10598
objectPath="github-action/${{github.repository}}/e2e/Action-${{github.run_number}}-${{github.run_id}}-${{ steps.set-job-id.outputs.jobId }}"
10699
curl -H "X-Fc-Invocation-Type:Async" -s https://example-ci-terrafoodule-ci-svrrwvrpnj.ap-southeast-1.fcapp.run/?branch=${{github.event.pull_request.head.ref}}\&repo_name=${{github.event.pull_request.head.repo.full_name}}\&oss_object_path=${objectPath}
107-
go run scripts/e2e_check.go ${objectPath}
100+
go run scripts/e2e_check.go ${objectPath}

.github/workflows/pull_request.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Pull Request
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- main
7+
types: ["opened", "synchronize"]
8+
paths:
9+
- "quickstarts/**"
10+
- "solution/**"
11+
12+
jobs:
13+
commit-check:
14+
runs-on: ubuntu-latest
15+
name: commit check
16+
steps:
17+
- name: checkout
18+
uses: actions/checkout@v3
19+
- name: Checking the max commits number
20+
run: |
21+
commitNum=${{ github.event.pull_request.commits }}
22+
if [[ ${commitNum} -gt 1 ]]; then
23+
echo -e "\nERROR: The PR has ${commitNum} commits, and please rebase it to 1.\n"
24+
exit 1
25+
fi

quickstarts/VPC/101-vswitch-docs-Example-01/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ resource "alicloud_vswitch" "foo" {
1111
vswitch_name = "terraform-example"
1212
cidr_block = "172.16.0.0/21"
1313
vpc_id = alicloud_vpc.foo.id
14-
zone_id = data.alicloud_zones.foo.zones.0.id
14+
zone_id = data.alicloud_zones.foo.zones.0.id
1515
}

quickstarts/VPC/101-vswitch-docs-Example-02/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ No modules.
2525
## Inputs
2626

2727
No inputs.
28+
2829
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)