Serverless Driver Compatibility Test #499
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Serverless Driver Compatibility Test | |
on: | |
schedule: | |
- cron: "0 22 * * *" # every day at 22:00 | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 10 | |
steps: | |
- 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 | |
outputs: | |
TiDB_CLOUD_USER: ${{ env.TIDB_CLOUD_USER }} | |
TiDB_CLOUD_HOST: ${{ env.TIDB_CLOUD_HOST }} | |
mysql: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
include: | |
- os: ubuntu-24.04 | |
cert: /etc/ssl/certs/ca-certificates.crt | |
- os: macos-14 | |
cert: /etc/ssl/cert.pem | |
- os: windows-2022 | |
cert: ./example_code/x1.pem | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get mysql | |
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 }} | |
no_tls: | |
needs: setup | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
port: [ 4000, 3306 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get mysql | |
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 }}" | |
invalid_tls_version: | |
needs: setup | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
tls: [ TLSv1, TLSv1.1 ] | |
port: [ 4000, 3306 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Run test on ${{ matrix.tls }} | |
run: | | |
# 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 }} | |
valid_tls_version: | |
needs: setup | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
tls: [ TLSv1.2, TLSv1.3 ] | |
port: [ 4000, 3306 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Run test on ${{ matrix.tls }} | |
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 }} | |
mycli: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
include: | |
- os: ubuntu-24.04 | |
cert: /etc/ssl/certs/ca-certificates.crt | |
- os: macos-14 | |
cert: /etc/ssl/cert.pem | |
- os: windows-2022 | |
cert: ./example_code/x1.pem | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install python | |
uses: actions/setup-python@v5 | |
- name: Install mycli | |
run: pip3 install mycli --break-system-packages | |
- 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}} | |
java_jdbc: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Run test on ubuntu or macos | |
if: ${{ matrix.os != 'windows-2022' }} | |
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 }} | |
- 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 }} | |
# https://jira.mariadb.org/browse/CONJ-1023 | |
java_jdbc_mariadb_CONJ-1023: | |
needs: setup | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Run test | |
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 }} | |
python_mysqlclient: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
include: | |
- os: ubuntu-24.04 | |
cert: /etc/ssl/certs/ca-certificates.crt | |
- os: macos-14 | |
cert: /etc/ssl/cert.pem | |
- os: windows-2022 | |
cert: ../x1.pem | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Install mysql in macos | |
if: ${{ matrix.os == 'macos-14' }} | |
run: | | |
brew install [email protected] | |
export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig" | |
pip3 install mysqlclient --break-system-packages | |
- name: Run test on ${{ matrix.os }} | |
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 }} | |
python_mysql_connector: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
include: | |
- os: ubuntu-24.04 | |
cert: /etc/ssl/certs/ca-certificates.crt | |
- os: macos-14 | |
cert: /etc/ssl/cert.pem | |
- os: windows-2022 | |
cert: ../x1.pem | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Run test on ${{ matrix.os }} | |
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 }} | |
python_pymysql: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
include: | |
- os: ubuntu-24.04 | |
cert: /etc/ssl/certs/ca-certificates.crt | |
- os: macos-14 | |
cert: /etc/ssl/cert.pem | |
- os: windows-2022 | |
cert: ../x1.pem | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Run test on ${{ matrix.os }} | |
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 }} | |
python_sqlalchemy: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
include: | |
- os: ubuntu-24.04 | |
cert: /etc/ssl/certs/ca-certificates.crt | |
- os: macos-14 | |
cert: /etc/ssl/cert.pem | |
- os: windows-2022 | |
cert: ../x1.pem | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- name: Install mysql in macos | |
if: ${{ matrix.os == 'macos-14' }} | |
run: | | |
brew install [email protected] | |
export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig" | |
pip3 install mysqlclient --break-system-packages | |
- name: Run test on ${{ matrix.os }} | |
run: | | |
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 }} | |
go_godriver: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'example_code/go/go.mod' | |
cache-dependency-path: 'example_code/go/go.sum' | |
- name: Run test on ${{ matrix.os }} | |
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_gorm: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'example_code/gorm/go.mod' | |
cache-dependency-path: 'example_code/gorm/go.sum' | |
- name: Run test on ${{ matrix.os }} | |
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 }} | |
node_mysql2: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
- name: Run test on ${{ matrix.os }} | |
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_sequelize: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
- name: Run test on ${{ matrix.os }} | |
run: | | |
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 }} | |
rust_mysql: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ windows-2022, macos-14 ] # skip ubuntu-24.04 as it get stuck for unknown reasons | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- 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 }} | |
ruby_mysql2: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, macos-14 ] # install mysql2 in windows is a little difficult, dismiss it for now | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0' # Not needed with a .ruby-version file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Install mysql on macos | |
if: ${{ matrix.os == 'macos-14' }} | |
run: | | |
brew install [email protected] | |
cd example_code/ruby | |
# https://github.com/Homebrew/homebrew-core/issues/130258 | |
gem install mysql2 -- --with-mysql-dir=$(brew --prefix [email protected]) | |
ruby ConnectTest.rb ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{ secrets.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 }} | |
php_mysqli: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, windows-2022, macos-14 ] | |
include: | |
- os: ubuntu-24.04 | |
cert: /etc/ssl/certs/ca-certificates.crt | |
- os: macos-14 | |
cert: /etc/ssl/cert.pem | |
- os: windows-2022 | |
cert: ../x1.pem | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
ini-values: extension=php_mysqli.dll | |
- 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}} | |
cpp_libmysqlclient: | |
needs: setup | |
strategy: | |
matrix: | |
os: [ ubuntu-24.04, macos-14 ] | |
include: | |
- os: ubuntu-24.04 | |
cert: /etc/ssl/certs/ca-certificates.crt | |
- os: macos-14 | |
cert: /etc/ssl/cert.pem | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: rlalik/[email protected] | |
- name: Run test on macos | |
if: ${{ matrix.os == 'macos-14' }} | |
run: | | |
brew install [email protected] | |
export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig" | |
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}} | |
- 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}} |