Unix Build #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unix Build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
formatting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install clang-format | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 11 | |
rm llvm.sh | |
sudo apt-get install -y --no-install-recommends clang-format-11 | |
- name: Format files | |
run: find src include -type f -a \( -name "*.cc" -o -name "*.h" \) -print0 | xargs -0 clang-format-11 -i | |
- name: Check for differences | |
run: | | |
git status --porcelain | |
git status --porcelain | xargs -I {} -0 test -z \"{}\" | |
build: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- name: MacOS Release | |
cxx: clang++ | |
cc: clang | |
mode: Release | |
cxxflags: -stdlib=libc++ | |
os: macos-latest | |
- name: GCC 10 Release | |
cxx: g++-10 | |
cc: gcc-10 | |
mode: Release | |
os: ubuntu-latest | |
- name: GCC 10 Debug | |
cxx: g++-10 | |
cc: gcc-10 | |
mode: Debug | |
os: ubuntu-latest | |
- name: Clang 11 Release | |
cxx: clang++-11 | |
cc: clang-11 | |
mode: Release | |
cxxflags: -stdlib=libc++ | |
ldflags: -lc++abi | |
os: ubuntu-latest | |
- name: Clang Tidy | |
cxx: clang++-11 | |
cc: clang-11 | |
mode: Debug | |
cxxflags: -stdlib=libc++ | |
ldflags: -lc++abi | |
lint: true | |
os: ubuntu-20.04 | |
env: | |
UBSAN_OPTIONS: halt_on_error=1:abort_on_error=1 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: seanmiddleditch/gha-setup-ninja@master | |
# ==== INSTALL ==== | |
- name: Update APT Cache | |
if: matrix.config.os != 'macos-latest' | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: sudo apt update | |
- name: Install LLVM | |
if: matrix.config.os != 'macos-latest' && matrix.config.cc == 'clang-11' | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 11 | |
rm llvm.sh | |
sudo apt-get install -y --no-install-recommends libc++-11-dev libc++abi-11-dev clang-tidy-11 | |
- name: Install Valgrind | |
if: matrix.config.mode == 'Debug' && matrix.config.cc == 'gcc-10' | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: sudo apt-get install -y --no-install-recommends valgrind | |
# ==== BUILD ==== | |
- name: CMake | |
run: | | |
cmake \ | |
-G Ninja -S . -B build \ | |
-DCMAKE_C_COMPILER=${{ matrix.config.cc }} \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \ | |
-DCMAKE_C_FLAGS="${{ matrix.config.cflags }}" \ | |
-DCMAKE_CXX_FLAGS="${{ matrix.config.cxxflags }}" \ | |
-DCMAKE_CXX_FLAGS_DEBUG="" \ | |
-DCMAKE_CXX_LINKER_FLAGS=${{ matrix.config.ldflags }}" \ | |
-DCMAKE_CXX_EXE_LINKER_FLAGS="${{ matrix.config.ldflags }} \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.mode }} \ | |
-DGEO_TIDY=${{ matrix.config.lint }} | |
- name: Build | |
run: cmake --build build --target geo-test | |
# ==== TESTS ==== | |
- name: Run Tests | |
run: | | |
./build/geo-test | |
# ==== VALGRIND ==== | |
- name: Run Tests Valgrind | |
if: matrix.config.mode == 'Debug' && matrix.config.cc == 'gcc-10' | |
run: | | |
valgrind --error-exitcode=1 --show-reachable=yes --leak-check=full ./build/geo-test |