Skip to content

ci: always upload build artifacts for github and gitlab #61

ci: always upload build artifacts for github and gitlab

ci: always upload build artifacts for github and gitlab #61

Workflow file for this run

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-22.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: 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 `
-DBUILD_BUNDLED_MARIADB_CONNECTOR=ON
- 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: Upload Linux build artifacts
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: build-linux-x86
path: |
build/src/mysql.so
build/src/a_mysql.inc
build/**/libmariadb.so*
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)
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
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