Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and update Travis CI workflow #450

Merged
merged 8 commits into from
Aug 29, 2023
302 changes: 166 additions & 136 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,136 +1,166 @@
# Copyright (c) 2012-2023 Sebastien Rombauts ([email protected])

language: cpp

# Use Linux unless specified otherwise
os: linux

cache:
apt: true

env:
global:
- BUILD_TYPE=Debug
- ASAN=ON
- INTERNAL_SQLITE=ON
- VALGRIND=OFF

# Build variants (should test a reasonable number of combination of CMake options)
jobs:
include:

##########################################################################
# GCC on Linux
##########################################################################

# Coverity static code analysis
- dist: bionic
env:
- COVERITY_SCAN_PROJECT_NAME=SRombauts/SQLiteCpp
- COVERITY_SCAN_BRANCH_PATTERN=master
- [email protected]
- COVERITY_SCAN_BUILD_COMMAND_PREPEND="cmake ."
- COVERITY_SCAN_BUILD_COMMAND="make -j8"
# Encrypted COVERITY_SCAN_TOKEN, created via the "travis encrypt" command using the project repo's public key
- secure: "Qm4d8NEDPBtYZCYav46uPEvDCtaRsjLXlkVS+C+WCJAPcwXCGkrr96wEi7RWcq2xD86QCh0XiqaPT+xdUmlohOYIovRhaaBmZ1lwIJ4GsG/ZR6xoFr3DYsZ3o4GyXk2vNXNxEl82AC+Xs6e6gkLOV9XRkBcjpVIvoIXgNlKWeGY="

# GCC 7.4.0 Debug build with GCov for coverage build
- dist: bionic
env:
- cc=gcc cxx=g++
- GCOV=ON
- COVERALLS=true

# GCC 7.4.0 Debug build with Valgrind instead of Address Sanitizer
- dist: bionic
env:
- cc=gcc cxx=g++
- ASAN=OFF
- VALGRIND=true

# GCC 7.4.0 Release build
- dist: bionic
env:
- cc=gcc cxx=g++
- BUILD_TYPE=Release

# GCC 7.4.0 test linking with libsqlite3-dev package
- dist: bionic
env:
- cc=gcc cxx=g++
- INTERNAL_SQLITE=OFF

# GCC 5.4.0
- dist: xenial
env:
- cc=gcc cxx=g++

# GCC 4.8.4
- dist: trusty
env:
- cc=gcc cxx=g++

##########################################################################
# Clang on Linux
##########################################################################

# Clang 7.0.0
- dist: bionic
env:
- cc=clang cxx=clang++

# Clang 7.0.0
- dist: xenial
env:
- cc=clang cxx=clang++

# Clang 5.0.0
- dist: trusty
env:
- cc=clang cxx=clang++

##########################################################################
# Clang on OSX
##########################################################################

# Latest XCode - AppleClang 9.1.0
- os: osx
env:
- cc=clang cxx=clang++

# XCode 8.3 - AppleClang 8.1.0
- os: osx
osx_image: xcode8.3
env:
- cc=clang cxx=clang++

before_install:
# Coverity: don't use addons.coverity_scan since it run on every job of the build matrix, which waste resources and exhausts quotas
# Note: the job dedicated to Coverity need to only run the shell script and then exit (to not try to build and run unit tests etc.)
- if [[ -n "$COVERITY_SCAN_PROJECT_NAME" ]] ; then curl -s https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh | bash ; exit 0 ; fi

- if [[ "$INTERNAL_SQLITE" == "OFF" ]]; then sudo apt-get install libsqlite3-dev ; fi
- if [[ "$VALGRIND" == "true" ]]; then sudo apt-get install valgrind ; fi
- if [[ "$COVERALLS" == "true" ]]; then pip install --user cpp-coveralls ; fi

# Set the compiler environment variables properly
- export CC=${cc}
- export CXX=${cxx}

# scripts to run before build
before_script:
- mkdir build
- cd build
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSQLITECPP_INTERNAL_SQLITE=$INTERNAL_SQLITE -DSQLITECPP_USE_ASAN=$ASAN -DSQLITECPP_USE_GCOV=$GCOV -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..

# build examples, and run tests (ie make & make test)
script:
- cmake --build .
- export ASAN_OPTIONS=verbosity=1:debug=1
- ctest --verbose --output-on-failure
- if [[ "$VALGRIND" == "true" ]]; then valgrind --leak-check=full --error-exitcode=1 ./SQLiteCpp_example1 ; fi
- if [[ "$VALGRIND" == "true" ]]; then valgrind --leak-check=full --error-exitcode=1 ./SQLiteCpp_tests ; fi

