mirror of https://github.com/sysown/proxysql
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
255 lines
10 KiB
255 lines
10 KiB
name: CI-mysqlx
|
|
run-name: '${{ github.event.workflow_run && github.event.workflow_run.head_branch || github.ref_name }} ${{ github.workflow }} ${{ github.event.workflow_run && github.event.workflow_run.head_sha || github.sha }}'
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_run:
|
|
workflows: [ CI-trigger ]
|
|
types: [ completed ]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.workflow_run && github.event.workflow_run.head_branch || github.ref_name }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
unit-tests:
|
|
if: ${{ github.event.workflow_run && github.event.workflow_run.conclusion == 'success' || ! github.event.workflow_run }}
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout (sparse — test/tap)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
include
|
|
src/proxysql_global.cpp
|
|
test/tap
|
|
plugins/mysqlx
|
|
test/scripts
|
|
|
|
- name: Restore build cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
src/proxysql
|
|
test/
|
|
key: build-${{ github.event.workflow_run && github.event.workflow_run.head_sha || github.sha }}
|
|
# Strict cache dependency when CI-trigger populated the cache
|
|
# upstream; lenient on manual workflow_dispatch so a missing cache
|
|
# doesn't block an ad-hoc run.
|
|
fail-on-cache-miss: ${{ github.event_name == 'workflow_run' }}
|
|
|
|
- name: Build mysqlx plugin
|
|
# PROXYSQL40=1 (and the implied tier flags) MUST match what the
|
|
# cached src/proxysql was built with — otherwise the plugin .so
|
|
# is compiled with a different ProxySQL_PluginDescriptor /
|
|
# ProxySQL_PluginServices struct layout than the loader sees, the
|
|
# link succeeds, and the first virtual dispatch into a plugin
|
|
# callback corrupts memory. See plugins/mysqlx/Makefile:56-61.
|
|
run: |
|
|
chmod +x src/proxysql 2>/dev/null || true
|
|
cd plugins/mysqlx && PROXYSQL40=1 PROXYSQL31=1 PROXYSQLFFTO=1 PROXYSQLTSDB=1 PROXYSQLGENAI=1 make
|
|
|
|
- name: Run mysqlx unit tests
|
|
run: |
|
|
export SKIP_PROXYSQL=1
|
|
cd test/tap/tests/unit
|
|
for test_bin in mysqlx_*_unit-t plugin_*_unit-t; do
|
|
if [ -x "$test_bin" ]; then
|
|
echo "Running $test_bin..."
|
|
./"$test_bin" || exit 1
|
|
fi
|
|
done
|
|
|
|
e2e-tests:
|
|
if: ${{ github.event.workflow_run && github.event.workflow_run.conclusion == 'success' || ! github.event.workflow_run }}
|
|
runs-on: ubuntu-22.04
|
|
needs: unit-tests
|
|
steps:
|
|
- name: Checkout (sparse)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
include
|
|
src/proxysql_global.cpp
|
|
test/tap
|
|
plugins/mysqlx
|
|
test/scripts
|
|
|
|
- name: Restore build cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
src/proxysql
|
|
test/
|
|
key: build-${{ github.event.workflow_run && github.event.workflow_run.head_sha || github.sha }}
|
|
# Strict cache dependency when CI-trigger populated the cache
|
|
# upstream; lenient on manual workflow_dispatch so a missing cache
|
|
# doesn't block an ad-hoc run.
|
|
fail-on-cache-miss: ${{ github.event_name == 'workflow_run' }}
|
|
|
|
- name: Build mysqlx plugin
|
|
# PROXYSQL40=1 (and the implied tier flags) MUST match what the
|
|
# cached src/proxysql was built with — otherwise the plugin .so
|
|
# is compiled with a different ProxySQL_PluginDescriptor /
|
|
# ProxySQL_PluginServices struct layout than the loader sees, the
|
|
# link succeeds, and the first virtual dispatch into a plugin
|
|
# callback corrupts memory. See plugins/mysqlx/Makefile:56-61.
|
|
run: |
|
|
chmod +x src/proxysql 2>/dev/null || true
|
|
cd plugins/mysqlx && PROXYSQL40=1 PROXYSQL31=1 PROXYSQLFFTO=1 PROXYSQLTSDB=1 PROXYSQLGENAI=1 make
|
|
|
|
- name: Install dbdeployer
|
|
run: |
|
|
curl -s https://raw.githubusercontent.com/ProxySQL/dbdeployer/master/scripts/dbdeployer-install.sh | bash
|
|
dbdeployer --version
|
|
|
|
- name: Download and unpack MySQL 8.4
|
|
run: |
|
|
dbdeployer downloads get-by-version 8.4 --newest --minimal
|
|
TARBALL=$(ls -t mysql-8.4.*.tar.xz 2>/dev/null | head -1)
|
|
dbdeployer unpack "$TARBALL"
|
|
|
|
- name: Deploy MySQL 8.4 sandbox
|
|
run: |
|
|
VERSION=$(ls $HOME/opt/mysql/ | grep '^8\.4' | head -1)
|
|
dbdeployer deploy single "$VERSION"
|
|
SANDBOX="$HOME/sandboxes/msb_${VERSION//./_}"
|
|
"$SANDBOX/start"
|
|
|
|
# Wait for MySQL to be ready
|
|
for i in $(seq 1 30); do
|
|
if "$SANDBOX/use" -e "SELECT 1" &>/dev/null; then
|
|
echo "MySQL $VERSION is ready"
|
|
break
|
|
fi
|
|
sleep 2
|
|
done
|
|
|
|
# Create test user
|
|
"$SANDBOX/use" -e "
|
|
CREATE USER IF NOT EXISTS 'mysqlx_test'@'%' IDENTIFIED WITH mysql_native_password BY 'mysqlx_test';
|
|
GRANT ALL PRIVILEGES ON *.* TO 'mysqlx_test'@'%';
|
|
FLUSH PRIVILEGES;
|
|
"
|
|
|
|
- name: Verify X Protocol
|
|
run: |
|
|
for i in $(seq 1 30); do
|
|
if timeout 2 bash -c "echo > /dev/tcp/127.0.0.1/33060" 2>/dev/null; then
|
|
echo "X Protocol is listening on port 33060"
|
|
exit 0
|
|
fi
|
|
sleep 2
|
|
done
|
|
echo "ERROR: X Protocol not available on port 33060"
|
|
exit 1
|
|
|
|
- name: Run mysqlx integration and E2E tests
|
|
run: |
|
|
# Source the group env file so every MYSQLX_E2E_* variable the tests
|
|
# look for is defined — especially MYSQLX_E2E_PROXYSQL_PORT, without
|
|
# which test_mysqlx_e2e_routing-t silently skips.
|
|
source test/tap/groups/mysqlx-e2e/env.sh
|
|
cd test/tap/tests
|
|
# Run all test_mysqlx_*-t binaries. The glob covers e2e tests
|
|
# (test_mysqlx_e2e_*) plus the integration smoke tests
|
|
# (test_mysqlx_admin_tables, test_mysqlx_plugin_load) that
|
|
# previously went unrun. test_mysqlx_listener_smoke was
|
|
# retired with the dormant MysqlxWorker path in 98aee7db2.
|
|
ran_any=0
|
|
for test_bin in test_mysqlx_*-t; do
|
|
if [ -x "$test_bin" ]; then
|
|
echo "Running $test_bin..."
|
|
./"$test_bin" || exit 1
|
|
ran_any=1
|
|
fi
|
|
done
|
|
if [ "$ran_any" = "0" ]; then
|
|
echo "ERROR: no test_mysqlx_*-t binaries were found"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Cleanup sandbox
|
|
if: always()
|
|
run: |
|
|
VERSION=$(ls $HOME/opt/mysql/ | grep '^8\.4' | head -1 || echo "")
|
|
if [ -n "$VERSION" ]; then
|
|
dbdeployer delete single "$VERSION" 2>/dev/null || true
|
|
fi
|
|
|
|
soak-tests:
|
|
# mysqlx-soak group: runs the harness scripts (behavioural validation
|
|
# + short stress) inside the docker-isolated TAP harness. Distinct
|
|
# from e2e-tests which uses dbdeployer locally and SKIP_PROXYSQL=1;
|
|
# this job stands up a real ProxySQL container with the chassis
|
|
# loaded and exercises the plugin end-to-end. See
|
|
# test/tap/groups/mysqlx-soak/README.md for the design and the
|
|
# remaining work items beyond what this job covers.
|
|
if: ${{ github.event.workflow_run && github.event.workflow_run.conclusion == 'success' || ! github.event.workflow_run }}
|
|
runs-on: ubuntu-22.04
|
|
needs: unit-tests
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Restore build cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
src/proxysql
|
|
test/
|
|
key: build-${{ github.event.workflow_run && github.event.workflow_run.head_sha || github.sha }}
|
|
fail-on-cache-miss: ${{ github.event_name == 'workflow_run' }}
|
|
|
|
- name: Build mysqlx plugin
|
|
# Same flags as the unit-tests / e2e-tests jobs — the plugin .so
|
|
# MUST be ABI-compatible with the cached src/proxysql binary.
|
|
run: |
|
|
chmod +x src/proxysql 2>/dev/null || true
|
|
cd plugins/mysqlx && PROXYSQL40=1 PROXYSQL31=1 PROXYSQLFFTO=1 PROXYSQLTSDB=1 PROXYSQLGENAI=1 make
|
|
|
|
- name: Build proxysql-ci-base image
|
|
# The image now includes mysql-connector-python so the harness
|
|
# scripts (Python X DevAPI) can run in the test-runner container.
|
|
run: |
|
|
cd test/infra/docker-base
|
|
docker build --network host -t proxysql-ci-base:latest .
|
|
|
|
- name: Bring up infrastructure (dbdeployer-mysql84 + ProxySQL with mysqlx plugin)
|
|
run: |
|
|
export WORKSPACE="${GITHUB_WORKSPACE}"
|
|
export INFRA_ID="mysqlx-soak-${GITHUB_RUN_ID}"
|
|
export TAP_GROUP="mysqlx-soak"
|
|
[ -f test/infra/common/env.sh ] && source test/infra/common/env.sh
|
|
./test/infra/control/ensure-infras.bash
|
|
|
|
- name: Run mysqlx-soak TAP tests (behavioural + short stress)
|
|
run: |
|
|
export WORKSPACE="${GITHUB_WORKSPACE}"
|
|
export INFRA_ID="mysqlx-soak-${GITHUB_RUN_ID}"
|
|
export TAP_GROUP="mysqlx-soak-g1"
|
|
# Keep stress short for CI; long soaks invoke stress.py
|
|
# directly with --duration 24h on staging (issue #5677).
|
|
export MYSQLX_SOAK_DURATION="60s"
|
|
export MYSQLX_SOAK_CONCURRENT="20"
|
|
[ -f test/infra/common/env.sh ] && source test/infra/common/env.sh
|
|
./test/infra/control/run-tests-isolated.bash
|
|
|
|
- name: Cleanup
|
|
if: always()
|
|
run: |
|
|
export WORKSPACE="${GITHUB_WORKSPACE}"
|
|
export INFRA_ID="mysqlx-soak-${GITHUB_RUN_ID}"
|
|
export TAP_GROUP="mysqlx-soak"
|
|
[ -f test/infra/common/env.sh ] && source test/infra/common/env.sh
|
|
./test/infra/control/stop-proxysql-isolated.bash || true
|
|
./test/infra/control/destroy-infras.bash || true
|
|
|
|
- name: Archive logs
|
|
if: ${{ failure() && !cancelled() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mysqlx-soak-logs-${{ github.run_number }}
|
|
path: |
|
|
ci_infra_logs/
|