calog/vendor/mariadb/.github/workflows/ci.yml

212 lines
7.1 KiB
YAML
Vendored

---
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
jobs:
setup:
runs-on: ubuntu-latest
if: |
github.event_name != 'schedule' ||
startsWith(github.ref, 'refs/heads/3.4') ||
startsWith(github.ref, 'refs/heads/3.2') ||
startsWith(github.ref, 'refs/heads/3.1')
outputs:
matrix: ${{ steps.set-matrix.outputs.final-matrix }}
steps:
- uses: actions/checkout@v6
- id: set-matrix
name: build matrix
uses: mariadb-corporation/connector-ci-build-matrix@main
with:
additional-matrix: '[{"name": "MariaDB 11.4 (local) - windows 2025", "os": "windows-2025", "db-type": "community", "db-tag": "11.4"},{"name": "MariaDB 11.4 32bits (local) - windows 2025", "os": "windows-2025", "db-type": "community", "db-tag": "11.4", "arch": "32"}]'
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:
fail-fast: false
matrix:
server:
- 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 .. -DWITHOUT_DYNAMIC_PLUGINS=1
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 error logs
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-clang:
name: clang build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: install clang
run: |
sudo apt-get update
sudo apt-get install -y clang
- name: build with clang
run: |
clang --version
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_EXTERNAL_ZLIB=On \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
make -j$(nproc)
ci:
name: ${{ matrix.name }}
needs: setup
timeout-minutes: 50
env:
MYSQL_TEST_HOST: mariadb.example.com
MYSQL_TEST_PORT: 3306
MYSQL_TEST_USER: testuser
MYSQL_TEST_PASSWD: "heyPassw-!*20oRd"
MYSQL_TEST_DB: testc
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || matrix.os == 'macos-latest' }}
steps:
- uses: actions/checkout@v6
- name: Setup Test Environment
id: setup-env
uses: mariadb-corporation/connector-ci-setup@master
with:
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_TOKEN != '' && secrets.DOCKER_LOGIN || '') }}
registry-password: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_TOKEN || secrets.DOCKER_TOKEN }}
os: ${{ matrix.os }}
maxscale-tag: ${{ matrix.maxscale-tag || ''}}
- name: make ubuntu/macos
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_EXTERNAL_ZLIB=On
make
- name: make windows 64bits
if: ${{ startsWith(matrix.os, 'windows') && (matrix.arch != '32' || !matrix.arch) }}
run: |
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_CURL=ON -DWITH_MSI=ON
cmake --build . --config RelWithDebInfo
- name: make windows 32bits
if: ${{ startsWith(matrix.os, 'windows') && startsWith(matrix.arch, '32') }}
run: |
cmake -A Win32 . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_CURL=ON -DWITH_MSI=ON
cmake --build . --config RelWithDebInfo
- name: Run test suite
shell: bash
run: |
cd unittest/libmariadb
ctest -V --output-on-failure
env:
MARIADB_CC_TEST: 1
MYSQL_TEST_TLS: 0
MYSQL_TEST_SSL_PORT: ${{ env.TEST_MAXSCALE_TLS_PORT }}
srv: ${{ matrix.db-type }}
MAXSCALE_TAG: ${{ matrix.maxscale-tag || '' }}
MARIADB_PLUGIN_DIR: ${{ github.workspace }}
- name: MaxScale logs on failure
if: ${{ failure() && matrix.maxscale-tag != '' && !startsWith(matrix.os, 'windows') }}
shell: bash
run: |
echo "============================="
echo "=== MaxScale container(s) ==="
echo "============================="
podman ps -a --filter "name=maxscale" --format '{{.Names}} {{.Image}} {{.Status}}' || true
for c in $(podman ps -a --filter "name=maxscale" --format '{{.Names}}'); do
echo ""
echo "=== podman logs: $c ==="
podman logs "$c" 2>&1 | tail -n 500 || true
echo ""
echo "=== /var/log/maxscale/maxscale.log in $c ==="
podman exec "$c" sh -c 'tail -n 500 /var/log/maxscale/maxscale.log 2>/dev/null || cat /var/log/maxscale/maxscale.log 2>/dev/null' || true
done