name: Build & Test on: push: branches: [master] pull_request: workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release jobs: windows: name: windows/msvc - ${{ matrix.link }} runs-on: windows-2019 strategy: fail-fast: false matrix: link: ["STATIC", "SHARED"] steps: - name: Checkout Drogon source code uses: actions/checkout@v3 with: submodules: true fetch-depth: 0 - name: Install dependencies run: pip install conan - name: Create build directory run: mkdir build - name: Install conan packages working-directory: ./build run: | conan profile detect conan install .. -s compiler="msvc" -sbuild_type=Debug --build=missing -s compiler.cppstd=17 - name: Create Build Environment & Configure Cmake shell: bash working-directory: ./build run: | [[ ${{ matrix.link }} == "SHARED" ]] && shared="ON" || shared="OFF" cmake .. \ -DCMAKE_BUILD_TYPE=Debug \ -DBUILD_TESTING=on \ -DBUILD_SHARED_LIBS=$shared \ -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" \ -DBUILD_CTL=ON \ -DBUILD_EXAMPLES=ON \ -DCMAKE_INSTALL_PREFIX=../install \ -DCMAKE_POLICY_DEFAULT_CMP0091=NEW \ -DCMAKE_CXX_STANDARD=17 - name: Build run: cmake --build build --target install --parallel - name: Test shell: bash run: ./test.sh -w macos: name: macos/clang runs-on: macos-latest steps: - name: Checkout Drogon source code uses: actions/checkout@v3 with: submodules: true fetch-depth: 0 - name: Install dependencies # Already installed: brotli, zlib, postgresql@14, lz4, sqlite3 run: brew install ninja jsoncpp mariadb hiredis redis - 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: | cmake -B build -G Ninja \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DBUILD_TESTING=on \ -DBUILD_SHARED_LIBS=OFF - name: Build working-directory: ./build # Execute the build. You can specify a specific target with "--target " run: ninja && sudo ninja install - 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: name: ${{ matrix.buildname }} runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: include: - buildname: "ubuntu-22.04/gcc" link: SHARED - buildname: "ubuntu-22.04/gcc" link: STATIC - buildname: "ubuntu-22.04/coroutines" link: STATIC steps: - name: Checkout Drogon source code uses: actions/checkout@v3 with: submodules: true fetch-depth: 0 - name: Install dependencies 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 sudo apt-get install -y ninja-build libbrotli-dev - name: Install postgresql run: | sudo apt-get --purge remove postgresql postgresql-doc postgresql-common postgresql-client-common sudo apt-get -y install postgresql-all - 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 if: matrix.buildname != 'ubuntu-22.04/coroutines' run: | cmake -B build -G Ninja \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DBUILD_TESTING=on \ -DBUILD_SHARED_LIBS=$shared - name: Create Build Environment & Configure Cmake (coroutines) # 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 if: matrix.buildname == 'ubuntu-22.04/coroutines' run: | cmake -B build -G Ninja \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DBUILD_TESTING=on \ -DCMAKE_CXX_FLAGS="-fcoroutines" \ -DBUILD_SHARED_LIBS=$shared - name: Build working-directory: ./build # Execute the build. You can specify a specific target with "--target " run: ninja && sudo ninja install - name: Prepare for testing 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