# generate and publish GCov coveralls results
after_success:
- if [[ "$COVERALLS" == "true" ]]; then coveralls --root .. -e examples -e googletest -e sqlite3 -e tests -E ".*feature_tests.*" -E ".*CompilerId.*" --gcov-options '\-lp' ; fi
# Copyright (c) 2012-2023 Sebastien Rombauts ([email protected])

language: cpp

# Use Linux unless specified otherwise
os: linux

cache:
apt: true

env:
global:
- BUILD_TYPE=Debug
- ASAN=ON
- INTERNAL_SQLITE=ON
- VALGRIND=OFF
- TESTS=ON
- SHARED_LIBS=OFF

# Build variants (should test a reasonable number of combination of CMake options)
jobs:
include:

##########################################################################
# GCC on Linux
##########################################################################

# GCC 11.2.0 (Ubuntu Jammy 22.04)
- dist: jammy
env:
- cc=gcc cxx=g++

# Clang 9.3.0 (Ubuntu Focal 20.04)
- dist: focal
env:
- cc=gcc cxx=g++

# Coverity static code analysis (Ubuntu Bionic 18.04)
- dist: bionic
env:
- COVERITY_SCAN_PROJECT_NAME=SRombauts/SQLiteCpp
- COVERITY_SCAN_BRANCH_PATTERN=master
- [email protected]
- COVERITY_SCAN_BUILD_COMMAND_PREPEND="cmake ."
- COVERITY_SCAN_BUILD_COMMAND="make -j8"
# Encrypted COVERITY_SCAN_TOKEN, created via the "travis encrypt" command using the project repo's public key
- secure: "Qm4d8NEDPBtYZCYav46uPEvDCtaRsjLXlkVS+C+WCJAPcwXCGkrr96wEi7RWcq2xD86QCh0XiqaPT+xdUmlohOYIovRhaaBmZ1lwIJ4GsG/ZR6xoFr3DYsZ3o4GyXk2vNXNxEl82AC+Xs6e6gkLOV9XRkBcjpVIvoIXgNlKWeGY="

# GCC 7.4.0 Debug build with GCov for coverage build (Ubuntu Bionic 18.04)
- dist: bionic
env:
- cc=gcc cxx=g++
- GCOV=ON
- COVERALLS=ON

# GCC 7.4.0 Debug build with Valgrind instead of Address Sanitizer (Ubuntu Bionic 18.04)
- dist: bionic
env:
- cc=gcc cxx=g++
- ASAN=OFF
- VALGRIND=ON

# GCC 7.4.0 Release build (Ubuntu Bionic 18.04)
- dist: bionic
env:
- cc=gcc cxx=g++
- BUILD_TYPE=Release

# GCC 7.4.0 Shared Libs (Ubuntu Bionic 18.04)
- dist: bionic
env:
- cc=gcc cxx=g++
- SHARED_LIBS=ON

# GCC 7.4.0 test linking with libsqlite3-dev package (Ubuntu Bionic 18.04)
- dist: bionic
env:
- cc=gcc cxx=g++
- INTERNAL_SQLITE=OFF

# GCC 5.4.0 (Ubuntu Xenial 16.04)
- dist: xenial
env:
- cc=gcc cxx=g++

# GCC 4.8.4 (Ubuntu Trusty 14.04)
- dist: trusty
env:
- cc=gcc cxx=g++
- TESTS=OFF

##########################################################################
# Clang on Linux
##########################################################################

# Clang 7.0.0 (Ubuntu Jammy 22.04)
- dist: jammy
env:
- cc=clang cxx=clang++

# Clang 7.0.0 (Ubuntu Focal 20.04)
- dist: focal
env:
- cc=clang cxx=clang++

# Clang 7.0.0 (Ubuntu Bionic 18.04)
- dist: bionic
env:
- cc=clang cxx=clang++

# Clang 7.0.0 (Ubuntu Xenial 16.04)
- dist: xenial
env:
- cc=clang cxx=clang++

# Clang 5.0.0 (Ubuntu Trusty 14.04)
- dist: trusty
env:
- cc=clang cxx=clang++
- TESTS=OFF

##########################################################################
# Clang on OSX
##########################################################################

