ci: pin clang-format-18; replace multi-line STATUS_LONGLONG macro #5
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| tags-ignore: ['**'] | |
| pull_request: | |
| schedule: | |
| - cron: '23 3 * * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PINNED_STOOLAP_VERSION: v0.4.0 | |
| MARIADB_VERSION: '11.4' | |
| jobs: | |
| format: | |
| name: clang-format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install clang-format | |
| # Pin to clang-format-18 (Ubuntu 24.04's default `clang-format`). | |
| # Different major versions disagree on edge cases (notably | |
| # multi-line macro backslash alignment), so the format gate | |
| # needs a fixed target. Local devs: install clang-format-18 | |
| # via apt, brew install llvm@18, or `docker run ubuntu:24.04`. | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang-format-18 | |
| - name: Check formatting | |
| run: clang-format-18 --dry-run --Werror src/*.{cc,h} | |
| # ---------------------------------------------------------------------- | |
| # Build libstoolap.{so,dylib} once per OS/version; share via artifact so | |
| # plugin build / test jobs don't need a Rust toolchain. | |
| # ---------------------------------------------------------------------- | |
| build-lib: | |
| name: Build libstoolap (${{ matrix.version_label }}, ${{ matrix.target }}) | |
| needs: format | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| lib: libstoolap.so | |
| stoolap_version: main | |
| version_label: main | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| lib: libstoolap.dylib | |
| stoolap_version: main | |
| version_label: main | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| lib: libstoolap.so | |
| stoolap_version: v0.4.0 | |
| version_label: pinned | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| lib: libstoolap.dylib | |
| stoolap_version: v0.4.0 | |
| version_label: pinned | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Clone stoolap engine | |
| run: git clone --depth 1 --branch ${{ matrix.stoolap_version }} https://github.com/stoolap/stoolap.git stoolap-engine | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| stoolap-engine/target | |
| ~/.cargo/registry | |
| key: rust-${{ matrix.target }}-${{ matrix.stoolap_version }}-${{ github.sha }} | |
| restore-keys: | | |
| rust-${{ matrix.target }}-${{ matrix.stoolap_version }}- | |
| - name: Build libstoolap | |
| working-directory: stoolap-engine | |
| run: cargo build --release --features ffi | |
| - name: Upload library + header | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: stoolap-${{ matrix.version_label }}-${{ matrix.target }} | |
| path: | | |
| stoolap-engine/target/release/${{ matrix.lib }} | |
| stoolap-engine/include/stoolap.h | |
| if-no-files-found: error | |
| test-macos: | |
| name: Test on macOS (${{ matrix.version_label }}, MariaDB 11.4) | |
| needs: build-lib | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - version_label: main | |
| - version_label: pinned | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install MariaDB ${{ env.MARIADB_VERSION }} | |
| run: | | |
| brew install mariadb@${{ env.MARIADB_VERSION }} cmake | |
| MARIADB_PREFIX="$(brew --prefix)/opt/mariadb@${{ env.MARIADB_VERSION }}" | |
| echo "MARIADB_PREFIX=$MARIADB_PREFIX" >> $GITHUB_ENV | |
| echo "$MARIADB_PREFIX/bin" >> $GITHUB_PATH | |
| - name: Download libstoolap | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: stoolap-${{ matrix.version_label }}-aarch64-apple-darwin | |
| path: stoolap-staging | |
| - name: Stage stoolap (CMakeLists layout) | |
| run: | | |
| mkdir -p stoolap-fake/include stoolap-fake/target/release | |
| cp stoolap-staging/include/stoolap.h stoolap-fake/include/ | |
| cp stoolap-staging/target/release/libstoolap.dylib stoolap-fake/target/release/ | |
| - name: Build plugin | |
| run: | | |
| cmake -S . -B build \ | |
| -DMariaDB_ROOT=$MARIADB_PREFIX \ | |
| -DSTOOLAP_DIR=$PWD/stoolap-fake | |
| cmake --build build -j | |
| - name: Install plugin | |
| run: install -m 0755 build/ha_stoolap.so $MARIADB_PREFIX/lib/plugin/ | |
| - name: Install Python deps | |
| run: python3 -m pip install --break-system-packages --user mysql-connector-python | |
| - name: Run tests | |
| run: python3 tests/runner.py | |
| - name: Upload server log on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-${{ matrix.version_label }}-mariadbd-err | |
| path: /tmp/stoolap-test.err | |
| if-no-files-found: ignore | |
| test-linux: | |
| name: Test on Ubuntu (${{ matrix.version_label }}, MariaDB 11.4) | |
| needs: build-lib | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - version_label: main | |
| - version_label: pinned | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install MariaDB ${{ env.MARIADB_VERSION }} + dev headers | |
| run: | | |
| curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup \ | |
| | sudo bash -s -- --mariadb-server-version=$MARIADB_VERSION --skip-maxscale --skip-tools | |
| sudo apt-get update | |
| sudo apt-get install -y mariadb-server libmariadbd-dev cmake g++ python3-pip | |
| sudo systemctl stop mariadb || true | |
| sudo systemctl disable mariadb || true | |
| echo "MARIADB_PREFIX=/usr" >> $GITHUB_ENV | |
| echo "MARIADBD_BIN=/usr/sbin/mariadbd" >> $GITHUB_ENV | |
| echo "MARIADB_BIN=/usr/bin/mariadb" >> $GITHUB_ENV | |
| echo "MARIADB_INSTALL_DB_BIN=/usr/bin/mariadb-install-db" >> $GITHUB_ENV | |
| if [ -d /usr/lib/mysql/plugin ]; then | |
| echo "MARIADB_PLUGIN_DIR=/usr/lib/mysql/plugin" >> $GITHUB_ENV | |
| else | |
| echo "MARIADB_PLUGIN_DIR=/usr/lib/mariadb/plugin" >> $GITHUB_ENV | |
| fi | |
| - name: Download libstoolap | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: stoolap-${{ matrix.version_label }}-x86_64-unknown-linux-gnu | |
| path: stoolap-staging | |
| - name: Install libstoolap + stage CMakeLists layout | |
| run: | | |
| sudo install -m 0755 stoolap-staging/target/release/libstoolap.so /usr/local/lib/ | |
| sudo ldconfig | |
| mkdir -p stoolap-fake/include stoolap-fake/target/release | |
| cp stoolap-staging/include/stoolap.h stoolap-fake/include/ | |
| cp stoolap-staging/target/release/libstoolap.so stoolap-fake/target/release/ | |
| - name: Build plugin | |
| run: | | |
| cmake -S . -B build \ | |
| -DMariaDB_ROOT=$MARIADB_PREFIX \ | |
| -DSTOOLAP_DIR=$PWD/stoolap-fake | |
| cmake --build build -j$(nproc) | |
| - name: Install plugin | |
| run: sudo install -m 0755 build/ha_stoolap.so $MARIADB_PLUGIN_DIR/ | |
| - name: Install Python deps | |
| run: pip install --user mysql-connector-python | |
| - name: Run tests | |
| run: python3 tests/runner.py | |
| - name: Upload server log on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-${{ matrix.version_label }}-mariadbd-err | |
| path: /tmp/stoolap-test.err | |
| if-no-files-found: ignore |