Merge pull request #92 from auto-differentiation/feature/std-complex-… #399
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: CI | |
on: [push, pull_request] | |
jobs: | |
build_and_test_windows: | |
name: Windows | |
strategy: | |
fail-fast: false | |
matrix: | |
toolset: ["14.0", "14.1", "14.2", "14.3"] | |
compiler: [msvc, clang] | |
config: [Release, Debug] | |
include: | |
- config: Debug | |
sccache: "false" | |
cmake_extra: "" | |
- config: Release | |
sccache: "true" | |
cmake_extra: -DCMAKE_CXX_COMPILER_LAUNCHER=sccache | |
- compiler: clang | |
cxx: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe | |
cc: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe | |
os: windows-2022 | |
# disable cache in Windows with Clang, as it fails compilation with latest compilers | |
sccache: "false" | |
cmake_extra: "" | |
vsvarsall: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat | |
- compiler: msvc | |
cxx: cl | |
cc: cl | |
os: windows-2022 | |
vsvarsall: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat | |
- toolset: "14.0" | |
compiler: msvc | |
os: windows-2019 | |
vsvarsall: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat | |
exclude: | |
- compiler: clang | |
toolset: "14.1" | |
- compiler: clang | |
toolset: "14.2" | |
- compiler: clang | |
toolset: "14.0" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup | |
run: | | |
choco install -y ninja sccache | |
- name: ccache | |
if: ${{ matrix.sccache == 'true' }} | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: windows-${{ matrix.compiler }}-${{ matrix.toolset }}-${{ matrix.config }} | |
variant: sccache | |
- name: configure | |
shell: cmd | |
run: | | |
mkdir build | |
cd build | |
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }} | |
cmake .. -GNinja ^ | |
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" ^ | |
-DCMAKE_CXX_COMPILER="${{ matrix.cxx }}" ^ | |
-DCMAKE_C_COMPILER="${{ matrix.cc }}" ^ | |
${{ matrix.cmake_extra }} ^ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} | |
- name: build | |
shell: cmd | |
run: | | |
cd build | |
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }} | |
cmake --build . | |
- name: test | |
shell: cmd | |
run: | | |
cd build | |
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }} | |
ctest --no-compress-output --output-on-failure -j3 --output-junit test_results.xml | |
- name: upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Results (windows ${{ matrix.compiler }}-${{ matrix.toolset }}-${{ matrix.config }}) | |
path: build/test_results.xml | |
- name: install | |
shell: cmd | |
run: | | |
cd build | |
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }} | |
cmake --install . | |
- name: install test | |
shell: cmd | |
run: | | |
mkdir installtest | |
cd installtest | |
call "${{ matrix.vsvarsall }}" amd64 -vcvars_ver=${{ matrix.toolset }} | |
cmake ..\\samples -GNinja ^ | |
-DCMAKE_CXX_COMPILER="${{ matrix.cxx }}" ^ | |
-DCMAKE_C_COMPILER="${{ matrix.cc }}" ^ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} ^ | |
${{ matrix.cmake_extra }} ^ | |
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" | |
cmake --build . | |
build_and_test_clang: | |
name: Linux/Clang | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- clang-11 | |
- clang-12 | |
- clang-13 | |
- clang-14 | |
- clang-15 | |
config: [Release, Debug] | |
reuse_slots: [OFF, ON] | |
include: | |
- compiler: clang-11 | |
cxx: clang++-11 | |
cc: clang-11 | |
os: ubuntu-20.04 | |
- compiler: clang-12 | |
cxx: clang++-12 | |
cc: clang-12 | |
os: ubuntu-22.04 | |
- compiler: clang-13 | |
cxx: clang++-13 | |
cc: clang-13 | |
os: ubuntu-22.04 | |
- compiler: clang-14 | |
cxx: clang++-14 | |
cc: clang-14 | |
os: ubuntu-22.04 | |
- compiler: clang-15 | |
cxx: clang++-15 | |
cc: clang-15 | |
os: ubuntu-22.04 | |
exclude: | |
- config: Debug | |
reuse_slots: ON | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ccache ninja-build ${{ matrix.compiler }} | |
- name: Setup cmake | |
uses: jwlawson/[email protected] | |
with: | |
github-api-token: ${{ secrets.CMAKE_TOKEN }} | |
- name: ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: linux-${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }} | |
- name: configure | |
run: | | |
mkdir build | |
cd build | |
cmake .. -GNinja \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.cc }} \ | |
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install | |
- name: build | |
run: | | |
cd build | |
cmake --build . | |
- name: test | |
run: | | |
cd build | |
ctest --no-compress-output --output-on-failure --parallel $(($(nproc) + 2)) --output-junit test_results.xml | |
- name: upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Results (linux ${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}) | |
path: build/test_results.xml | |
- name: install | |
run: | | |
cd build | |
cmake --install . | |
- name: install test | |
run: | | |
mkdir installtest | |
cd installtest | |
cmake ../samples -GNinja \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.cc }} | |
cmake --build . | |
build_and_test_gcc: | |
name: Linux/Gcc | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- gcc5 | |
- gcc6 | |
- gcc7 | |
- gcc8 | |
- gcc9 | |
- gcc10 | |
- gcc11 | |
config: [Release, Debug] | |
reuse_slots: [OFF, ON] | |
exclude: | |
- config: Debug | |
reuse_slots: ON | |
include: | |
- config: Debug | |
compiler: gcc11 | |
coverage: true | |
coverage_cxx_flags: "-fprofile-arcs -ftest-coverage" | |
coverage_ld_flags: "-lgcov" | |
- compiler: gcc11 | |
config: Debug # also with reusing slots, for coverage | |
reuse_slots: ON | |
coverage: true | |
coverage_cxx_flags: "-fprofile-arcs -ftest-coverage" | |
coverage_ld_flags: "-lgcov" | |
runs-on: ubuntu-latest | |
container: | |
image: conanio/${{ matrix.compiler }} | |
options: --user root | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup tools | |
run: | | |
cat /etc/lsb-release | |
/lib/x86_64-linux-gnu/libc.so.6 | |
sudo apt-get update | |
sudo apt-get install -y ccache ninja-build lcov | |
- name: GitHub WS Tmp | |
# there is an issue with workspace locations in github inside containers, which this works around | |
# see: https://github.com/actions/runner/issues/2058 | |
run: | | |
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" >> $GITHUB_ENV | |
- name: Setup cmake | |
uses: jwlawson/[email protected] | |
with: | |
github-api-token: ${{ secrets.CMAKE_TOKEN }} | |
- name: ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: linux-${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }} | |
- name: configure | |
run: | | |
mkdir build | |
cd build | |
cmake .. -GNinja \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.cc }} \ | |
-DCMAKE_CXX_FLAGS="${{ matrix.coverage_cxx_flags }}" \ | |
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.coverage_ld_flags }}" \ | |
-DCMAKE_INSTALL_PREFIX=${{ env.GITHUB_WORKSPACE }}/install | |
- name: build | |
run: | | |
cd build | |
cmake --build . | |
- name: coverage baseline | |
if: ${{ matrix.coverage }} | |
run: | | |
cd build | |
mkdir coverage tmp | |
lcov --no-external --capture --initial --directory ${{ env.GITHUB_WORKSPACE }} --output-file ./tmp/lcov_base.info | |
- name: test | |
run: | | |
cd build | |
ctest --no-compress-output --output-on-failure --parallel $(($(nproc) + 2)) --output-junit test_results.xml | |
- name: upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Results (linux ${{ matrix.compiler }}-${{ matrix.config }}-${{ matrix.reuse_slots }}) | |
path: ${{ env.GITHUB_WORKSPACE }}/build/test_results.xml | |
- name: coverage tests | |
if: ${{ matrix.coverage }} | |
run: | | |
cd build | |
lcov --no-external --capture --directory ${{ env.GITHUB_WORKSPACE }} --output-file ./tmp/lcov_run.info | |
lcov --add-tracefile ./tmp/lcov_base.info --add-tracefile ./tmp/lcov_run.info --output-file ./tmp/lcov_total.info | |
lcov --remove ./tmp/lcov_total.info "$PWD/*" "${{ env.GITHUB_WORKSPACE }}/test/*" "${{ env.GITHUB_WORKSPACE }}/samples/*" --output-file ./coverage/lcov.info | |
- name: upload coverage results | |
if: ${{ matrix.coverage }} | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
flag-name: linux-${{ matrix.compiler }}-${{ matrix.reuse_slots }} | |
path-to-lcov: ${{env.GITHUB_WORKSPACE }}/build/coverage/lcov.info | |
parallel: true | |
- name: install | |
run: | | |
cd build | |
cmake --install . | |
- name: install test | |
if: ${{ ! matrix.coverage }} | |
run: | | |
mkdir installtest | |
cd installtest | |
cmake ../samples -GNinja \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_PREFIX_PATH="${{ env.GITHUB_WORKSPACE }}/install" \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.cc }} \ | |
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.coverage_ld_flags }}" | |
cmake --build . | |
build_and_test_macos: | |
name: Mac | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: [Release, Debug] | |
include: | |
- config: Debug | |
coverage: true | |
coverage_cxx_flags: "-fprofile-arcs -ftest-coverage" | |
coverage_ld_flags: "-ftest-coverage" | |
- config: Release | |
coverage: false | |
steps: | |
- name: setup | |
run: | | |
brew install ninja | |
brew install ccache | |
- name: setup coverage | |
if: ${{ matrix.coverage }} | |
run: | | |
brew install lcov | |
- uses: actions/checkout@v3 | |
- name: ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: macos-${{ matrix.config }} | |
- name: configure | |
run: | | |
mkdir build | |
cd build | |
cmake .. -GNinja \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \ | |
-DCMAKE_CXX_FLAGS="${{ matrix.coverage_cxx_flags }}" \ | |
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.coverage_ld_flags }}" \ | |
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install | |
- name: build | |
run: | | |
cd build | |
cmake --build . | |
- name: coverage baseline | |
if: ${{ matrix.coverage }} | |
run: | | |
cd build | |
mkdir coverage tmp | |
lcov --no-external --keep-going --capture --initial --directory ${{ github.workspace }} --output-file ./tmp/lcov_base.info | |
- name: test | |
run: | | |
cd build | |
ctest --no-compress-output --output-on-failure -j3 --output-junit test_results.xml | |
- name: upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Results (macos ${{ matrix.config }}) | |
path: build/test_results.xml | |
- name: coverage tests | |
if: ${{ matrix.coverage }} | |
run: | | |
cd build | |
lcov --no-external --keep-going --capture --directory ${{ github.workspace }} --output-file ./tmp/lcov_run.info | |
lcov --add-tracefile ./tmp/lcov_base.info --add-tracefile ./tmp/lcov_run.info --ignore-errors inconsistent --output-file ./tmp/lcov_total.info | |
lcov --remove ./tmp/lcov_total.info "$PWD/*" "${{ github.workspace }}/test/*" "${{ github.workspace }}/samples/*" --ignore-errors inconsistent --output-file ./coverage/lcov.info | |
- name: upload coverage results | |
if: ${{ matrix.coverage }} | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
flag-name: macos | |
path-to-lcov: build/coverage/lcov.info | |
parallel: true | |
- name: install | |
run: | | |
cd build | |
cmake --install . | |
- name: install test | |
if: ${{ ! matrix.coverage }} | |
run: | | |
mkdir installtest | |
cd installtest | |
cmake ../samples -GNinja \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.coverage_ld_flags }}" \ | |
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" | |
cmake --build . | |
coverage_finish: | |
name: Coverage Collect | |
needs: [ build_and_test_gcc, build_and_test_macos] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true | |
- name: Rerun coverage workaround | |
# from https://github.com/lemurheavy/coveralls-public/issues/1653#issuecomment-1251587119 | |
run: | | |
curl --location --request GET 'https://coveralls.io/rerun_build?repo_token=${{ secrets.COVERALLS_REPO_TOKEN }}&build_num=${{ github.run_id }}' | |
event_file: | |
name: Event File | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} | |