Skip to content

Build and Test - Linux #206

Build and Test - Linux

Build and Test - Linux #206

Workflow file for this run

name: Build and Test - Linux
on:
schedule:
- cron: '0 0 * * 1'
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types:
- created
concurrency:
group: linux-${{ github.head_ref }}
cancel-in-progress: true
env:
CLICKHOUSE_SERVER_IMAGE: "clickhouse/clickhouse-server:21.3"
defaults:
run:
shell: bash
working-directory: run
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
odbc_provider: [UnixODBC, iODBC]
compiler: [Clang, GCC]
build_type: [Debug, Release]
architecture: [x86_64]
runtime_link: [static-runtime, dynamic-runtime]
third_parties: [bundled-third-parties, system-third-parties]
exclude:
- os: ubuntu-18.04
compiler: Clang
runs-on: ${{ matrix.os }}
steps:
- name: Create directories
working-directory: ${{ github.workspace }}
run: |
mkdir -p ${{ github.workspace }}/run
mkdir -p ${{ github.workspace }}/build
mkdir -p ${{ github.workspace }}/prefix
mkdir -p ${{ github.workspace }}/install
mkdir -p ${{ github.workspace }}/package
- name: Clone the repo
uses: actions/checkout@v2
with:
path: source
submodules: true
- name: Install dependencies - Common
if: ${{ matrix.os == 'ubuntu-18.04' }}
run: |
sudo apt update -q
sudo apt remove -y php* node* mysql* mssql-tools
sudo apt upgrade -y
sudo apt install -y build-essential git cmake docker perl libdbi-perl libdbd-odbc-perl python python-pip python-pyodbc python3 python3-pip python3-pyodbc python3-setuptools libpoco-dev libssl-dev libicu-dev
pip3 install --user 'testflows==1.6.56' contextvars
- name: Install dependencies - Common
if: ${{ matrix.os != 'ubuntu-18.04' }}
run: |
sudo apt update -q
sudo apt remove -y php* node* mysql* mssql-tools
sudo apt upgrade -y
sudo apt install -y build-essential git cmake docker perl libdbi-perl libdbd-odbc-perl python-is-python3 python3 python3-pip python3-pyodbc python3-setuptools libpoco-dev libssl-dev libicu-dev
pip3 install --user 'testflows==1.6.56'
- name: Install dependencies - Docker
run: |
sudo apt remove -y docker docker-engine docker.io containerd runc
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update -q
sudo apt install docker-ce docker-ce-cli containerd.io
- name: Install dependencies - UnixODBC
if: ${{ matrix.odbc_provider == 'UnixODBC' }}
run: sudo apt install -y unixodbc unixodbc-dev
- name: Install dependencies - iODBC
if: ${{ matrix.odbc_provider == 'iODBC' }}
run: sudo apt install -y iodbc libiodbc2 libiodbc2-dev
- name: Install dependencies - Clang
if: ${{ matrix.compiler == 'Clang' }}
run: sudo apt install -y clang llvm lldb
- name: Install dependencies - GCC
if: ${{ matrix.compiler == 'GCC' }}
run: sudo apt install -y gcc g++ gdb
- name: Install dependencies - Cleanup
run: sudo apt autoremove -y
- name: Configure
run: >
CC=${{ fromJSON('{"Clang": "clang", "GCC": "gcc"}')[matrix.compiler] }}
CXX=${{ fromJSON('{"Clang": "clang++", "GCC": "g++"}')[matrix.compiler] }}
cmake -S ${{ github.workspace }}/source -B ${{ github.workspace }}/build
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DODBC_PROVIDER=${{ matrix.odbc_provider }}
-DCH_ODBC_RUNTIME_LINK_STATIC=${{ fromJSON('{"static-runtime": "ON", "dynamic-runtime": "OFF"}')[matrix.runtime_link] }}
-DCH_ODBC_PREFER_BUNDLED_THIRD_PARTIES=${{ fromJSON('{"bundled-third-parties": "ON", "system-third-parties": "OFF"}')[matrix.third_parties] }}
-DTEST_DSN_LIST="ClickHouse DSN (ANSI);ClickHouse DSN (Unicode);ClickHouse DSN (ANSI, RBWNAT)"
- name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }}
- name: Package
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }} --target package
- name: List artifacts
run: |
echo REF: ${{ github.ref }}
ls -lahR ${{ github.workspace }}/build/
# Linux release artifacts are uploaded in Docker.yml
# That builds binaries based on CentOS 7, which makes those more portable.
# However, these binaries are uploaded to be available in GH's 'Actions', just in case.
- name: Upload the artifacts
if: ${{ matrix.compiler == 'GCC' && matrix.odbc_provider == 'UnixODBC' && matrix.build_type == 'Release' && matrix.runtime_link == 'dynamic-runtime' && matrix.third_parties == 'bundled-third-parties' }}
uses: actions/upload-artifact@v3
with:
name: clickhouse-odbc-linux-${{ matrix.compiler }}-${{ matrix.odbc_provider }}-${{ matrix.build_type }}
path: ${{ github.workspace }}/build/clickhouse-odbc-*
- name: Test - Run unit tests
working-directory: ${{ github.workspace }}/build
run: ctest --output-on-failure --build-config ${{ matrix.build_type }} -R '.*-ut.*'
- name: Test - Start ClickHouse server in background
run: |
docker pull ${CLICKHOUSE_SERVER_IMAGE}
docker run -d --name clickhouse ${CLICKHOUSE_SERVER_IMAGE}
docker ps -a
docker stats -a --no-stream
- name: Test - Run integration tests
working-directory: ${{ github.workspace }}/build
run: |
export CLICKHOUSE_SERVER_IP=$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' clickhouse)
export ODBCSYSINI=${{ github.workspace }}/run
export ODBCINSTINI=.odbcinst.ini
export ODBCINI=$ODBCSYSINI/.odbc.ini
if [[ "${{ matrix.odbc_provider }}" == "iODBC" ]]; then
# Full path to a custom odbcinst.ini in ODBCINSTINI for iODBC.
export ODBCINSTINI=$ODBCSYSINI/$ODBCINSTINI
fi
cat > $ODBCSYSINI/.odbcinst.ini <<-EOF
[ODBC]
Trace = 1
TraceFile = ${{ github.workspace }}/run/odbc-driver-manager-trace.log
Debug = 1
DebugFile = ${{ github.workspace }}/run/odbc-driver-manager-debug.log
[ODBC Drivers]
ClickHouse ODBC Driver (ANSI) = Installed
ClickHouse ODBC Driver (Unicode) = Installed
[ClickHouse ODBC Driver (ANSI)]
Driver = ${{ github.workspace }}/build/driver/libclickhouseodbc.so
Setup = ${{ github.workspace }}/build/driver/libclickhouseodbc.so
UsageCount = 1
[ClickHouse ODBC Driver (Unicode)]
Driver = ${{ github.workspace }}/build/driver/libclickhouseodbcw.so
Setup = ${{ github.workspace }}/build/driver/libclickhouseodbcw.so
UsageCount = 1
EOF
cat > $ODBCSYSINI/.odbc.ini <<-EOF
[ODBC]
Trace = 1
TraceFile = ${{ github.workspace }}/run/odbc-driver-manager-trace.log
Debug = 1
DebugFile = ${{ github.workspace }}/run/odbc-driver-manager-debug.log
[ODBC Data Sources]
ClickHouse DSN (ANSI) = ClickHouse ODBC Driver (ANSI)
ClickHouse DSN (Unicode) = ClickHouse ODBC Driver (Unicode)
ClickHouse DSN (ANSI, RBWNAT) = ClickHouse ODBC Driver (ANSI)
[ClickHouse DSN (ANSI)]
Driver = ClickHouse ODBC Driver (ANSI)
Description = Test DSN for ClickHouse ODBC Driver (ANSI)
Url = http://${CLICKHOUSE_SERVER_IP}
DriverLog = yes
DriverLogFile = ${{ github.workspace }}/run/clickhouse-odbc-driver.log
[ClickHouse DSN (Unicode)]
Driver = ClickHouse ODBC Driver (Unicode)
Description = Test DSN for ClickHouse ODBC Driver (Unicode)
Url = http://${CLICKHOUSE_SERVER_IP}
DriverLog = yes
DriverLogFile = ${{ github.workspace }}/run/clickhouse-odbc-driver-w.log
[ClickHouse DSN (ANSI, RBWNAT)]
Driver = ClickHouse ODBC Driver (ANSI)
Description = Test DSN for ClickHouse ODBC Driver (ANSI) that uses RowBinaryWithNamesAndTypes as data source communication default format
Url = http://${CLICKHOUSE_SERVER_IP}/query?default_format=RowBinaryWithNamesAndTypes
DriverLog = yes
DriverLogFile = ${{ github.workspace }}/run/clickhouse-odbc-driver.log
EOF
if [[ "${{ matrix.odbc_provider }}" == "iODBC" ]]; then
export GTEST_FILTER="-PerformanceTest.*"
fi
# Run all tests except those that were run in "Test - unit tests" step.
ctest --output-on-failure --build-config ${{ matrix.build_type }} -E '.*-ut.*'