# Latest XCode - AppleClang 9.1.0
- os: osx
env:
- cc=clang cxx=clang++

# XCode 8.3 - AppleClang 8.1.0
- os: osx
osx_image: xcode8.3
env:
- cc=clang cxx=clang++

before_install:
# Coverity: don't use addons.coverity_scan since it run on every job of the build matrix, which waste resources and exhausts quotas
# Note: the job dedicated to Coverity need to only run the shell script and then exit (to not try to build and run unit tests etc.)
- if [[ -n "$COVERITY_SCAN_PROJECT_NAME" ]] ; then curl -s https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh | bash ; exit 0 ; fi

- if [[ "$INTERNAL_SQLITE" == "OFF" ]]; then sudo apt-get install libsqlite3-dev ; fi
- if [[ "$VALGRIND" == "ON" ]]; then sudo apt-get install valgrind ; fi
- if [[ "$COVERALLS" == "ON" ]]; then pip install --user cpp-coveralls ; fi

# Set the compiler environment variables properly
- export CC=${cc}
- export CXX=${cxx}

# scripts to run before build
before_script:
- mkdir build
- cd build
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_SHARED_LIBS=$SHARED_LIBS -DSQLITECPP_INTERNAL_SQLITE=$INTERNAL_SQLITE -DSQLITECPP_USE_ASAN=$ASAN -DSQLITECPP_USE_GCOV=$GCOV -DSQLITECPP_BUILD_EXAMPLES=$TESTS -DSQLITECPP_BUILD_TESTS=$TESTS ..

# build examples, and run tests (ie make & make test)
script:
- cmake --build .
- export ASAN_OPTIONS=verbosity=1:debug=1
- if [[ "$TESTS" == "ON" ]]; then ctest --verbose --output-on-failure ; fi
- if [[ "$VALGRIND" == "ON" ]]; then valgrind --leak-check=full --error-exitcode=1 bin/SQLiteCpp_example1 ; fi
- if [[ "$VALGRIND" == "ON" ]]; then valgrind --leak-check=full --error-exitcode=1 bin/SQLiteCpp_tests ; fi

# generate and publish GCov coveralls results
after_success:
- if [[ "$COVERALLS" == "ON" ]]; then coveralls --root .. -e examples -e googletest -e sqlite3 -e tests -E ".*feature_tests.*" -E ".*CompilerId.*" --gcov-options '\-lp' ; fi
4 changes: 2 additions & 2 deletions include/SQLiteCpp/Statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ class SQLITECPP_API Statement
Statement(const Statement&) = delete;
Statement& operator=(const Statement&) = delete;

// TODO: Change Statement move constructor to default
// Statement is movable
Statement(Statement&& aStatement) noexcept;
Statement& operator=(Statement&& aStatement) noexcept = default;
Statement& operator=(Statement&& aStatement) = default;

/// Finalize and unregister the SQL query from the SQLite Database Connection.
/// The finalization will be done by the destructor of the last shared pointer
Expand Down
6 changes: 3 additions & 3 deletions tests/Column_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void test_column_basis(bool utf16)
EXPECT_STREQ("first", ptxt);
EXPECT_EQ("first", msg);
EXPECT_EQ(-123, integer);
EXPECT_EQ(0.123, real);
EXPECT_DOUBLE_EQ(0.123, real);
EXPECT_EQ(0, memcmp("bl\0b", pblob, size));
#if !defined(_MSC_VER) || _MSC_VER >= 1900
EXPECT_EQ((size_t)size, sblob.size());
Expand Down Expand Up @@ -129,7 +129,7 @@ static void test_column_basis(bool utf16)
EXPECT_EQ("first", msg1);
EXPECT_EQ("first", msg2);
EXPECT_EQ(-123, integer);
EXPECT_EQ(0.123, real);
EXPECT_DOUBLE_EQ(0.123, real);
EXPECT_EQ(0, memcmp("bl\0b", pblob, 4));
EXPECT_EQ(0, memcmp("bl\0b", &sblob[0], 4));
}
Expand Down Expand Up @@ -195,7 +195,7 @@ static void test_column_basis(bool utf16)
const SQLite::Column integer = query.getColumn(2);
EXPECT_EQ(-123, integer.getInt());
const SQLite::Column dbl = query.getColumn(3);
EXPECT_EQ(0.123, dbl.getDouble());
EXPECT_DOUBLE_EQ(0.123, dbl.getDouble());
}
}

Expand Down
Loading