Merge pull request #2500 from offa/ghactions_ci

Migrate to Github Actions CI
This commit is contained in:
Gabi Melman 2022-10-03 18:52:35 +03:00 committed by GitHub
commit 936697e5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 94 additions and 156 deletions

81
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,81 @@
name: ci
on: [push, pull_request]
jobs:
build_linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
config:
- { compiler: gcc, version: 4.9, build_type: Release, cppstd: 11, examples: OFF, asan: OFF }
- { compiler: gcc, version: 7, build_type: Release, cppstd: 11 }
- { compiler: gcc, version: 9, build_type: Release, cppstd: 17 }
- { compiler: gcc, version: 11, build_type: Debug, cppstd: 20 }
- { compiler: gcc, version: 12, build_type: Release, cppstd: 20 }
- { compiler: clang, version: 3.5, build_type: Release, cppstd: 11, asan: OFF }
- { compiler: clang, version: 10, build_type: Release, cppstd: 11 }
- { compiler: clang, version: 10, build_type: Debug, cppstd: 17, asan: OFF }
- { compiler: clang, version: 12, build_type: Debug, cppstd: 17, asan: OFF }
- { compiler: clang, version: 15, build_type: Release, cppstd: 20, asan: OFF }
container:
image: ${{ matrix.config.compiler == 'clang' && 'teeks99/clang-ubuntu' || matrix.config.compiler }}:${{ matrix.config.version }}
name: "${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }})"
steps:
- uses: actions/checkout@main
- name: Setup
run: |
apt-get update && apt-get install -y curl
CMAKE_VERSION="3.24.2"
curl -sSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh -o install-cmake.sh
chmod +x install-cmake.sh
./install-cmake.sh --prefix=/usr/local --skip-license
- name: Setup Compiler
if: matrix.config.compiler == 'clang'
run: |
if [[ "${{ matrix.config.version }}" -ge 4 ]]; then
scripts/ci_setup_clang.sh "${{ matrix.config.version }}"
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
fi
echo "CC=clang-${{ matrix.config.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.config.version }}" >> $GITHUB_ENV
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.config.cppstd }} \
-DSPDLOG_BUILD_EXAMPLE=${{ matrix.config.examples || 'ON' }} \
-DSPDLOG_BUILD_EXAMPLE_HO=${{ matrix.config.examples || 'ON' }} \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_SANITIZE_ADDRESS=${{ matrix.config.asan || 'ON' }}
make -j2
ctest -j2 --output-on-failure
build_osx:
runs-on: macOS-latest
name: "OS X Clang (C++11, Release)"
steps:
- uses: actions/checkout@main
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=11 \
-DSPDLOG_BUILD_EXAMPLE=ON \
-DSPDLOG_BUILD_EXAMPLE_HO=ON \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_SANITIZE_ADDRESS=OFF
make -j2
ctest -j2 --output-on-failure

View File

