Add Linux CI symbol check for mysql component #47
Workflow file for this run
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: Build and Release | |
| on: | |
| push: | |
| pull_request: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - id: linux | |
| name: Linux (x86) | |
| os: ubuntu-24.04 | |
| release_glob: build/*.tar.gz | |
| - id: windows | |
| name: Windows (Win32) | |
| os: windows-2022 | |
| release_glob: build/*.zip | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Linux build dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo dpkg --add-architecture i386 | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-multilib g++-multilib libssl-dev:i386 | |
| test -f /usr/lib/i386-linux-gnu/libssl.so | |
| test -f /usr/lib/i386-linux-gnu/libcrypto.so | |
| - name: Install MariaDB Connector/C for Windows (x86) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $VcpkgRoot = "$env:RUNNER_TEMP\vcpkg" | |
| git clone --depth 1 https://github.com/microsoft/vcpkg $VcpkgRoot | |
| & "$VcpkgRoot\bootstrap-vcpkg.bat" -disableMetrics | |
| & "$VcpkgRoot\vcpkg.exe" install libmariadb:x86-windows | |
| $MariaRoot = "$VcpkgRoot\installed\x86-windows" | |
| if (!(Test-Path "$MariaRoot\include")) { throw "Missing include dir in $MariaRoot" } | |
| if (!(Test-Path "$MariaRoot\lib\libmariadb.lib")) { throw "Missing import library in $MariaRoot\lib" } | |
| if (!(Test-Path "$MariaRoot\bin\libmariadb.dll")) { throw "Missing runtime DLL in $MariaRoot\bin" } | |
| $MariaRoot = $MariaRoot -replace '\\','/' | |
| "MYSQLCAPI_ROOT_DIR=$MariaRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Configure (Linux) | |
| if: runner.os == 'Linux' | |
| run: > | |
| cmake -S . -B build | |
| -DCMAKE_BUILD_TYPE=Release | |
| -DFORCE_32_BIT=ON | |
| -DOPENSSL_SSL_LIBRARY=/usr/lib/i386-linux-gnu/libssl.so | |
| -DOPENSSL_CRYPTO_LIBRARY=/usr/lib/i386-linux-gnu/libcrypto.so | |
| -DCMAKE_POSITION_INDEPENDENT_CODE=ON | |
| - name: Configure (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| cmake -S . -B build -G "Visual Studio 17 2022" -A Win32 ` | |
| -DMYSQLCAPI_ROOT_DIR="$env:MYSQLCAPI_ROOT_DIR" | |
| - name: Build (Linux) | |
| if: runner.os == 'Linux' | |
| run: cmake --build build --parallel | |
| - name: Verify Linux mysql component dynamic symbols | |
| if: runner.os == 'Linux' | |
| run: scripts/ci/check-linux-mysql-symbols.sh | |
| - name: Build (Windows) | |
| if: runner.os == 'Windows' | |
| run: cmake --build build --config Release --parallel | |
| - name: Package (Linux release only) | |
| if: github.event_name == 'release' && runner.os == 'Linux' | |
| run: cmake --build build --target package --parallel | |
| - name: Package (Windows release only) | |
| if: github.event_name == 'release' && runner.os == 'Windows' | |
| run: cmake --build build --config Release --target package --parallel | |
| - name: Verify Linux package contents | |
| if: github.event_name == 'release' && runner.os == 'Linux' | |
| run: | | |
| PKG="$(ls -1 build/*.tar.gz | head -n 1)" | |
| test -n "$PKG" | |
| tar -tzf "$PKG" | grep -E '^[^/]+/components/mysql\.so$' | |
| tar -tzf "$PKG" | grep -E '^[^/]+/libmariadb\.so\.3$' | |
| - name: Verify Windows package contents | |
| if: github.event_name == 'release' && runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $pkg = Get-ChildItem build/*.zip | Select-Object -First 1 | |
| if (-not $pkg) { throw "No ZIP package found in build/" } | |
| Add-Type -AssemblyName System.IO.Compression.FileSystem | |
| $zip = [System.IO.Compression.ZipFile]::OpenRead($pkg.FullName) | |
| try { | |
| $entries = $zip.Entries | ForEach-Object { $_.FullName } | |
| $hasMysqlDll = $entries | Where-Object { $_ -match '^[^/]+/components/mysql\.dll$' } | |
| $hasMariaRootDll = $entries | Where-Object { $_ -match '^[^/]+/libmariadb\.dll$' } | |
| if (-not $hasMysqlDll) { throw "Missing components/mysql.dll in package" } | |
| if (-not $hasMariaRootDll) { throw "Missing root libmariadb.dll in package" } | |
| } finally { | |
| $zip.Dispose() | |
| } | |
| - name: Upload package artifact | |
| if: github.event_name == 'release' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-${{ matrix.id }} | |
| path: ${{ matrix.release_glob }} | |
| if-no-files-found: error | |
| upload-release-assets: | |
| name: Upload release assets | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-24.04 | |
| needs: build | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download packaged artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: release-* | |
| path: release-assets | |
| merge-multiple: true | |
| - name: Upload assets to GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release-assets/* | |
| fail_on_unmatched_files: true |