Skip to content

Commit

Permalink
staging test
Browse files Browse the repository at this point in the history
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
  • Loading branch information
AmoebaProtozoa committed Aug 15, 2024
1 parent 9379d3b commit 9f8f544
Showing 1 changed file with 26 additions and 67 deletions.
93 changes: 26 additions & 67 deletions .github/workflows/compatibility-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up ticloud
uses: tidbcloud/setup-tidbcloud-cli@v0
with:
version: 0.5.2
api_public_key: ${{ secrets.TLS_PUBLIC_KEY }}
api_private_key: ${{ secrets.TLS_PRIVATE_KEY }}

- name: Get Connection Info
run: |
# delete cluster if exists
set +e
ticloud cluster list 1372813089206721319 -o json > cluster
exitcode="$?"
if [[ "$exitcode" != "0" ]]; then
cat cluster
exit "$exitcode"
fi
total=$(jq '.total' cluster);
for i in $(seq 1 $total);
do
id=`echo $(jq ".items[$i-1].id" cluster) | sed 's/"//g'`
ticloud cluster delete -p 1372813089206721319 -c $id --force;
exitcode="$?"
if [[ "$exitcode" != "0" ]]; then
exit "$exitcode"
fi
done
# create cluster
ticloud cluster create --project-id 1372813089206721319 --cluster-name tls-test --cloud-provider AWS -r us-east-1 --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS;
exitcode="$?"
if [[ "$exitcode" != "0" ]]; then
exit "$exitcode"
fi
# get connection info
ticloud cluster list 1372813089206721319 -o json > cluster
exitcode="$?"
if [[ "$exitcode" != "0" ]]; then
cat cluster
exit "$exitcode"
fi
cat cluster
echo "TIDB_CLOUD_USER=$(jq '.items[0].status.connection_strings.default_user' cluster)" >> $GITHUB_ENV
echo "TIDB_CLOUD_HOST=$(jq '.items[0].status.connection_strings.standard.host' cluster)" >> $GITHUB_ENV
echo "TIDB_CLOUD_USER=2uFUKRJFFZxmGk8.root" >> $GITHUB_ENV
echo "TIDB_CLOUD_HOST=gateway01.us-east-1.staging.shared.aws.tidbcloud.com" >> $GITHUB_ENV
echo "TIDB_CLOUD_PASSWORD=Ykx09fPfsAzuOeSM" >> $GITHUB_ENV
outputs:
TiDB_CLOUD_USER: ${{ env.TIDB_CLOUD_USER }}
TiDB_CLOUD_HOST: ${{ env.TIDB_CLOUD_HOST }}
TiDB_CLOUD_PASSWORD: ${{ env.TIDB_CLOUD_PASSWORD }}

mysql:
needs: setup
Expand All @@ -86,7 +45,7 @@ jobs:
uses: shogo82148/actions-setup-mysql@v1

- name: Run test on ${{ matrix.os }}
run: mysql -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=${{ matrix.cert }} -p${{ secrets.TIDB_CLOUD_PASSWORD }}
run: mysql -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=${{ matrix.cert }} -p${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}

no_tls:
needs: setup
Expand All @@ -103,7 +62,7 @@ jobs:
uses: shogo82148/actions-setup-mysql@v1

- name: Run test
run: "! mysql -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P ${{ matrix.port }} -D test --ssl-mode=DISABLED -p${{ secrets.TIDB_CLOUD_PASSWORD }}"
run: "! mysql -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P ${{ matrix.port }} -D test --ssl-mode=DISABLED -p${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}"

invalid_tls_version:
needs: setup
Expand All @@ -121,7 +80,7 @@ jobs:
# Starting from 8.0.26, TLSv1 & TLSv1.1 are deprecated. From 8.0.28, they are completely removed.
pip3 install mysql-connector-python==8.0.25 --break-system-packages
cd example_code/python
! python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ matrix.port }} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{secrets.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
! python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ matrix.port }} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
valid_tls_version:
needs: setup
Expand All @@ -138,7 +97,7 @@ jobs:
run: |
pip3 install mysql-connector-python --break-system-packages
cd example_code/python
python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ matrix.port }} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{secrets.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ matrix.port }} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
mycli:
needs: setup
Expand Down Expand Up @@ -166,7 +125,7 @@ jobs:

- name: Run test on ${{ matrix.os }}
run:
mycli -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P 4000 -D test --ssl-ca=${{ matrix.cert }} --ssl-verify-server-cert -p${{ secrets.TIDB_CLOUD_PASSWORD}}
mycli -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P 4000 -D test --ssl-ca=${{ matrix.cert }} --ssl-verify-server-cert -p${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD}}

