diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab8de30..3e0deb5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,43 +1,315 @@ -name: C++ CI +name: CI on: push -env: - BUILD_TYPE: Release - jobs: - test: + ci: + name: ${{ matrix.name }} runs-on: ${{ matrix.os }} + + env: + CMAKE_GENERATOR: Ninja + strategy: + fail-fast: false matrix: - os: [ - ubuntu-latest, - ubuntu-16.04, - windows-latest, - windows-2016, - macos-latest + # Github Actions requires a single row to be added to the build matrix. + # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. + name: [ + ubuntu-18.04-gcc-4.8, + ubuntu-18.04-gcc-4.9, + ubuntu-18.04-gcc-5, + ubuntu-18.04-gcc-6, + ubuntu-18.04-gcc-7, + ubuntu-18.04-gcc-8, + ubuntu-18.04-gcc-9, + ubuntu-18.04-clang-3.5, + ubuntu-18.04-clang-3.6, + ubuntu-18.04-clang-3.7, + ubuntu-18.04-clang-3.8, + ubuntu-18.04-clang-3.9, + ubuntu-18.04-clang-4.0, + ubuntu-18.04-clang-5.0, + ubuntu-18.04-clang-6.0, + ubuntu-18.04-clang-7, + ubuntu-18.04-clang-8, + ubuntu-18.04-clang-9, + windows-2016-cl, + windows-2016-clang-cl, + windows-2016-clang, + windows-2016-gcc, + windows-2019-cl, + windows-2019-clang-cl, + windows-2019-clang, + windows-2019-gcc, + macOS-10.14-xcode-9.4.1, + macOS-10.14-xcode-10.0, + macOS-10.14-xcode-10.1, + macOS-10.14-xcode-10.2, + macOS-10.14-xcode-10.2.1, + macOS-10.14-xcode-10.3, + macOS-10.14-gcc-7, + macOS-10.14-gcc-8, + macOS-10.14-gcc-9, ] + include: + - name: ubuntu-18.04-gcc-4.8 + os: ubuntu-18.04 + compiler: gcc + version: "4.8" + + - name: ubuntu-18.04-gcc-4.9 + os: ubuntu-18.04 + compiler: gcc + version: "4.9" + + - name: ubuntu-18.04-gcc-5 + os: ubuntu-18.04 + compiler: gcc + version: "5" + + - name: ubuntu-18.04-gcc-6 + os: ubuntu-18.04 + compiler: gcc + version: "6" + + - name: ubuntu-18.04-gcc-7 + os: ubuntu-18.04 + compiler: gcc + version: "7" + + - name: ubuntu-18.04-gcc-8 + os: ubuntu-18.04 + compiler: gcc + version: "8" + + - name: ubuntu-18.04-gcc-9 + os: ubuntu-18.04 + compiler: gcc + version: "9" + + - name: ubuntu-18.04-clang-3.5 + os: ubuntu-18.04 + compiler: clang + version: "3.5" + + - name: ubuntu-18.04-clang-3.6 + os: ubuntu-18.04 + compiler: clang + version: "3.6" + + - name: ubuntu-18.04-clang-3.7 + os: ubuntu-18.04 + compiler: clang + version: "3.7" + + - name: ubuntu-18.04-clang-3.8 + os: ubuntu-18.04 + compiler: clang + version: "3.8" + + - name: ubuntu-18.04-clang-3.9 + os: ubuntu-18.04 + compiler: clang + version: "3.9" + + - name: ubuntu-18.04-clang-4.0 + os: ubuntu-18.04 + compiler: clang + version: "4.0" + + - name: ubuntu-18.04-clang-5.0 + os: ubuntu-18.04 + compiler: clang + version: "5.0" + + - name: ubuntu-18.04-clang-6.0 + os: ubuntu-18.04 + compiler: clang + version: "6.0" + + - name: ubuntu-18.04-clang-7 + os: ubuntu-18.04 + compiler: clang + version: "7" + + - name: ubuntu-18.04-clang-8 + os: ubuntu-18.04 + compiler: clang + version: "8" + + - name: ubuntu-18.04-clang-9 + os: ubuntu-18.04 + compiler: clang + version: "9" + + - name: windows-2016-cl + os: windows-2016 + compiler: cl + + - name: windows-2016-clang-cl + os: windows-2016 + compiler: clang-cl + + - name: windows-2016-clang + os: windows-2016 + compiler: clang + + - name: windows-2019-cl + os: windows-2019 + compiler: cl + + - name: windows-2016-gcc + os: windows-2016 + compiler: gcc + + - name: windows-2019-clang-cl + os: windows-2019 + compiler: clang-cl + + - name: windows-2019-clang + os: windows-2019 + compiler: clang + + - name: windows-2019-gcc + os: windows-2019 + compiler: gcc + + - name: macOS-10.14-xcode-9.4.1 + os: macOS-10.14 + compiler: xcode + version: "9.4.1" + + - name: macOS-10.14-xcode-10.0 + os: macOS-10.14 + compiler: xcode + version: "10" + + - name: macOS-10.14-xcode-10.1 + os: macOS-10.14 + compiler: xcode + version: "10.1" + + - name: macOS-10.14-Xcode-10.2 + os: macOS-10.14 + compiler: xcode + version: "10.2" + + - name: macOS-10.14-xcode-10.2.1 + os: macOS-10.14 + compiler: xcode + version: "10.2.1" + + - name: macOS-10.14-xcode-10.3 + os: macOS-10.14 + compiler: xcode + version: "10.3" + + - name: macOS-10.14-gcc-7 + os: macOS-10.14 + compiler: gcc + version: "7" + + - name: macOS-10.14-gcc-8 + os: macOS-10.14 + compiler: gcc + version: "8" + + - name: macOS-10.14-gcc-9 + os: macOS-10.14 + compiler: gcc + version: "9" + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v1 - #- name: Install Dependencies - # env: - # dependency_packages: build-essential g++-5 - # run: sudo apt-get update && sudo apt-get -y install ${dependency_packages} + - name: Install (Linux) + if: runner.os == 'Linux' + run: | + # CMake 3.15 allows specifying the generator using the CMAKE_GENERATOR + # environment variable. + curl -sSL https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-Linux-x86_64.tar.gz -o cmake.tar.gz + sudo tar xf cmake.tar.gz --strip 1 -C /usr/local + # Required for libc6-dbg:i386 and g++-multilib packages which are + # needed for x86 builds. + sudo dpkg --add-architecture i386 + # clang-3.7 and earlier are not available in Bionic anymore so we get + # them from the Xenial repositories instead. + sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main" + sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe" + + # LLVM 9 is not in Bionic's repositories so we add the official LLVM repository. + if [ "${{ matrix.compiler }}" = "clang" ] && [ "${{ matrix.version }}" = "9" ]; then + sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" + fi + sudo apt-get update + # libc6-dbg:i386 is required for running valgrind on x86. + sudo apt-get install -y ninja-build valgrind libc6-dbg:i386 + if [ "${{ matrix.compiler }}" = "gcc" ]; then + sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo apt-get install -y clang-${{ matrix.version }} g++-multilib + echo "::set-env name=CC::clang-${{ matrix.version }}" + echo "::set-env name=CXX::clang++-${{ matrix.version }}" + fi + + - name: Install (macOS) + if: runner.os == 'macOS' + run: | + brew install cmake ninja + if [ "${{ matrix.compiler }}" = "gcc" ]; then + brew install gcc@${{ matrix.version }} + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app + echo "::set-env name=CC::clang" + echo "::set-env name=CXX::clang++" + fi + + - name: Install (Windows) + if: runner.os == 'Windows' + shell: powershell + run: | + Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') + scoop install ninja --global + if ("${{ matrix.compiler }}".StartsWith("clang")) { + scoop install llvm --global + } + if ("${{ matrix.compiler }}" -eq "gcc") { + # Chocolatey GCC is broken on the windows-2019 image. + # See: https://github.com/DaanDeMeyer/doctest/runs/231595515 + # See: https://github.community/t5/GitHub-Actions/Something-is-wrong-with-the-chocolatey-installed-version-of-gcc/td-p/32413 + scoop install gcc --global + echo "::set-env name=CC::gcc" + echo "::set-env name=CXX::g++" + } elseif ("${{ matrix.compiler }}" -eq "clang") { + echo "::set-env name=CC::clang" + echo "::set-env name=CXX::clang++" + } else { + echo "::set-env name=CC::${{ matrix.compiler }}" + echo "::set-env name=CXX::${{ matrix.compiler }}" + } + # Scoop modifies the PATH so we make the modified PATH global. + echo "::set-env name=PATH::$env:PATH" + + - name: Configure + if: runner.os == 'Windows' + run: .github\workflows\vsenv.bat -arch=x64 -host_arch=x64 - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/inja/build - - - name: Build - working-directory: ${{runner.workspace}}/inja/build - shell: bash - run: | - cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE - cmake --build . --config $BUILD_TYPE -j4 - - - name: Test - working-directory: ${{runner.workspace}}/inja/build - shell: bash - run: | - ctest -C $BUILD_TYPE -V + - name: Build & Test Debug + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug + cmake --build build -j2 + cd build && ctest -j2 --output-on-failure + + - name: Build & Test Release + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Release + cmake --build build -j2 + cd build && ctest -j2 --output-on-failure diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 77c994e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,85 +0,0 @@ -language: cpp -dist: trusty -sudo: required - -matrix: - include: - - os: linux - compiler: gcc - env: COMPILER=g++-5 - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: g++-5 - - - os: linux - compiler: gcc - env: COMPILER=g++-6 - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: g++-6 - - - os: linux - compiler: gcc - env: - - COMPILER=g++-7 - - DOCS="true" - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-7 - - - os: linux - compiler: gcc - env: - - COMPILER=g++-8 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-8 - - - os: linux - compiler: gcc - env: - - COMPILER=g++-8 - - CXXFLAGS=-std=c++17 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-8 - - - os: linux - compiler: clang - env: COMPILER=clang++-5.0 - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0'] - packages: ['clang-5.0', 'libstdc++-7-dev'] - - - os: linux - compiler: clang - env: COMPILER=clang++-6.0 - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-6.0'] - packages: ['clang-6.0', 'libstdc++-7-dev'] - - - os: osx - osx_image: xcode9 - - - os: osx - osx_image: xcode10 - - -script: - - if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi - - uname -a - - $CXX --version - - - mkdir -p build - - cd build - - cmake -DCMAKE_BUILD_TYPE=Release .. - - cmake --build . -- VERBOSE=1 -j4 - - ctest -V - - cd .. diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100755 index 33ace31..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,43 +0,0 @@ -version: '{build}' - -image: - - Visual Studio 2019 - -platform: - - Win32 - - x64 - -configuration: - - Debug - - Release - -environment: - matrix: - # Visual Studio 2015 - - TOOLCHAIN: v140 - STD: 14 - # Visual Studio 2017 - - TOOLCHAIN: v141 - STD: 14 - - TOOLCHAIN: v141 - STD: 17 - # Visual Studio 2019 - - TOOLCHAIN: v142 - STD: 14 - - TOOLCHAIN: v142 - STD: 17 - -init: - - cmake --version - - msbuild /version - -before_build: - - mkdir -p build - - cd build - - cmake .. -A %PLATFORM% -T %TOOLCHAIN% -DCMAKE_CXX_STANDARD=%STD% - -build_script: - - cmake --build . --config %CONFIGURATION% -- -verbosity:n - -test_script: - - ctest -C %CONFIGURATION% -V -j