You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
[TODO-5373] add github action
This commit is contained in:
171
.github/workflows/ci.yml
vendored
Normal file
171
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
---
|
||||
name: Run CI Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['3.*']
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# Run weekly on Sundays at 2 AM UTC
|
||||
- cron: '0 2 * * 0'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
MYSQL_TEST_HOST: mariadb.example.com
|
||||
MYSQL_TEST_PORT: 3306
|
||||
MYSQL_TEST_USER: root
|
||||
MYSQL_TEST_PASSWD: "heyPassw-!*20oRd"
|
||||
MYSQL_TEST_DB: testc
|
||||
|
||||
jobs:
|
||||
|
||||
setup:
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
github.event_name != 'schedule' ||
|
||||
github.ref == 'refs/heads/3.4' ||
|
||||
github.ref == 'refs/heads/3.1' ||
|
||||
github.ref == 'refs/heads/3.2'
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.final-matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: set-matrix
|
||||
name: build matrix
|
||||
uses: rusher/mariadb-test-build-matrix@main
|
||||
with:
|
||||
additional-matrix: '[{"name": "MariaDB 11.4 (local) - windows 2025", "os": "windows-2025", "db-type": "community", "db-tag": "11.4"}]'
|
||||
|
||||
ci-server:
|
||||
name: server ${{ matrix.server.version }} test suite ${{ matrix.server.env && format(' {0}', matrix.server.env) || '' }}
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
server:
|
||||
- version: '10.6'
|
||||
- version: '10.11'
|
||||
- version: '11.4'
|
||||
- version: '11.8'
|
||||
env: TEST_OPTION=--ps-protocol
|
||||
steps:
|
||||
- name: Retrieve server ${{ matrix.server.version }}
|
||||
shell: bash
|
||||
run: |
|
||||
# get latest server
|
||||
git clone -b ${server_branch} https://github.com/mariadb/server ./workdir-server --depth=1
|
||||
env:
|
||||
server_branch: ${{ matrix.server.version }}
|
||||
|
||||
- name: Update libmariadb submodule for PR
|
||||
if: github.event_name == 'pull_request'
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./workdir-server
|
||||
git submodule update --init --remote libmariadb
|
||||
cd libmariadb
|
||||
git fetch origin ${{ github.event.pull_request.head.sha }}
|
||||
git checkout -qf FETCH_HEAD
|
||||
|
||||
- name: Update libmariadb submodule for non-PR
|
||||
if: github.event_name != 'pull_request'
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./workdir-server
|
||||
git submodule set-branch -b ${{ github.ref_name }} libmariadb
|
||||
git submodule sync
|
||||
git submodule update --init --remote libmariadb
|
||||
cd libmariadb
|
||||
git checkout ${{ github.sha }}
|
||||
|
||||
- name: install ubuntu/macos requirement
|
||||
run: |
|
||||
sudo apt install libio-socket-ssl-perl
|
||||
|
||||
- name: Make server
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./workdir-server
|
||||
git add libmariadb
|
||||
mkdir bld
|
||||
cd bld
|
||||
cmake .. -DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_SPIDER=NO -DPLUGIN_TOKUDB=NO
|
||||
make -j9
|
||||
|
||||
- name: Run test suite
|
||||
shell: bash
|
||||
run: |
|
||||
ls -lrt
|
||||
cd ./workdir-server/bld/mysql-test/
|
||||
ls -lrt
|
||||
./mysql-test-run.pl --suite=main,unit ${TEST_OPTION} --parallel=auto --skip-test=session_tracker_last_gtid
|
||||
env:
|
||||
TEST_OPTION: ${{ matrix.server.env.TEST_OPTION }}
|
||||
MYSQL_TEST_HOST: 127.0.0.1
|
||||
|
||||
- name: Archive production artifacts
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
retention-days: 5
|
||||
name: log-files-${{ matrix.server.version }}
|
||||
path: |
|
||||
${{ github.workspace }}/workdir-server/bld/mysql-test/var/**/log/*.err
|
||||
|
||||
ci:
|
||||
name: ${{ matrix.name }}
|
||||
needs: setup
|
||||
timeout-minutes: 50
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: ${{ matrix.continue-on-error || false }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Test Environment
|
||||
id: setup-env
|
||||
uses: rusher/mariadb-test-setup@master
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
db-type: ${{ matrix.db-type }}
|
||||
db-tag: ${{ matrix.db-tag }}
|
||||
test-db-password: ${{ env.MYSQL_TEST_PASSWD }}
|
||||
test-db-database: ${{ env.MYSQL_TEST_DB }}
|
||||
test-db-port: ${{ env.MYSQL_TEST_PORT }}
|
||||
additional-conf: ${{ matrix.additional-conf || '' }}
|
||||
registry-user: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_USER || (secrets.DOCKER_PWD != '' && 'mariadbtest' || '') }}
|
||||
registry-password: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_TOKEN || secrets.DOCKER_PWD }}
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: make ubuntu/macos
|
||||
if: ${{ !startsWith(matrix.os, 'windows') }}
|
||||
run: |
|
||||
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_EXTERNAL_ZLIB=On
|
||||
make
|
||||
|
||||
- name: make windows
|
||||
if: ${{ startsWith(matrix.os, 'windows') }}
|
||||
run: |
|
||||
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_CURL=ON
|
||||
cmake --build . --config RelWithDebInfo
|
||||
|
||||
- name: Run test suite
|
||||
shell: bash
|
||||
run: |
|
||||
cd unittest/libmariadb
|
||||
ctest -V
|
||||
env:
|
||||
MARIADB_CC_TEST: 1
|
||||
MYSQL_TEST_TLS: 0
|
||||
srv: ${{ matrix.db-type }}
|
||||
MARIADB_PLUGIN_DIR: ${{ github.workspace }}
|
@@ -1663,8 +1663,13 @@ int display_extended_field_attribute(MYSQL *mysql)
|
||||
|
||||
static int test_ext_field_attr(MYSQL *mysql)
|
||||
{
|
||||
if (!is_mariadb)
|
||||
{
|
||||
diag("feature not supported by MySQL server");
|
||||
return SKIP;
|
||||
}
|
||||
display_extended_field_attribute(mysql);
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@@ -99,6 +99,10 @@ if (IS_MAXSCALE()) \
|
||||
return SKIP; \
|
||||
}
|
||||
|
||||
#define IS_ENTERPRISE()\
|
||||
((mysql_default && strstr(mysql_get_server_info(mysql_default), "enterprise")) ||\
|
||||
(getenv("srv")!=NULL && (strcmp(getenv("srv"), "enterprise"))))
|
||||
|
||||
#define IS_XPAND()\
|
||||
((mysql_default && strstr(mysql_get_server_info(mysql_default), "Xpand")) ||\
|
||||
(getenv("srv")!=NULL && strcmp(getenv("srv"), "xpand") == 0))
|
||||
|
@@ -458,8 +458,12 @@ static int test_pw_check(MYSQL *my)
|
||||
char query[1024];
|
||||
int ret= FAIL;
|
||||
|
||||
sprintf(query, "DROP USER IF EXISTS '%s'@'%s'", "tlsuser", this_host);
|
||||
rc= mysql_query(my, query);
|
||||
check_mysql_rc(rc, my);
|
||||
|
||||
/* connect with password */
|
||||
sprintf(query, "CREATE OR REPLACE USER '%s'@'%s' IDENTIFIED BY '%s'", "tlsuser", this_host, strong_pwd);
|
||||
sprintf(query, "CREATE USER '%s'@'%s' IDENTIFIED BY '%s'", "tlsuser", this_host, strong_pwd);
|
||||
rc= mysql_query(my, query);
|
||||
check_mysql_rc(rc, my);
|
||||
|
||||
@@ -480,9 +484,13 @@ static int test_pw_check(MYSQL *my)
|
||||
mysql= mysql_init(NULL);
|
||||
|
||||
/* connect without pasword */
|
||||
if (!local_safe_connection)
|
||||
if (!IS_ENTERPRISE() && !local_safe_connection)
|
||||
{
|
||||
sprintf(query, "CREATE OR REPLACE USER '%s'@'%s'", "tlsuser", this_host);
|
||||
sprintf(query, "DROP USER '%s'@'%s'", "tlsuser", this_host);
|
||||
rc= mysql_query(my, query);
|
||||
check_mysql_rc(rc, my);
|
||||
|
||||
sprintf(query, "CREATE USER '%s'@'%s'", "tlsuser", this_host);
|
||||
rc= mysql_query(my, query);
|
||||
check_mysql_rc(rc, my);
|
||||
|
||||
@@ -499,8 +507,11 @@ static int test_pw_check(MYSQL *my)
|
||||
mysql_optionsv(mysql, MARIADB_OPT_RESTRICTED_AUTH, "mysql_native_password, mysql_old_password");
|
||||
|
||||
diag("expected to fail with old_password plugin");
|
||||
sprintf(query, "DROP USER '%s'@'%s'", "tlsuser", this_host);
|
||||
rc= mysql_query(my, query);
|
||||
check_mysql_rc(rc, my);
|
||||
/* Test with an authentication plugin, which doesn't support hashing */
|
||||
sprintf(query, "CREATE OR REPLACE USER '%s'@'%s' IDENTIFIED VIA mysql_old_password USING '7c786c222596437b'", "tlsuser", this_host);
|
||||
sprintf(query, "CREATE USER '%s'@'%s' IDENTIFIED VIA mysql_old_password USING '7c786c222596437b'", "tlsuser", this_host);
|
||||
rc= mysql_query(my, query);
|
||||
check_mysql_rc(rc, my);
|
||||
rc= mysql_query(my, "SET GLOBAL secure_auth=0");
|
||||
@@ -719,6 +730,13 @@ static int test_env_var(MYSQL *my __attribute__((unused)))
|
||||
MYSQL *mysql= mysql_init(NULL);
|
||||
int rc= FAIL;
|
||||
|
||||
if (mysql_get_server_version(my) < 110400)
|
||||
{
|
||||
diag("skipping for MySQL / mariadb before 11.4, because might not have ssl on");
|
||||
rc = SKIP;
|
||||
goto end;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
_putenv_s("MARIADB_TLS_DISABLE_PEER_VERIFICATION", "1");
|
||||
#else
|
||||
|
Reference in New Issue
Block a user