Skip to content

CI: support test for tech-solution #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@ on:
types: [ 'opened', 'synchronize' ]
paths:
- '.github/**'
- '.github/workflows/**'
- 'quickstarts/**'
- 'tech-solution/**'

jobs:
terraform-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: hashicorp/setup-terraform@v3

- name: Terraform fmt
id: fmt
run: terraform -chdir=quickstarts fmt -check -recursive
run: |
terraform -chdir=quickstarts fmt -check -recursive
terraform -chdir=tech-solution fmt -check -recursive


terraform-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: hashicorp/setup-terraform@v3

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v34
with:
dir_names: "true"
separator: ","
files: "quickstarts/*"
files: |
quickstarts/*
tech-solution/*
dir_names_max_depth: 3
- name: pr-check
- name: Terraform validate
run: |
CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}"
if [ -z "$CHANGED_FOLDERS" ]; then
echo "No changed quickstarts found"
echo "No changed terraform code found"
exit 0
fi

Expand All @@ -54,7 +54,7 @@ jobs:
terraform -chdir=$f init -upgrade
terraform -chdir=$f validate
if [[ $? -ne 0 ]]; then
echo -e "\033[31m[ERROR]\033[0m: Some quickstarts codes contain errors, and please running terraform validate command before pushing."
echo -e "\033[31m[ERROR]\033[0m: Some terraform codes contain errors, and please running terraform validate command before pushing."
exit 1
fi
done
Expand All @@ -63,7 +63,7 @@ jobs:
e2e-check:
needs: [terraform-fmt, terraform-validate]
runs-on: ubuntu-latest
name: 'e2e check'
name: e2e check
steps:
- name: checkout
uses: actions/checkout@v3
Expand All @@ -80,7 +80,9 @@ jobs:
with:
dir_names: "true"
separator: ","
files: "quickstarts/*"
files: |
quickstarts/*
tech-solution/*
dir_names_max_depth: 3
- name: set id
id: set-job-id
Expand All @@ -98,7 +100,7 @@ jobs:
run: |
CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}"
if [ -z "$CHANGED_FOLDERS" ]; then
echo "No changed quickstarts found"
echo "No changed terraform code found"
exit 0
fi
objectPath="github-action/${{github.repository}}/e2e/Action-${{github.run_number}}-${{github.run_id}}-${{ steps.set-job-id.outputs.jobId }}"
Expand Down
9 changes: 7 additions & 2 deletions scripts/doc-generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

if [ $# -eq 0 ];then
exampleDir=$(find ./quickstarts -maxdepth 2 -mindepth 2 -type d)
# echo $exampleDir
for file in $exampleDir;do
techSolutionDir=$(find ./tech-solution -maxdepth 1 -mindepth 1 -type d)
all_dirs="$exampleDir $techSolutionDir"
# echo $all_dirs
for file in $all_dirs;do
# echo $file
if [ -f $file/"main.tf" ];then
terraform-docs $file -c scripts/.terraform-docs.yml
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
terraform fmt $file
fi
done
Expand All @@ -15,12 +18,14 @@ else
do
if [ -f $arg/"main.tf" ];then
terraform-docs $arg -c scripts/.terraform-docs.yml
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
terraform fmt $file
else
exampleDir=$(find $arg -maxdepth 2 -mindepth 1 -type d)
for file in $exampleDir;do
if [ -f $file/"main.tf" ];then
terraform-docs $file -c scripts/.terraform-docs.yml
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
terraform fmt $file
fi
done
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions tech-solution/solution-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Introduction

<!-- BEGIN_TF_DOCS -->
## Providers

| Name | Version |
|------|---------|
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | n/a |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [alicloud_vpc.foo](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vpc) | resource |
| [alicloud_vswitch.foo](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vswitch) | resource |
| [alicloud_zones.foo](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/data-sources/zones) | data source |

## Inputs

No inputs.
<!-- END_TF_DOCS -->
15 changes: 15 additions & 0 deletions tech-solution/solution-example/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
data "alicloud_zones" "foo" {
available_resource_creation = "VSwitch"
}

resource "alicloud_vpc" "foo" {
vpc_name = "terraform-example"
cidr_block = "172.16.0.0/12"
}

resource "alicloud_vswitch" "foo" {
vswitch_name = "terraform-example"
cidr_block = "172.16.0.0/21"
vpc_id = alicloud_vpc.foo.id
zone_id = data.alicloud_zones.foo.zones.0.id
}
Loading