Split macOS and Ubuntu CIs for readability (#1754)

This commit is contained in:
Ken Matsui 2023-08-28 02:07:52 -07:00 committed by GitHub
parent f761c54aa8
commit 3ecb8b4917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 76 additions and 71 deletions

View File

@ -1,4 +1,4 @@
name: Build Drogon
name: Build & Test
on:
push:
@ -64,32 +64,9 @@ jobs:
shell: bash
run: ./test.sh -w
unix:
name: ${{ matrix.buildname }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
buildname: "ubuntu-22.04/gcc"
link: SHARED
triplet: x64-linux
compiler: gcc_64
- os: ubuntu-22.04
buildname: "ubuntu-22.04/gcc"
link: STATIC
triplet: x64-linux
compiler: gcc_64
- os: ubuntu-22.04
buildname: "ubuntu-22.04/gcc-10"
link: STATIC
triplet: x64-linux
- os: macos-latest
buildname: "macos/clang"
link: STATIC
triplet: x64-osx
compiler: clang_64
macos:
name: macos/clang
runs-on: macos-latest
steps:
- name: Checkout Drogon source code
uses: actions/checkout@v2
@ -97,64 +74,25 @@ jobs:
submodules: true
fetch-depth: 0
- name: (macOS) Install dependencies
if: runner.os == 'macOS'
- name: Install dependencies
# Already installed: brotli, zlib, postgresql@14, lz4, sqlite3
run: brew install jsoncpp mariadb hiredis redis
- name: (Linux) Install dependencies
if: runner.os == 'Linux'
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 libbrotli-dev
- name: (Linux) Install gcc-10
if: matrix.buildname == 'ubuntu-22.04/gcc-10'
run: sudo apt-get install -y gcc-10 g++-10
- name: (Linux) Install postgresql
if: matrix.os == 'ubuntu-22.04'
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/gcc-10'
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DBUILD_TESTING=on \
-DBUILD_SHARED_LIBS=$shared
- name: Create Build Environment & Configure Cmake (gcc-10)
# 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/gcc-10'
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DBUILD_TESTING=on \
-DCMAKE_CXX_FLAGS="-fcoroutines" \
-DBUILD_SHARED_LIBS=$shared
env:
CC: gcc-10
CXX: g++-10
-DBUILD_SHARED_LIBS=OFF
- name: Build
working-directory: ./build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: make -j $(nproc) && sudo make install
- name: (macOS) Prepare for testing
if: runner.os == 'macOS'
- name: Prepare for testing
run: |
brew tap homebrew/services
brew services restart postgresql@14
@ -168,8 +106,75 @@ jobs:
sleep 4
psql -c 'create user postgres superuser;' postgres
- name: (Linux) Prepare for testing
if: runner.os == 'Linux'
- 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@v2
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 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 \
-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 \
-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 <NAME>"
run: make -j $(nproc) && sudo make install
- name: Prepare for testing
run: |
sudo systemctl start postgresql
sleep 1