Files
soci/.github/workflows/ci.yml
Vadim Zeitlin 90822ba689 Add jobs running tests against SQL Server to GitHub Actions CI
Install the server using the container provided by Microsoft and run the
ODBC backend tests against it using both Microsoft and FreeTDS drivers.
2026-09-01 01:34:42 +02:00

228 lines
6.5 KiB
YAML

# Continuous integration workflow for SOCI Unix builds.
name: Unix CI
on:
push:
branches:
- master
- 'release/**'
paths-ignore:
- .circleci/**
- .cirrus.yml
- .github/workflows/ci_msw.yml
- .github/workflows/codeql.yml
- appveyor.yml
pull_request:
branches:
- master
paths-ignore:
- .circleci/**
- .cirrus.yml
- .github/workflows/ci_msw.yml
- .github/workflows/codeql.yml
- appveyor.yml
workflow_dispatch:
inputs:
enable_ssh:
type: boolean
description: 'Enable ssh server before running the job'
required: false
default: false
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# Ubuntu jobs
# Can't test DB2 as required db2exc package is no longer available after Ubuntu 14.04
- lib_type: shared
backend: SQLite3
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: PostgreSQL
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: MySQL
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: Firebird
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: Oracle
runner: ubuntu-22.04
unity_build: false
- lib_type: shared
backend: ODBC
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: MSSQL
runner: ubuntu-24.04
unity_build: false
mssql_driver: msodbcsql18
name: MS SQL (Microsoft driver)
- lib_type: shared
backend: MSSQL
runner: ubuntu-24.04
unity_build: false
mssql_driver: freetds
name: MS SQL (FreeTDS driver)
- lib_type: shared
backend: Empty
runner: ubuntu-24.04
unity_build: false
- lib_type: static
backend: SQLite3
runner: ubuntu-24.04
- lib_type: static
backend: PostgreSQL
runner: ubuntu-24.04
- lib_type: static
backend: MySQL
runner: ubuntu-24.04
- lib_type: static
backend: Firebird
runner: ubuntu-24.04
- lib_type: static
backend: Oracle
runner: ubuntu-22.04
- lib_type: static
backend: ODBC
runner: ubuntu-24.04
- lib_type: static
backend: Empty
runner: ubuntu-24.04
# MacOS jobs
- lib_type: shared
backend: Empty
runner: macos-14
no_boost: true
- lib_type: shared
backend: PostgreSQL
runner: macos-14
no_boost: true
- lib_type: shared
backend: SQLite3
runner: macos-14
no_boost: true
# Special
- lib_type: shared
backend: SQLite3
runner: ubuntu-24.04
cxxstd: 17
name: SQLite3 Cxx17
- lib_type: shared
backend: Empty
runner: ubuntu-24.04
test_release_package: true
name: Release package
- lib_type: shared
backend: Empty
runner: ubuntu-24.04
build_examples: true
name: Examples
- lib_type: static
backend: Valgrind
runner: ubuntu-24.04
name: Valgrind
cxxstd: 20
- lib_type: shared
backend: MySQL
runner: ubuntu-24.04
mariadb: true
name: MariaDB
runs-on: ${{ matrix.runner }}
name: ${{ format('{0} on {1}', (matrix.name != '' && matrix.name || format('{0} ({1})', matrix.backend, matrix.lib_type)), matrix.runner) }}
env:
SOCI_CI: true
SOCI_CI_BACKEND: ${{ matrix.backend }}
SOCI_MYSQL_ROOT_PASSWORD: root
ASAN_OPTIONS: fast_unwind_on_malloc=0
UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
SOCI_CXXSTD: 14
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: 'recursive'
- name: Set environment variables
shell: bash
run: |
set_env_var() {
echo "Setting environment variable $1=$2"
echo $1=$2 >> $GITHUB_ENV
}
set_env_var SOCI_CI_BRANCH $GITHUB_REF
set_env_var SOCI_SOURCE_DIR $GITHUB_WORKSPACE
case "${{runner.os}}" in
Linux)
set_env_var PGHOST localhost
set_env_var PGPORT 5432
set_env_var PGUSER postgres
set_env_var PGPASSWORD 'Password12!'
;;
macOS)
set_env_var PGDATA /opt/homebrew/var/postgresql@14
;;
esac
if [ -n "${{matrix.cxxstd}}" ]; then
set_env_var SOCI_CXXSTD ${{matrix.cxxstd}}
fi
if [ "${{matrix.no_boost}}" = true ]; then
set_env_var WITH_BOOST OFF
fi
if [ "${{matrix.test_release_package}}" = true ]; then
set_env_var TEST_RELEASE_PACKAGE YES
fi
if [ "${{matrix.build_examples}}" = true ]; then
set_env_var BUILD_EXAMPLES YES
fi
if [ "${{matrix.lib_type}}" = "static" ]; then
set_env_var SOCI_BUILD_STATIC YES
fi
if [ "${{matrix.unity_build}}" = false ]; then
set_env_var SOCI_ENABLE_UNITY_BUILD ON
else
set_env_var SOCI_ENABLE_UNITY_BUILD OFF
fi
if [ "${{matrix.mariadb}}" = true ]; then
set_env_var SOCI_MYSQL_USE_MARIADB YES
fi
if [ -n "${{matrix.mssql_driver}}" ]; then
set_env_var SOCI_MSSQL_DRIVER ${{matrix.mssql_driver}}
fi
# Ensure SOCI_CI_BACKEND is always lowercase
set_env_var SOCI_CI_BACKEND "$( echo "$SOCI_CI_BACKEND" | tr '[:upper:]' '[:lower:]' )"
- name: Setup tmate
if: ${{ github.event_name == 'workflow_dispatch' && inputs.enable_ssh }}
uses: mxschmitt/action-tmate@v3
- name: Install dependencies
run: ./scripts/ci/install.sh
- name: Prepare for build
run: ./scripts/ci/before_build.sh
- name: Build
run: ./scripts/ci/build.sh
- name: Test
run: ./scripts/ci/test.sh