java_jdbc:
needs: setup
Expand All @@ -186,15 +145,15 @@ jobs:
run: |
cd example_code/java
javac ConnectTest.java
java -cp mysql-connector-j-8.0.31.jar: ConnectTest ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
java -cp mysql-connector-j-8.0.31.jar: ConnectTest ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
- name: Run test on windows
if: ${{ matrix.os == 'windows-2022' }}
# Need to use Chinese semicolon and an extra space before ConnectTest (don't know why)
run: |
cd example_code/java
javac ConnectTest.java
java -cp mysql-connector-j-8.0.31.jar; ConnectTest ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
java -cp mysql-connector-j-8.0.31.jar; ConnectTest ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
# https://jira.mariadb.org/browse/CONJ-1023
java_jdbc_mariadb_CONJ-1023:
Expand All @@ -211,7 +170,7 @@ jobs:
run: |
cd example_code/java
javac ConnectTestMariaDB.java
java -cp mariadb-java-client-3.0.9.jar: ConnectTestMariaDB ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
java -cp mariadb-java-client-3.0.9.jar: ConnectTestMariaDB ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
python_mysqlclient:
needs: setup
Expand Down Expand Up @@ -240,7 +199,7 @@ jobs:
run: |
pip3 install mysqlclient --break-system-packages
cd example_code/python
python3 ConnectTest_mysqlclient.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python3 ConnectTest_mysqlclient.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python_mysql_connector:
needs: setup
Expand All @@ -263,7 +222,7 @@ jobs:
run: |
pip3 install mysql-connector-python --break-system-packages
cd example_code/python
python3 ConnectTest_mysql-connector-python.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python3 ConnectTest_mysql-connector-python.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python_pymysql:
needs: setup
Expand All @@ -286,7 +245,7 @@ jobs:
run: |
pip3 install pymysql --break-system-packages
cd example_code/python
python3 ConnectTest_pymysql.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python3 ConnectTest_pymysql.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python_sqlalchemy:
needs: setup
Expand Down Expand Up @@ -316,7 +275,7 @@ jobs:
pip3 install mysqlclient --break-system-packages
pip3 install sqlalchemy --break-system-packages
cd example_code/sqlalchemy
python3 ConnectTest.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
python3 ConnectTest.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }} ${{ matrix.cert }}
go_godriver:
needs: setup
Expand All @@ -335,7 +294,7 @@ jobs:
run: |
cd example_code/go
go mod tidy
go run ConnectTest.go ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
go run ConnectTest.go ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
go_gorm:
needs: setup
Expand All @@ -354,7 +313,7 @@ jobs:
run: |
cd example_code/gorm
go mod tidy
go run ConnectTest.go ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
go run ConnectTest.go ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
node_mysql2:
needs: setup
Expand All @@ -372,7 +331,7 @@ jobs:
run: |
cd example_code/node
npm install --save mysql2
node ConnectTest.js ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
node ConnectTest.js ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
node_sequelize:
needs: setup
Expand All @@ -391,7 +350,7 @@ jobs:
cd example_code/sequelize
npm install --save mysql2
npm install --save sequelize
node ConnectTest.js ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
node ConnectTest.js ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
rust_mysql:
needs: setup
Expand All @@ -406,7 +365,7 @@ jobs:
- name: Run test on ${{ matrix.os }}
run: |
cd example_code/rust
cargo run ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
cargo run ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
ruby_mysql2:
needs: setup
Expand All @@ -428,13 +387,13 @@ jobs:
cd example_code/ruby
# https://github.com/Homebrew/homebrew-core/issues/130258
gem install mysql2 -- --with-mysql-dir=$(brew --prefix mysql@8.0)
ruby ConnectTest.rb ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
ruby ConnectTest.rb ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
- name: Run test on ubuntu
if: ${{ matrix.os == 'ubuntu-24.04' }}
run: |
cd example_code/ruby
gem install mysql2
ruby ConnectTest.rb ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }}
ruby ConnectTest.rb ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }}
php_mysqli:
needs: setup
Expand All @@ -459,7 +418,7 @@ jobs:
- name: Run test on ${{ matrix.os }}
run: |
cd example_code/php
php ConnectTest.php ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{matrix.cert}}
php ConnectTest.php ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }} ${{matrix.cert}}
cpp_libmysqlclient:
needs: setup
Expand All @@ -484,11 +443,11 @@ jobs:
flags=$(pkg-config --cflags --libs mysqlclient)
cd example_code/cpp
eval "g++ ConnectTest.cpp -o test $flags"
./test ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{matrix.cert}}
./test ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }} ${{matrix.cert}}
- name: Run test on ubuntu
if: ${{ matrix.os == 'ubuntu-24.04' }}
run: |
sudo apt install -y libmysqlclient-dev
cd example_code/cpp
g++ ConnectTest.cpp -o test -I/usr/include/mysql -lmysqlclient
./test ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.TIDB_CLOUD_PASSWORD }} ${{matrix.cert}}
./test ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ needs.setup.outputs.TIDB_CLOUD_PASSWORD }} ${{matrix.cert}}

0 comments on commit 9f8f544

Please sign in to comment.