Skip to content

Improve Oracle database support #912

Improve Oracle database support

Improve Oracle database support #912

Workflow file for this run

name: Build
on:
merge_group:
push:
paths-ignore:
- 'mkdocs.yml'
- '*.sh'
branches:
- master
pull_request:
paths-ignore:
- 'docs/**'
- 'LICENSE.txt'
- 'mkdocs.yml'
- '*.md'
branches:
- master
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
CTEST_OUTPUT_ON_FAILURE: 1
SCCACHE_GHA_ENABLED: "true"
jobs:
# {{{ Common checks
check_PR_TODOs:
name: "Check PR-TODOs"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Checking for open PR-related TODO items"
run: ./scripts/check-pr-todos.sh
check_clang_format:
name: "Check C++ style"
runs-on: ubuntu-22.04
env:
LLVM_VERSION: 19
steps:
- uses: actions/checkout@v4
- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh $LLVM_VERSION
sudo apt-get install clang-format-$LLVM_VERSION
- name: "Clang-format"
run: find ./src/ \( -name "*.cpp" -o -name "*.h" \) -exec clang-format-19 --Werror --dry-run {} \;
check_clang_tidy:
name: "Check clang-tidy"
runs-on: ubuntu-24.04
if: github.ref != 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: "ccache-ubuntu2404-clang-tidy"
max-size: 256M
- name: "update APT database"
run: sudo apt -q update
- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20
sudo apt -qy install clang-tidy
- name: "install dependencies"
run: sudo apt install -y cmake ninja-build catch2 unixodbc-dev sqlite3 libsqlite3-dev libsqliteodbc uuid-dev
- name: Install GCC
run: sudo apt install -y g++-14
- name: "cmake"
run: |
cmake -S . -B build -G Ninja \
-D CMAKE_CXX_COMPILER="g++-14"
- name: "build"
run: cmake --build build
- name: "run clang-tidy"
# TODO: Reenable Model directory once design is working with Clang/Clang-Tidy
run: find ./src/ -name "*.cpp" -o -name "*.h" | grep -v Model | xargs -n 1 -P $(nproc) clang-tidy -format-style=file -p build
# }}}
# {{{ Windows
windows:
name: "Windows"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: "vcpkg: Install dependencies"
uses: lukka/[email protected]
id: runvcpkg
with:
vcpkgDirectory: ${{ runner.workspace }}/vcpkg
vcpkgGitCommitId: 80403036a665cb8fcc1a1b3e17593d20b03b2489
- name: "Generate build files"
run: cmake --preset windows-cl-release
env:
VCPKG_ROOT: "${{ runner.workspace }}/vcpkg"
- name: "Build"
run: cmake --build --preset windows-cl-release
- name: "Test"
if: false # TODO: Install sqliteodbc first
run: ctest --preset windows-cl-release
# }}}
# {{{ Ubuntu build CC matrix
ubuntu_build_cc_matrix:
strategy:
fail-fast: false
matrix:
cxx: [23]
build_type: ["RelWithDebInfo"]
compiler:
[
"GCC 14",
"Clang 19",
]
name: "Ubuntu Linux 24.04 (${{ matrix.compiler }}, C++${{ matrix.cxx }})"
runs-on: ubuntu-24.04
outputs:
id: "${{ matrix.compiler }} (C++${{ matrix.cxx }}, ${{ matrix.build_type }})"
steps:
- uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: "ccache-ubuntu2404-${{ matrix.compiler }}-${{ matrix.cxx }}-${{ matrix.build_type }}"
max-size: 256M
- name: "update APT database"
run: sudo apt -q update
- name: "Set up output var: CC_VERSION"
id: extract_matrix
run: |
CC_VERSION=$( echo "${{ matrix.compiler }}" | awk '{ print $2; }')
echo "CC_VERSION=${CC_VERSION}" >> "$GITHUB_OUTPUT"
- name: "install dependencies"
run: sudo apt install -y cmake ninja-build catch2 unixodbc-dev sqlite3 libsqlite3-dev libsqliteodbc uuid-dev
- name: "inspect"
run: |
dpkg -L unixodbc-common
dpkg -L unixodbc-dev
- name: Install GCC
if: ${{ startsWith(matrix.compiler, 'GCC') }}
run: sudo apt install -y g++-${{ steps.extract_matrix.outputs.CC_VERSION }}
- name: Install Clang
if: ${{ startsWith(matrix.compiler, 'Clang') }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{ steps.extract_matrix.outputs.CC_VERSION }}
# What about: libc++-dev libc++abi-dev
sudo apt-get install -y \
clang-format-${{ steps.extract_matrix.outputs.CC_VERSION }} \
clang-${{ steps.extract_matrix.outputs.CC_VERSION }}
- name: "cmake"
run: |
CC_NAME=$(echo "${{ matrix.compiler }}" | awk '{ print tolower($1); }')
CC_VER=$( echo "${{ matrix.compiler }}" | awk '{ print $2; }')
test "${{ matrix.compiler }}" = "GCC 8" && EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DPEDANTIC_COMPILER_WERROR=ON"
test "${CC_NAME}" = "gcc" && CC_EXE="g++"
if [[ "${CC_NAME}" = "clang" ]]; then
CC_EXE="clang++"
# CMAKE_CXX_FLAGS="-stdlib=libc++"
# CMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -lc++abi"
# EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DENABLE_TIDY=ON"
# EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DPEDANTIC_COMPILER_WERROR=OFF"
fi
cmake \
$EXTRA_CMAKE_FLAGS \
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx }} \
-DCMAKE_CXX_COMPILER="${CC_EXE}-${CC_VER}" \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
-DCMAKE_INSTALL_PREFIX="/usr/local" \
-DPEDANTIC_COMPILER_WERROR=OFF \
-DLIGHTWEIGHT_BUILD_SHARED=ON \
--preset linux-gcc-release
- name: "build"
run: cmake --build --preset linux-gcc-release -- -j3
# NB: Don't run the tests here, as we want to run them later for each individual database
# - name: "tests"
# run: ctest --preset linux-gcc-release
# NB: Don't run valgrind test here, as we want to run them later for each individual database
# - name: "Run tests through valgrind (without model tests)"
# run: |
# valgrind \
# --error-exitcode=1 \
# --leak-check=full \
# --leak-resolution=high \
# --num-callers=64 \
# out/build/linux-gcc-release/src/tests/LightweightTest '~[model]'
- name: "package tar.gz"
run: |
cpack --preset linux-gcc-release
cp out/package/linux-gcc-debug/Lightweight-*-Linux.tar.gz ./Lightweight-Linux-CI.tar.gz
- name: "Move tests to root directory"
run: mv out/build/linux-gcc-release/src/tests/LightweightTest .
- name: "Upload unit tests"
if: ${{ matrix.compiler == 'GCC 14' && matrix.cxx == '23' }}
uses: actions/upload-artifact@v4
with:
name: ubuntu2404-tests
path: |
Lightweight-Linux-CI.tar.gz
retention-days: 1
dbms_test_matrix:
strategy:
fail-fast: false
matrix:
database:
[
"SQLite3",
"MS SQL Server 2019",
"MS SQL Server 2022",
"PostgreSQL",
# TODO: "Oracle"
# TODO: "MySQL" or "MariaDB"
]
name: "Tests (${{ matrix.database }})"
runs-on: ubuntu-24.04
needs: [ubuntu_build_cc_matrix]
env:
DBMS: "${{ matrix.database }}"
steps:
- uses: actions/checkout@v4
- name: "Download unit test binaries"
uses: actions/download-artifact@v4
with:
name: ubuntu2404-tests
- name: "Extract package"
run: |
sudo tar -xvf Lightweight-Linux-CI.tar.gz --strip-components=1 -C /usr/local
- name: "install dependencies"
run: sudo apt install -y unixodbc-dev unixodbc odbcinst uuid-dev valgrind
- name: "Setup ${{ matrix.database }}"
id: setup
run: bash ./.github/prepare-test-run.sh "${{ matrix.database }}"
- name: "Enable ODBC tracing"
if: ${{ matrix.database == 'Oracle' }}
run: |
echo "[ODBC]" | sudo tee -a /etc/odbcinst.ini
echo "Trace=Yes" | sudo tee -a /etc/odbcinst.ini
echo "TraceFile=/dev/stdout" | sudo tee -a /etc/odbcinst.ini
- name: "~/.odbc.ini: set ServerName"
if: ${{ matrix.database == 'Oracle' }}
run: |
sed -i "s/ServerName =.*/ServerName = localhost/" ~/.odbc.ini
- name: "CI Debug prints"
if: ${{ matrix.database == 'Oracle' }}
run: |
echo "ODBC_CONNECTION_STRING=${{ steps.setup.outputs.ODBC_CONNECTION_STRING }}"
ldd /home/runner/oracle/instantclient_21_3/libsqora.so.21.1
- name: "Inspect dependencies"
run: ldd /usr/local/bin/LightweightTest
- name: "Run SQL tests"
env:
ODBC_CONNECTION_STRING: "${{ steps.setup.outputs.ODBC_CONNECTION_STRING }}"
run: |
set -ex
if [[ "${{ matrix.database }}" = "SQLite3" ]]; then
CMD_PREFIX="valgrind --leak-check=full --leak-resolution=high --num-callers=64 --error-exitcode=1"
elif [[ "${{ matrix.database }}" = "Oracle" ]]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/oracle/instantclient_21_3
CMD_PREFIX="strace -f"
fi
$CMD_PREFIX LightweightTest
# }}}