Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 committed Jul 19, 2023
1 parent f1c93df commit 2cf22f6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/create-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
setup:
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -30,13 +30,13 @@ jobs:
ticloud cluster delete -p 1372813089447741295 -c $id --force;
done
connect-test:
create-test:
needs: setup
strategy:
matrix:
region: [ us-east-1, us-west-2, ap-northeast-1, ap-southeast-1, eu-central-1 ]
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Init

on:
pull_request:

jobs:
setup:
strategy:
matrix:
region: [ us-east-1, us-west-2, ap-northeast-1, ap-southeast-1, eu-central-1 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up ticloud
uses: tidbcloud/setup-tidbcloud-cli@v0
with:
api_public_key: oHloc6bC
api_private_key: aba07d40-7f6d-4c2c-8d6e-311639fd6c11

- name: Create cluster
run: |
PROJECT_ID=1372813089454311307
ticloud cluster create -p $PROJECT_ID --cluster-name ${{ matrix.region }} --cloud-provider AWS -r ${{ matrix.region }} --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS > ${{ matrix.region }}
cat ${{ matrix.region }}
ticloud cluster get -p $PROJECT_ID -c `cat ${{ matrix.region }} | sed 's/[^0-9]//g'` > ${{ matrix.region }}
cat ${{ matrix.region }}
echo "PROJECT_ID=$PROJECT_ID" >> $GITHUB_ENV
echo "CLUSTER_ID=`echo $(jq '.id' ${{ matrix.region }}) | sed 's/"//g'`" >> $GITHUB_ENV
echo "CLUSTER_USER=$(jq '.status.connection_strings.default_user' ${{ matrix.region }})" >> $GITHUB_ENV
echo "CLUSTER_HOST=$(jq '.status.connection_strings.standard.host' ${{ matrix.region }})" >> $GITHUB_ENV
- name: Create branch
run: |
ticloud branch create -c ${{ env.CLUSTER_ID }} --branch-name ${{ matrix.region }} > ${{ matrix.region }}
cat ${{ matrix.region }}
ticloud branch get -c ${{ env.CLUSTER_ID }} -b `cat ${{ matrix.region }} | grep -o 'bran-[a-zA-Z0-9]*'` > ${{ matrix.region }}
cat ${{ matrix.region }}

0 comments on commit 2cf22f6

Please sign in to comment.