Skip to content

feat(ML):revise ml active impl #1654

feat(ML):revise ml active impl

feat(ML):revise ml active impl #1654

Workflow file for this run

# Workflow: ShannonBase Compile & MTR
# Purpose: Builds and tests ShannonBase (MySQL-based project) on x86 and ARM architectures
# Triggers:
# - Push to any branch except 'main', excluding paths like Docs, markdown, and non-code files
# - Pull requests, excluding the same non-code paths
# Jobs:
# - lint: Checks code formatting for storage/rapid_engine and ml directories
# - build_x86: Builds and runs MTR tests on x86 with AddressSanitizer enabled
# - build_arm: Builds and runs MTR tests on ARM with AddressSanitizer and a skip-test list
# Notes:
# - Uses concurrency to cancel in-progress runs for the same workflow/ref/event
# - Includes disk space optimizations to prevent 'No space left on device' errors
# - Uses AddressSanitizer (--sanitize) with leak detection and suppression file
# - Commented-out alternative test commands (collections/default.push) for future use with faster runners
# - lint job adjusted to handle non-PR events (push) by checking github.event_name
#
# Copyright (c) 2023, 2024, 2025 Shannon Data AI and/or its affiliates.
name: ShannonBase Compile & MTR
on:
push:
branches-ignore:
- main
paths-ignore:
- 'Docs/**'
- 'docs/**'
- 'website/**'
- '**.md'
- 'scripts/setup/**'
- '.devcontainer/**'
- '.github/ISSUE_TEMPLATE/**'
pull_request:
paths-ignore:
- 'Docs/**'
- 'docs/**'
- 'website/**'
- '**.md'
- '.github/ISSUE_TEMPLATE/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
PROTOC: protoc
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true # Add this to Node24
defaults:
run:
shell: bash
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure clang-format is available
run: |
command -v clang-format-14 > /dev/null || (sudo apt-get update && sudo apt-get install -y clang-format-14)
- name: Format check
run: |
git diff -U0 --no-color ${{ github.event.pull_request.base.sha }} HEAD storage/rapid_engine ml | /usr/share/clang/clang-format-14/clang-format-diff.py -p1 | tee /tmp/.clang-format-diff
[ -s /tmp/.clang-format-diff ] && exit 1 || true
# x86
build_x86:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Clean old build cache
run: |
rm -rf ${{ github.workspace }}/cmake_build
- name: Install x86 dependencies
run: |
sudo apt update -y
sudo apt install -y libtirpc-dev libboost-all-dev libexpect-perl
- name: Build and install (x86)
run: |
cd ${{ github.workspace }}
mkdir cmake_build && cd cmake_build
sudo mkdir -p /home/shannon-bin && sudo mkdir -p /home/shannon-bin/data
sudo chown -R $USER:$USER /home/shannon-bin/
git config --global --add safe.directory ${{ github.workspace }}
git fetch --tags -f
cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/home/shannon-bin/ \
-DMYSQL_DATADIR=/home/shannon-bin/data \
-DSYSCONFDIR=/home/shannon-bin/ \
-DMYSQL_UNIX_ADDR=/home/shannon-bin/temp/mysql.sock \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PROTOBUF=bundled \
-DWITH_UNIT_TESTS=OFF \
-DWITH_HYPERGRAPH_OPTIMIZER=ON \
-DCOMPILATION_COMMENT="MySQL Community Server, and Shannon Data AI Alpha V."
make -j"$(nproc)" && sudo make install
sudo find /home/shannon-bin/bin -type f -executable -exec strip --strip-unneeded {} \; || true
- name: Clean up build
run: |
sudo rm -rf ${{ github.workspace }}/*
sudo apt-get clean -y
sudo apt-get autoremove -y --purge
sudo rm -rf /var/lib/apt/lists/*
sudo rm -rf /var/log/* /var/cache/*
sudo rm -rf /tmp/* /var/tmp/*
sudo rm -rf ~/.cache/* ~/.npm/* ~/.gem/*
sudo rm -rf /home/runner/.cache/* /home/runner/.docker/*
- name: Run MTR tests (x86)
run: |
sudo mkdir -p /home/shannon-bin/log
sudo chown -R $USER:$USER /home/shannon-bin/
cd /home/shannon-bin/mysql-test/
sudo chmod -R u+rwx mysql-test-run.pl
export ASAN_OPTIONS="detect_leaks=1"
export LSAN_OPTIONS="suppressions=/home/shannon-bin/mysql-test/lsan.supp"
./mysql-test-run.pl --mysqld=--loose-rapid_schema_embedding=OFF --sanitize --suite=main,innodb,binlog,binlog_gtid,binlog_nogtid,federated,rpl,rpl_gtid,rpl_nogtid,funcs_1,funcs_2,\
information_schema,secondary_engine,ml,sys_vars,innodb_zip \
--mysqld=--user=$USER --mysqld=--default-storage-engine=innodb --nowarnings --force --nocheck-testcases --retry=3 --parallel=$(nproc)
# when we have a fast git action runner, we can use the following command to run the test.
# sudo chmod -R u+rwx mysql-test-run.pl && sudo chmod +x ./collections/default.push
#./collections/default.push
# ARM
build_arm:
needs: lint
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Clean old build cache
run: |
rm -rf ${{ github.workspace }}/cmake_build
- name: Install ARM dependencies
run: |
sudo apt update -y
sudo apt install -y libtirpc-dev libboost-all-dev libjson-perl libexpect-perl
- name: Build and install (ARM)
run: |
cd ${{ github.workspace }}
mkdir cmake_build && cd cmake_build
sudo mkdir -p /home/shannon-bin && sudo mkdir -p /home/shannon-bin/data
sudo chown -R $USER:$USER /home/shannon-bin/
git config --global --add safe.directory ${{ github.workspace }}
git fetch --tags -f
cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/home/shannon-bin/ \
-DMYSQL_DATADIR=/home/shannon-bin/data \
-DSYSCONFDIR=/home/shannon-bin/ \
-DMYSQL_UNIX_ADDR=/home/shannon-bin/temp/mysql.sock \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PROTOBUF=bundled \
-DWITH_UNIT_TESTS=OFF \
-DWITH_HYPERGRAPH_OPTIMIZER=ON \
-DCMAKE_C_FLAGS="-march=armv8-a -O2" \
-DCMAKE_CXX_FLAGS="-march=armv8-a -O2" \
-DCOMPILATION_COMMENT="MySQL Community Server, and Shannon Data AI Alpha V."
make -j"$(nproc)" && sudo make install
sudo find /home/shannon-bin/bin -type f -executable -exec strip --strip-unneeded {} \; || true
- name: Clean up build
run: |
sudo rm -rf ${{ github.workspace }}/*
sudo apt-get clean -y
sudo apt-get autoremove -y --purge
sudo rm -rf /var/lib/apt/lists/*
sudo rm -rf /var/log/* /var/cache/*
sudo rm -rf /tmp/* /var/tmp/*
sudo rm -rf ~/.cache/* ~/.npm/* ~/.gem/*
sudo rm -rf /home/runner/.cache/* /home/runner/.docker/*
- name: Run MTR tests (ARM)
run: |
sudo mkdir -p /home/shannon-bin/log
sudo chown -R $USER:$USER /home/shannon-bin/
cd /home/shannon-bin/mysql-test/
sudo chmod -R u+rwx mysql-test-run.pl
export ASAN_OPTIONS="detect_leaks=1"
export LSAN_OPTIONS="suppressions=/home/shannon-bin/mysql-test/lsan.supp"
./mysql-test-run.pl --mysqld=--loose-rapid_schema_embedding=OFF --sanitize --suite=main,innodb,innodb_zip,secondary_engine,ml,sys_vars \
--mysqld=--user=$USER --mysqld=--default-storage-engine=innodb --nowarnings --force --nocheck-testcases --retry=3 --parallel=$(nproc)
# when we have a fast git action runner, we can use the following command to run the test.
# sudo chmod -R u+rwx mysql-test-run.pl && sudo chmod +x ./collections/default.push
#./collections/default.push