@ -1,155 +0,0 @@
# Adapted from various sources, including:
# - Louis Dionne's Hana: https://github.com/ldionne/hana
# - Paul Fultz II's FIT: https://github.com/pfultz2/Fit
# - Eric Niebler's range-v3: https://github.com/ericniebler/range-v3
sudo: required
language: cpp
# gcc 4.9
addons: &gcc49
apt:
packages:
- g++-4.9
sources:
- ubuntu-toolchain-r-test
# gcc 7.0
addons: &gcc7
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
# gcc 9.0
addons: &gcc9
apt:
packages:
- g++-9
sources:
- ubuntu-toolchain-r-test
# gcc 11.0
addons: &gcc11
apt:
packages:
- g++-11
sources:
- ubuntu-toolchain-r-test
# Clang 3.5
addons: &clang35
apt:
packages:
- clang-3.5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5
addons: &clang10
apt:
packages:
- clang-10
- lldb-10
- lld-10
sources:
- sourceline: "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
addons: &clang12
apt:
packages:
- clang-12
- lldb-12
- lld-12
sources:
- sourceline: "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
env:
global:
- BUILD_EXAMPLE='ON'
matrix:
include:
# Test gcc-4.9: C++11, Build=Release
- env: GCC_VERSION=4.9 BUILD_TYPE=Release CPP=11 BUILD_EXAMPLE='OFF'
os: linux
addons: *gcc49
# Test gcc-7: C++11, Build=Release
- env: GCC_VERSION=7 BUILD_TYPE=Release CPP=11
os: linux
addons: *gcc7
# Test gcc-9: C++17, Build=Release
- env: GCC_VERSION=9 BUILD_TYPE=Release CPP=17
os: linux
addons: *gcc9
# Test gcc-11.0: C++20, Build=Debug
- env: GCC_VERSION=11 BUILD_TYPE=Debug CPP=20 ASAN=Off
os: linux
dist: bionic
addons: *gcc11
# Test clang-3.5: C++11, Build=Release
- env: CLANG_VERSION=3.5 BUILD_TYPE=Release CPP=11
os: linux
addons: *clang35
# Text osx
- env: BUILD_TYPE=Release CPP=11 ASAN=Off TSAN=Off
os: osx
# Test clang-10.0: C++11, Build=Release
- env: CLANG_VERSION=10 BUILD_TYPE=Release CPP=11 ASAN=On
os: linux
dist: bionic
addons: *clang10
# Test clang-10.0: C++17, Build=Debug
- env: CLANG_VERSION=10 BUILD_TYPE=Debug CPP=17 ASAN=Off
os: linux
dist: bionic
addons: *clang10
# Test clang-12.0: C++17, Build=Debug
- env: CLANG_VERSION=12 BUILD_TYPE=Debug CPP=17 ASAN=Off
os: linux
dist: bionic
addons: *clang12
before_script:
- if [ -n "$GCC_VERSION" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
- if [ -n "$CLANG_VERSION" ]; then export CXX="clang++-${CLANG_VERSION}" CC="clang-${CLANG_VERSION}"; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CXX="clang++" CC="clang"; fi
- which $CXX
- which $CC
- $CXX --version
- cmake --version
script:
- cd ${TRAVIS_BUILD_DIR}
- mkdir -p build && cd build
- |
cmake .. \
--warn-uninitialized \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_CXX_STANDARD=$CPP \
-DSPDLOG_BUILD_EXAMPLE=$BUILD_EXAMPLE \
-DSPDLOG_BUILD_EXAMPLE_HO=$BUILD_EXAMPLE \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_SANITIZE_ADDRESS=$ASAN
- make VERBOSE=1 -j2
- ctest -j2 --output-on-failure

View File

@ -1,6 +1,6 @@
# spdlog
Very fast, header-only/compiled, C++ logging library. [![Build Status](https://app.travis-ci.com/gabime/spdlog.svg?branch=v1.x)](https://app.travis-ci.com/gabime/spdlog)  [![Build status](https://ci.appveyor.com/api/projects/status/d2jnxclg20vd0o50?svg=true&branch=v1.x)](https://ci.appveyor.com/project/gabime/spdlog) [![Release](https://img.shields.io/github/release/gabime/spdlog.svg)](https://github.com/gabime/spdlog/releases/latest)
Very fast, header-only/compiled, C++ logging library. [![ci](https://github.com/gabime/spdlog/actions/workflows/ci.yml/badge.svg)](https://github.com/gabime/spdlog/actions/workflows/ci.yml)  [![Build status](https://ci.appveyor.com/api/projects/status/d2jnxclg20vd0o50?svg=true&branch=v1.x)](https://ci.appveyor.com/project/gabime/spdlog) [![Release](https://img.shields.io/github/release/gabime/spdlog.svg)](https://github.com/gabime/spdlog/releases/latest)
## Install
#### Header only version

12
scripts/ci_setup_clang.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -ex
VERSION=$1
apt-get update
apt-get install -y libc++-${VERSION}-dev libc++abi-${VERSION}-dev
if [[ "${VERSION}" -ge 12 ]]; then
apt-get install -y --no-install-recommends libunwind-${VERSION}-dev
fi