Skip to content

Commit bf1fcb3

Browse files
committed
[TODO-5373] add github action CI
(cherry picked from commit 0c0fd88)
1 parent 383e7b0 commit bf1fcb3

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
name: Run CI Tests
3+
4+
on:
5+
push:
6+
branches:
7+
pull_request:
8+
workflow_dispatch:
9+
schedule:
10+
# Run weekly on Sundays at 2 AM UTC
11+
- cron: '0 2 * * 0'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: false
16+
17+
env:
18+
MYSQL_TEST_HOST: mariadb.example.com
19+
MYSQL_TEST_PORT: 3306
20+
MYSQL_TEST_USER: root
21+
MYSQL_TEST_PASSWD: "heyPassw+-_20oRd"
22+
MYSQL_TEST_DB: testcpp
23+
24+
jobs:
25+
setup:
26+
runs-on: ubuntu-latest
27+
# Only run scheduled jobs if we're on the right branch
28+
if: github.event_name != 'schedule' || contains(fromJSON('["1.0", "1.1"]'), github.ref_name)
29+
outputs:
30+
matrix: ${{ steps.set-matrix.outputs.final-matrix }}
31+
steps:
32+
- uses: actions/checkout@v4
33+
- id: set-matrix
34+
name: build matrix
35+
uses: rusher/mariadb-test-build-matrix@main
36+
with:
37+
additional-matrix: '[]'
38+
39+
ci:
40+
name: ${{ matrix.name }}
41+
needs: setup
42+
timeout-minutes: 50
43+
strategy:
44+
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
45+
46+
runs-on: ${{ matrix.os }}
47+
continue-on-error: ${{ matrix.continue-on-error || matrix.os == 'macos-latest' }}
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Setup Test Environment
52+
id: setup-env
53+
uses: rusher/mariadb-test-setup@master
54+
with:
55+
node-version: ${{ matrix.node }}
56+
db-type: ${{ matrix.db-type }}
57+
db-tag: ${{ matrix.db-tag }}
58+
test-db-password: ${{ env.MYSQL_TEST_PASSWD }}
59+
test-db-database: ${{ env.MYSQL_TEST_DB }}
60+
test-db-port: ${{ env.MYSQL_TEST_PORT }}
61+
additional-conf: ${{ matrix.additional-conf || '' }}
62+
registry-user: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_USER || (secrets.DOCKER_PWD != '' && 'mariadbtest' || '') }}
63+
registry-password: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_TOKEN || secrets.DOCKER_PWD }}
64+
os: ${{ matrix.os }}
65+
66+
- name: make ubuntu
67+
if: ${{ startsWith(matrix.os, 'ubuntu') }}
68+
run: |
69+
sudo apt install unixodbc-dev
70+
cmake -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=OPENSSL -DTEST_HOST="jdbc:mariadb://${{ env.MYSQL_TEST_HOST }}:${{ env.MYSQL_TEST_PORT }}" .
71+
cmake --build . --config RelWithDebInfo
72+
env:
73+
MARIADB_PLUGIN_DIR: ${{ github.workspace }}
74+
75+
- name: make macos
76+
if: ${{ startsWith(matrix.os, 'mac') }}
77+
run: |
78+
brew install libiodbc openssl
79+
ls -lrt /opt/homebrew/opt/libiodbc/lib
80+
81+
TEST_DRIVER=${{ github.workspace }}/RelWithDebInfo/libmaodbc.dylib
82+
echo "TEST_DRIVER=${{ github.workspace }}/RelWithDebInfo/libmaodbc.dylib" >> $GITHUB_ENV
83+
cmake -G Xcode -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="" -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=NO -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO -DWITH_SIGNCODE=OFF -DODBC_LIB_DIR=/opt/homebrew/opt/libiodbc/lib -DODBC_INCLUDE_DIR=/opt/homebrew/opt/libiodbc/include -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=OPENSSL -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -DWITH_EXTERNAL_ZLIB=On -DTEST_HOST="jdbc:mariadb://${{ env.MYSQL_TEST_HOST }}:${{ env.MYSQL_TEST_PORT }}" .
84+
cmake --build . --config RelWithDebInfo
85+
86+
- name: make windows
87+
if: ${{ startsWith(matrix.os, 'windows') }}
88+
shell: powershell
89+
run: |
90+
cmake -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DWITH_MSI=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=SCHANNEL -DTEST_HOST="jdbc:mariadb://${{ env.MYSQL_TEST_HOST }}:${{ env.MYSQL_TEST_PORT }}" .
91+
cmake --build . --config RelWithDebInfo
92+
93+
- name: Run test suite
94+
shell: bash
95+
run: |
96+
cd ./test
97+
if [ "$DB_TYPE" = "mysql" ] ; then
98+
cp ../libmariadb/caching_sha2_password.* ../
99+
fi
100+
ctest --output-on-failure
101+
env:
102+
DB_TYPE: ${{ matrix.db-type }}
103+
LOCAL_DB: ${{ steps.setup-env.outputs.database-type }}
104+
os: ${{ matrix.os }}
105+
TEST_UID: ${{ env.MYSQL_TEST_USER }}
106+
TEST_SERVER: ${{ env.MYSQL_TEST_HOST }}
107+
TEST_PASSWORD: ${{ env.MYSQL_TEST_PASSWD }}
108+
TEST_PORT: ${{ env.MYSQL_TEST_PORT }}
109+
TEST_SCHEMA: ${{ env.MYSQL_TEST_DB }}
110+
TEST_VERBOSE: true
111+
SSLCERT: ${{ matrix.db-type == 'container' && format('{0}/.github/workflows/certs/server.crt', github.workspace) || '' }}
112+
MARIADB_PLUGIN_DIR: ${{ github.workspace }}

0 commit comments

Comments
 (0)