ci: fix pawncc libpawnc.so loading in unit tests #68
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: | |
| env: | |
| EARTHLY_VERSION: v0.8.16 | |
| jobs: | |
| build: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - id: linux | |
| name: Linux (x86, Ubuntu 20.04 via Earthly) | |
| os: ubuntu-22.04 | |
| release_glob: dist/mysql-linux.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 Earthly (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| curl -fsSL "https://github.com/earthly/earthly/releases/download/${EARTHLY_VERSION}/earthly-linux-amd64" -o earthly | |
| chmod +x earthly | |
| sudo mv earthly /usr/local/bin/earthly | |
| earthly --version | |
| - name: Build (Linux via Earthly, Ubuntu 20.04) | |
| if: runner.os == 'Linux' | |
| run: earthly --ci --output +linux-build --UBUNTU_VERSION=20.04 | |
| - name: Configure (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| cmake -S . -B build -G "Visual Studio 17 2022" -A Win32 ` | |
| -DBUILD_BUNDLED_MARIADB_CONNECTOR=ON | |
| - name: Build (Windows) | |
| if: runner.os == 'Windows' | |
| run: cmake --build build --config Release --parallel | |
| - name: Upload Linux build artifacts | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-linux-x86 | |
| path: | | |
| dist/linux/mysql.so | |
| dist/linux/a_mysql.inc | |
| dist/linux/libmariadb.so.3 | |
| if-no-files-found: error | |
| - name: Upload Windows build artifacts | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-windows-win32 | |
| path: | | |
| build/src/Release/mysql.dll | |
| build/src/a_mysql.inc | |
| build/**/libmariadb.dll | |
| if-no-files-found: error | |
| - name: Package (Linux release only, Earthly) | |
| if: github.event_name == 'release' && runner.os == 'Linux' | |
| run: earthly --ci --output +linux-package --UBUNTU_VERSION=20.04 | |
| - name: Package (Windows release only) | |
| if: github.event_name == 'release' && runner.os == 'Windows' | |
| run: cmake --build build --config Release --target package --parallel | |
| - 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 | |
| linux-compat-22: | |
| name: Linux Compat Probe (Ubuntu 22.04 via Earthly) | |
| if: github.event_name != 'release' | |
| runs-on: ubuntu-22.04 | |
| continue-on-error: true | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Earthly | |
| run: | | |
| curl -fsSL "https://github.com/earthly/earthly/releases/download/${EARTHLY_VERSION}/earthly-linux-amd64" -o earthly | |
| chmod +x earthly | |
| sudo mv earthly /usr/local/bin/earthly | |
| earthly --version | |
| - name: Build compat probe | |
| run: earthly --ci +linux-build --UBUNTU_VERSION=22.04 | |
| unit-tests-linux: | |
| if: ${{ false }} # Temporarily disabled. | |
| name: Linux Unit Tests (open.mp + MariaDB) | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read | |
| services: | |
| mariadb: | |
| image: mariadb:11 | |
| env: | |
| MARIADB_ROOT_PASSWORD: root | |
| MARIADB_DATABASE: mysqlunittest | |
| MARIADB_USER: mysqlunittest | |
| MARIADB_PASSWORD: mysqlunittest | |
| ports: | |
| - 3306:3306 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Linux test dependencies | |
| run: | | |
| sudo dpkg --add-architecture i386 | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| gcc-multilib g++-multilib libssl-dev:i386 \ | |
| mariadb-client jq curl unzip | |
| test -f /usr/lib/i386-linux-gnu/libssl.so | |
| test -f /usr/lib/i386-linux-gnu/libcrypto.so | |
| - name: Wait for MariaDB service | |
| run: | | |
| for _ in $(seq 1 60); do | |
| if mysqladmin ping -h 127.0.0.1 -P 3306 -u mysqlunittest -pmysqlunittest --silent; then | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| mysql -h 127.0.0.1 -P 3306 -u mysqlunittest -pmysqlunittest -D mysqlunittest -e "SELECT 1;" | |
| - name: Configure (Linux unit tests) | |
| run: > | |
| cmake -S . -B build-ut | |
| -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: Build (Linux unit tests) | |
| run: cmake --build build-ut --parallel | |
| - name: Verify Linux mysql component dynamic symbols | |
| run: scripts/ci/check-linux-mysql-symbols.sh build-ut/src/mysql.so | |
| - name: Run open.mp unit tests | |
| env: | |
| BUILD_DIR: build-ut | |
| DB_HOST: 127.0.0.1 | |
| DB_USER: mysqlunittest | |
| DB_PASS: mysqlunittest | |
| DB_NAME: mysqlunittest | |
| UNIT_TEST_TIMEOUT: 90s | |
| run: scripts/ci/run-openmp-unit-tests.sh | |
| - name: Upload unit test logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: unit-test-logs-linux | |
| path: /tmp/mysql-unit-test-ci/*.log | |
| if-no-files-found: warn | |
| upload-release-assets: | |
| name: Upload release assets | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-22.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 |