|
| 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: testo |
| 23 | + TEST_DSN: maodbc_test |
| 24 | + TEST_UID: root |
| 25 | + TEST_SERVER: mariadb.example.com |
| 26 | + TEST_PASSWORD: "heyPassw+-_20oRd" |
| 27 | + TEST_PORT: 3306 |
| 28 | + TEST_SCHEMA: testo |
| 29 | + ODBCINI: "${{ github.workspace }}/test/odbc.ini" |
| 30 | + ODBCSYSINI: ${{ github.workspace }}/test |
| 31 | + ODBCINTSTINI: ${{ github.workspace }}/test/odbcinst.ini |
| 32 | + |
| 33 | +jobs: |
| 34 | + setup: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + # Only run scheduled jobs if we're on the right branch |
| 37 | + if: github.event_name != 'schedule' || contains(fromJSON('["odbc-3.1", "master"]'), github.ref_name) |
| 38 | + outputs: |
| 39 | + matrix: ${{ steps.set-matrix.outputs.final-matrix }} |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + - id: set-matrix |
| 43 | + name: build matrix |
| 44 | + uses: rusher/mariadb-test-build-matrix@main |
| 45 | + with: |
| 46 | + additional-matrix: '[]' |
| 47 | + |
| 48 | + ci: |
| 49 | + name: ${{ matrix.name }} |
| 50 | + needs: setup |
| 51 | + timeout-minutes: 50 |
| 52 | + strategy: |
| 53 | + matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} |
| 54 | + |
| 55 | + runs-on: ${{ matrix.os }} |
| 56 | + continue-on-error: ${{ matrix.continue-on-error || matrix.os == 'macos-latest' }} |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Setup Test Environment |
| 61 | + id: setup-env |
| 62 | + uses: rusher/mariadb-test-setup@master |
| 63 | + with: |
| 64 | + node-version: ${{ matrix.node }} |
| 65 | + db-type: ${{ matrix.db-type }} |
| 66 | + db-tag: ${{ matrix.db-tag }} |
| 67 | + test-db-password: ${{ env.MYSQL_TEST_PASSWD }} |
| 68 | + test-db-database: ${{ env.MYSQL_TEST_DB }} |
| 69 | + test-db-port: ${{ env.MYSQL_TEST_PORT }} |
| 70 | + additional-conf: ${{ matrix.additional-conf || '' }} |
| 71 | + registry-user: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_USER || (secrets.DOCKER_PWD != '' && 'mariadbtest' || '') }} |
| 72 | + registry-password: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_TOKEN || secrets.DOCKER_PWD }} |
| 73 | + os: ${{ matrix.os }} |
| 74 | + |
| 75 | + - name: make ubuntu |
| 76 | + if: ${{ startsWith(matrix.os, 'ubuntu') }} |
| 77 | + run: | |
| 78 | + sudo apt install unixodbc-dev |
| 79 | + cmake -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=OPENSSL . |
| 80 | + cmake --build . --config RelWithDebInfo |
| 81 | +
|
| 82 | + - name: make macos |
| 83 | + if: ${{ startsWith(matrix.os, 'mac') }} |
| 84 | + run: | |
| 85 | + brew install libiodbc openssl |
| 86 | + ls -lrt /opt/homebrew/opt/libiodbc/lib |
| 87 | + |
| 88 | + TEST_DRIVER=${{ github.workspace }}/RelWithDebInfo/libmaodbc.dylib |
| 89 | + echo "TEST_DRIVER=${{ github.workspace }}/RelWithDebInfo/libmaodbc.dylib" >> $GITHUB_ENV |
| 90 | + 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 . |
| 91 | + cmake --build . --config RelWithDebInfo |
| 92 | +
|
| 93 | + - name: Install WiX |
| 94 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 95 | + shell: powershell |
| 96 | + run: | |
| 97 | + choco install wixtoolset -y |
| 98 | +
|
| 99 | + - name: make windows |
| 100 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 101 | + shell: powershell |
| 102 | + run: | |
| 103 | + cmake -DCONC_WITH_MSI=OFF -DCONC_WITH_UNIT_TESTS=OFF -DWITH_MSI=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=SCHANNEL . #-DDIRECT_LINK_TESTS=1 . |
| 104 | + cmake --build . --config RelWithDebInfo |
| 105 | +
|
| 106 | + - name: Install generated MSI (Windows only) |
| 107 | + if: startsWith(matrix.os, 'windows') |
| 108 | + shell: powershell |
| 109 | + run: | |
| 110 | + pwd |
| 111 | + ls ${{ github.workspace }}\packaging\windows |
| 112 | + Get-ChildItem -Path ${{ github.workspace }}\packaging\windows\mariadb-connector-odbc-*.msi |
| 113 | + $log = "install.log" |
| 114 | + foreach ($msi in Get-ChildItem -Path ${{ github.workspace }}\packaging\windows\mariadb-connector-odbc-*.msi) { |
| 115 | + $procInstall= Start-Process msiexec.exe -ArgumentList "/i $($msi.FullName) /qn /norestart" -NoNewWindow -PassThru |
| 116 | + #$procLog = Start-Process "powershell" "Get-Content -Path `"$log`" -Wait" -NoNewWindow -PassThru |
| 117 | + #$procMain.WaitForExit() |
| 118 | + #$procLog.Kill() |
| 119 | + } |
| 120 | + Get-OdbcDriver -Platform "64-bit" |
| 121 | + Add-OdbcDsn -Name $env:TEST_DSN -DriverName "MariaDB ODBC 3.1 Driver" -DsnType "User" -SetPropertyValue @( "SERVER=$env:TEST_SERVER", "DATABASE=$env:TEST_SCHEMA", "USER=$env:TEST_UID", "PASSWORD=$env:TEST_PASSWORD", "PORT=$env:TEST_PORT" ) |
| 122 | +
|
| 123 | + - name: Run test suite |
| 124 | + shell: bash |
| 125 | + run: | |
| 126 | + echo "$PWD" |
| 127 | + |
| 128 | + chmod 777 test |
| 129 | + ls -lrta |
| 130 | + cd ./test |
| 131 | + echo "$PWD" |
| 132 | + if [ "$DB_TYPE" = "mysql" ] ; then |
| 133 | + cp ../libmariadb/caching_sha2_password.* ../ |
| 134 | + fi |
| 135 | +
|
| 136 | + if [[ "${RUNNER_OS}" == "Windows" ]]; then |
| 137 | + TEST_DRIVER="MariaDB ODBC 3.1 Driver" |
| 138 | + # INSTALLFOLDER='' |
| 139 | + ls ./RelWithDebInfo |
| 140 | + set +x |
| 141 | + #odbcconf CONFIGDSN "$TEST_DRIVER" "DSN=$TEST_DSN;SERVER=$TEST_SERVER;DATABASE=$TEST_SCHEMA;USER=$TEST_UID;PASSWORD=$TEST_PASSWORD;PORT=$TEST_PORT;$TEST_ADD_PARAM" |
| 142 | + set -ex |
| 143 | + else |
| 144 | +
|
| 145 | + cat $ODBCINSTINI |
| 146 | + cat $ODBCINI | grep -v PASSWORD |
| 147 | +
|
| 148 | + chmod 666 $ODBCINI $ODBCSYSINI/odbcinst.ini |
| 149 | + ls -lrt |
| 150 | + fi |
| 151 | + ctest --verbose |
| 152 | +
|
| 153 | + export TEST_ADD_PARAM="STREAMRS=1;FORWARDONLY=1" |
| 154 | + ctest --output-on-failure |
| 155 | +
|
| 156 | + env: |
| 157 | + DB_TYPE: ${{ matrix.db-type }} |
| 158 | + LOCAL_DB: ${{ steps.setup-env.outputs.database-type }} |
| 159 | + os: ${{ matrix.os }} |
| 160 | + TEST_DRIVER: ${{ env.TEST_DRIVER || 'maodbc_test' }} |
| 161 | + TEST_SOCKET: |
| 162 | + SSLCERT: ${{ matrix.db-type == 'container' && format('{0}/.github/workflows/certs/server.crt', github.workspace) || '' }} |
| 163 | + MARIADB_PLUGIN_DIR: ${{ github.workspace }} |
0 commit comments