Skip to content

Commit

Permalink
glcc
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHappyEnding committed Oct 27, 2024
1 parent 0d55aa6 commit c8f8743
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 159 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Terraform in Daily Test

on:
schedule:
- cron: '0 18 * * *' # 每天 UTC 时间 18:00,即中国时间凌晨 2 点

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Check GitHub Secrets
run: |
if [ -z "${{ secrets.MYAPP_GITHUB_TOKEN }}" ]; then
echo "GitHub Token is missing"
else
echo "GitHub Token is set"
fi
if [ -z "${{ secrets.MYAPP_USER_EMAIL }}" ]; then
echo "User Email is missing"
else
echo "User Email is set"
fi
if [ -z "${{ secrets.MYAPP_USER_NAME }}" ]; then
echo "User Name is missing"
else
echo "User Name is set"
fi
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: dailyTest

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.9.4

- name: Initialize Terraform
env:
TF_VAR_access_key: ${{ secrets.ALI_ACCESS_KEY }}
TF_VAR_secret_key: ${{ secrets.ALI_SECRET_KEY }}
TF_VAR_github_token: ${{ secrets.MYAPP_GITHUB_TOKEN }}
TF_VAR_user_name: ${{ secrets.MYAPP_USER_NAME }}
TF_VAR_user_email: ${{ secrets.MYAPP_USER_EMAIL }}
run: terraform -chdir=./Terraform/Aliyun init

- name: Apply Terraform Configuration
env:
TF_VAR_access_key: ${{ secrets.ALI_ACCESS_KEY }}
TF_VAR_secret_key: ${{ secrets.ALI_SECRET_KEY }}
TF_VAR_github_token: ${{ secrets.MYAPP_GITHUB_TOKEN }}
TF_VAR_user_name: ${{ secrets.MYAPP_USER_NAME }}
TF_VAR_user_email: ${{ secrets.MYAPP_USER_EMAIL }}
run: terraform -chdir=./Terraform/Aliyun apply -auto-approve

- name: Print current directory and file list
run: |
cd ./Terraform/Aliyun
echo "Current directory:"
pwd
echo "Files in the current directory:"
ls
- name: Wait for 20 minutes before destroying resources
run: sleep 1200 # 等待 20 分钟

- name: Destroy Terraform Configuration
env:
TF_VAR_access_key: ${{ secrets.ALI_ACCESS_KEY }}
TF_VAR_secret_key: ${{ secrets.ALI_SECRET_KEY }}
TF_VAR_github_token: ${{ secrets.MYAPP_GITHUB_TOKEN }}
TF_VAR_user_name: ${{ secrets.MYAPP_USER_NAME }}
TF_VAR_user_email: ${{ secrets.MYAPP_USER_EMAIL }}
run: terraform -chdir=./Terraform/Aliyun destroy -auto-approve

31 changes: 0 additions & 31 deletions .github/workflows/test.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions Terraform/Aliyun/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ cd utils/create-cluster
./create-cluster start
yes yes | ./create-cluster create
# 尝试克隆 Git 仓库,最多尝试 10 次
REPO_URL="https://github.com/MrHappyEnding/compatibility-test-suite-for-redis.git"
# 可替换为含有dailyTest分支仓库的url
REPO_URL="https://github.com/tair-opensource/resp-compatibility.git"
RETRY_COUNT=0
MAX_RETRIES=10
SLEEP_DURATION=30
Expand All @@ -325,7 +325,7 @@ if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
exit 1
fi
cd compatibility-test-suite-for-redis
cd resp-compatibility
git checkout dailyTest
python3 conn.py
EOF
Expand Down
124 changes: 0 additions & 124 deletions Terraform/Test/main.tf

This file was deleted.

2 changes: 1 addition & 1 deletion conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def run_test():
"git stash -u",
"git checkout gh-pages || git checkout -b gh-pages",
"git pull origin gh-pages",
"cp -r /root/html/* .", #更新直接覆盖原同名文件
"cp -r /root/html/* .",
"git add .",
"git commit -m 'Update test results'",
]
Expand Down

0 comments on commit c8f8743

Please sign in to comment.