2023-08-28 09:07:52 +00:00
|
|
|
name: Build & Test
|
2020-12-13 10:12:30 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-08-28 05:50:22 +00:00
|
|
|
branches: [master]
|
2020-12-13 10:12:30 +00:00
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
2023-08-27 12:53:36 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
|
2020-12-13 10:12:30 +00:00
|
|
|
env:
|
|
|
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
|
|
|
BUILD_TYPE: Release
|
|
|
|
|
|
|
|
jobs:
|
2021-04-09 02:17:28 +00:00
|
|
|
windows:
|
2022-07-26 04:16:22 +00:00
|
|
|
name: windows/msvc - ${{ matrix.link }}
|
2023-02-27 06:30:38 +00:00
|
|
|
runs-on: windows-2019
|
2021-04-09 02:17:28 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-08-28 05:50:22 +00:00
|
|
|
link: ["STATIC", "SHARED"]
|
2021-04-09 02:17:28 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout Drogon source code
|
2023-10-01 12:37:09 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-04-09 02:17:28 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-07-26 04:16:22 +00:00
|
|
|
run: pip install conan
|
2021-04-09 02:17:28 +00:00
|
|
|
|
|
|
|
- name: Create build directory
|
2022-07-26 04:16:22 +00:00
|
|
|
run: mkdir build
|
2021-04-09 02:17:28 +00:00
|
|
|
|
|
|
|
- name: Install conan packages
|
|
|
|
working-directory: ./build
|
2023-02-27 06:30:38 +00:00
|
|
|
run: |
|
|
|
|
conan profile detect
|
|
|
|
conan install .. -s compiler="msvc" -sbuild_type=Debug --build=missing -s compiler.cppstd=17
|
2021-04-09 02:17:28 +00:00
|
|
|
|
|
|
|
- name: Create Build Environment & Configure Cmake
|
|
|
|
shell: bash
|
|
|
|
working-directory: ./build
|
|
|
|
run: |
|
|
|
|
[[ ${{ matrix.link }} == "SHARED" ]] && shared="ON" || shared="OFF"
|
2023-02-27 06:30:38 +00:00
|
|
|
cmake .. \
|
|
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
|
|
-DBUILD_TESTING=on \
|
|
|
|
-DBUILD_SHARED_LIBS=$shared \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" \
|
|
|
|
-DBUILD_CTL=ON \
|
|
|
|
-DBUILD_EXAMPLES=ON \
|
2023-12-04 15:42:35 +00:00
|
|
|
-DUSE_SPDLOG=ON \
|
2023-02-27 06:30:38 +00:00
|
|
|
-DCMAKE_INSTALL_PREFIX=../install \
|
|
|
|
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW \
|
|
|
|
-DCMAKE_CXX_STANDARD=17
|
2021-04-09 02:17:28 +00:00
|
|
|
|
|
|
|
- name: Build
|
2022-07-26 04:16:22 +00:00
|
|
|
run: cmake --build build --target install --parallel
|
2021-04-09 02:17:28 +00:00
|
|
|
|
|
|
|
- name: Test
|
|
|
|
shell: bash
|
|
|
|
run: ./test.sh -w
|
|
|
|
|
2023-08-28 09:07:52 +00:00
|
|
|
macos:
|
2023-12-28 07:59:29 +00:00
|
|
|
runs-on: macos-${{ matrix.osver }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-12-28 14:29:45 +00:00
|
|
|
osver: [12, 13]
|
2023-08-28 09:07:52 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout Drogon source code
|
2023-10-01 12:37:09 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-08-28 09:07:52 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2023-12-28 07:59:29 +00:00
|
|
|
# Already installed: brotli, zlib, lz4, sqlite3
|
|
|
|
run: brew install ninja jsoncpp mariadb hiredis redis spdlog postgresql@14
|
2023-08-28 09:07:52 +00:00
|
|
|
|
|
|
|
- name: Create Build Environment & Configure Cmake
|
|
|
|
# Some projects don't allow in-source building, so create a separate build directory
|
|
|
|
# We'll use this as our working directory for all subsequent commands
|
|
|
|
run: |
|
2023-08-28 09:59:14 +00:00
|
|
|
cmake -B build -G Ninja \
|
2023-08-28 09:07:52 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
|
|
|
-DBUILD_TESTING=on \
|
2023-12-04 15:42:35 +00:00
|
|
|
-DUSE_SPDLOG=ON \
|
2023-08-28 09:07:52 +00:00
|
|
|
-DBUILD_SHARED_LIBS=OFF
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
working-directory: ./build
|
|
|
|
# Execute the build. You can specify a specific target with "--target <NAME>"
|
2023-08-28 09:59:14 +00:00
|
|
|
run: ninja && sudo ninja install
|
2023-08-28 09:07:52 +00:00
|
|
|
|
|
|
|
- name: Prepare for testing
|
|
|
|
run: |
|
|
|
|
brew tap homebrew/services
|
|
|
|
brew services restart postgresql@14
|
|
|
|
brew services start mariadb
|
|
|
|
brew services start redis
|
|
|
|
sleep 4
|
|
|
|
mariadb -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('')"
|
|
|
|
mariadb -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'"
|
|
|
|
mariadb -e "FLUSH PRIVILEGES"
|
|
|
|
brew services restart mariadb
|
|
|
|
sleep 4
|
|
|
|
psql -c 'create user postgres superuser;' postgres
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
# Execute tests defined by the CMake configuration.
|
|
|
|
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
|
|
|
run: ./test.sh -t
|
|
|
|
|
|
|
|
ubuntu:
|
|
|
|
runs-on: ubuntu-22.04
|
2020-12-13 10:12:30 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-12-28 07:59:29 +00:00
|
|
|
link: [SHARED, STATIC]
|
|
|
|
compiler:
|
|
|
|
- cxx: g++
|
|
|
|
ver: 9
|
|
|
|
- cxx: g++
|
|
|
|
ver: 10
|
|
|
|
- cxx: g++
|
|
|
|
ver: 11
|
|
|
|
- cxx: g++
|
|
|
|
ver: 12
|
|
|
|
- cxx: g++
|
|
|
|
ver: 13
|
|
|
|
- cxx: clang++
|
|
|
|
ver: 11
|
|
|
|
- cxx: clang++
|
|
|
|
ver: 12
|
|
|
|
- cxx: clang++
|
|
|
|
ver: 13
|
|
|
|
- cxx: clang++
|
|
|
|
ver: 14
|
|
|
|
- cxx: clang++
|
|
|
|
ver: 15
|
|
|
|
- cxx: clang++
|
|
|
|
ver: 16
|
|
|
|
- cxx: clang++
|
|
|
|
ver: 17
|
2020-12-13 10:12:30 +00:00
|
|
|
include:
|
2023-12-28 07:59:29 +00:00
|
|
|
- link: STATIC
|
|
|
|
compiler:
|
|
|
|
cxx: g++
|
|
|
|
ver: 13
|
|
|
|
feature: coroutines
|
|
|
|
env:
|
|
|
|
CXX: ${{ matrix.compiler.cxx }}-${{ matrix.compiler.ver }}
|
2020-12-13 10:12:30 +00:00
|
|
|
steps:
|
2023-08-28 05:50:22 +00:00
|
|
|
- name: Checkout Drogon source code
|
2023-10-01 12:37:09 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-08-28 05:50:22 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-08-28 09:07:52 +00:00
|
|
|
- name: Install dependencies
|
2023-08-28 05:50:22 +00:00
|
|
|
run: |
|
|
|
|
# Installing packages might fail as the github image becomes outdated
|
|
|
|
sudo apt update
|
|
|
|
# These aren't available or don't work well in vcpkg
|
|
|
|
sudo apt-get install -y libjsoncpp-dev uuid-dev libssl-dev zlib1g-dev libsqlite3-dev
|
2023-08-28 09:59:14 +00:00
|
|
|
sudo apt-get install -y ninja-build libbrotli-dev
|
2023-12-04 15:42:35 +00:00
|
|
|
sudo apt-get install -y libspdlog-dev
|
2023-08-28 05:50:22 +00:00
|
|
|
|
2023-08-28 09:07:52 +00:00
|
|
|
- name: Install postgresql
|
2023-08-28 05:50:22 +00:00
|
|
|
run: |
|
|
|
|
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common postgresql-client-common
|
|
|
|
sudo apt-get -y install postgresql-all
|
2023-08-28 09:07:52 +00:00
|
|
|
|
2023-12-28 07:59:29 +00:00
|
|
|
- name: Install Clang
|
|
|
|
if: startsWith(matrix.compiler.cxx, 'clang') && matrix.compiler.ver < 13
|
|
|
|
run: sudo apt-get install clang-${{ matrix.compiler.ver }}
|
|
|
|
|
|
|
|
- name: Install Clang
|
|
|
|
if: startsWith(matrix.compiler.cxx, 'clang') && matrix.compiler.ver >= 13
|
|
|
|
run: |
|
|
|
|
wget https://apt.llvm.org/llvm.sh
|
|
|
|
chmod +x ./llvm.sh
|
|
|
|
sudo ./llvm.sh ${{ matrix.compiler.ver }}
|
|
|
|
|
2023-08-28 05:50:22 +00:00
|
|
|
- name: Export `shared`
|
|
|
|
run: |
|
|
|
|
[[ ${{ matrix.link }} == "SHARED" ]] && shared="ON" || shared="OFF"
|
|
|
|
echo "shared=$shared" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Create Build Environment & Configure Cmake
|
|
|
|
# Some projects don't allow in-source building, so create a separate build directory
|
|
|
|
# We'll use this as our working directory for all subsequent commands
|
2023-12-28 07:59:29 +00:00
|
|
|
if: matrix.compiler.feature != 'coroutines'
|
2023-08-28 05:50:22 +00:00
|
|
|
run: |
|
2023-08-28 09:59:14 +00:00
|
|
|
cmake -B build -G Ninja \
|
2023-08-28 05:50:22 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
|
|
|
-DBUILD_TESTING=on \
|
2023-12-04 15:42:35 +00:00
|
|
|
-DUSE_SPDLOG=ON \
|
2023-08-28 05:50:22 +00:00
|
|
|
-DBUILD_SHARED_LIBS=$shared
|
2023-08-28 09:07:52 +00:00
|
|
|
- name: Create Build Environment & Configure Cmake (coroutines)
|
2023-08-28 05:50:22 +00:00
|
|
|
# Some projects don't allow in-source building, so create a separate build directory
|
|
|
|
# We'll use this as our working directory for all subsequent commands
|
2023-12-28 07:59:29 +00:00
|
|
|
if: matrix.compiler.feature == 'coroutines'
|
2023-08-28 05:50:22 +00:00
|
|
|
run: |
|
2023-08-28 09:59:14 +00:00
|
|
|
cmake -B build -G Ninja \
|
2023-08-28 05:50:22 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
|
|
|
-DBUILD_TESTING=on \
|
2023-12-04 15:42:35 +00:00
|
|
|
-DUSE_SPDLOG=ON \
|
2023-08-28 05:50:22 +00:00
|
|
|
-DCMAKE_CXX_FLAGS="-fcoroutines" \
|
2023-12-04 15:42:35 +00:00
|
|
|
-DBUILD_SHARED_LIBS=$shared \
|
2023-08-28 05:50:22 +00:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
working-directory: ./build
|
|
|
|
# Execute the build. You can specify a specific target with "--target <NAME>"
|
2023-08-28 09:59:14 +00:00
|
|
|
run: ninja && sudo ninja install
|
2023-08-28 05:50:22 +00:00
|
|
|
|
2023-08-28 09:07:52 +00:00
|
|
|
- name: Prepare for testing
|
2023-08-28 05:50:22 +00:00
|
|
|
run: |
|
|
|
|
sudo systemctl start postgresql
|
|
|
|
sleep 1
|
|
|
|
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '12345'" postgres
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
# Execute tests defined by the CMake configuration.
|
|
|
|
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
|
|
|
run: ./test.sh -t
|