Skip to content

Merge pull request #222 from LibRapid/test #392

Merge pull request #222 from LibRapid/test

Merge pull request #222 from LibRapid/test #392

name: Continuous Integration
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
workflow_dispatch:
jobs:
compile:
name: Compile on ${{ matrix.os }} with ${{ matrix.cxx }} (BLAS ${{ matrix.blas }}, FFTW ${{ matrix.fftw }}, MPFR ${{ matrix.mpfr }}, C++ ${{ matrix.cpp }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cc: ../llvm/bin/clang
cxx: ../llvm/bin/clang++
blas: off
fftw: off
mpfr: on
cpp: 17
pretty: "LibRapid_Ubuntu_Clang_C++17_MPFR"
- os: ubuntu-latest
cc: ../llvm/bin/clang
cxx: ../llvm/bin/clang++
blas: on
fftw: on
mpfr: on
cpp: 17
pretty: "LibRapid_Ubuntu_Clang_C++17_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-9
cxx: g++-9
blas: off
fftw: off
mpfr: on
cpp: 17
pretty: "LibRapid_Ubuntu_Clang_C++17_MPFR"
- os: ubuntu-latest
cc: gcc-9
cxx: g++-9
blas: on
fftw: on
mpfr: on
cpp: 17
pretty: "LibRapid_Ubuntu_Clang_C++17_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-9
cxx: g++-9
blas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_MPFR"
- os: ubuntu-latest
cc: gcc-9
cxx: g++-9
blas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-10
cxx: g++-10
blas: off
fftw: off
mpfr: on
cpp: 17
pretty: "LibRapid_Ubuntu_Clang_C++17_MPFR"
- os: ubuntu-latest
cc: gcc-10
cxx: g++-10
blas: on
fftw: on
mpfr: on
cpp: 17
pretty: "LibRapid_Ubuntu_Clang_C++17_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-10
cxx: g++-10
blas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_MPFR"
- os: ubuntu-latest
cc: gcc-10
cxx: g++-10
blas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
blas: off
fftw: off
mpfr: on
cpp: 17
pretty: "LibRapid_Ubuntu_Clang_C++17_MPFR"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
blas: on
fftw: on
mpfr: on
cpp: 17
pretty: "LibRapid_Ubuntu_Clang_C++17_BLAS_FFTW_MPFR"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
blas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_MPFR"
- os: ubuntu-latest
cc: gcc-11
cxx: g++-11
blas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Ubuntu_Clang_C++20_BLAS_FFTW_MPFR"
- os: macos-latest
cc: ../llvm/bin/clang
cxx: ../llvm/bin/clang++
blas: off
fftw: off
mpfr: on
cpp: 17
pretty: "LibRapid_MacOS_Clang++_C++17_MPFR"
- os: macos-latest
cc: ../llvm/bin/clang
cxx: ../llvm/bin/clang++
blas: on
fftw: on
mpfr: on
cpp: 17
pretty: "LibRapid_MacOS_Clang++_C++17_BLAS_FFTW_MPFR"
- os: macos-latest
cc: gcc-11
cxx: g++-11
blas: off
fftw: off
mpfr: on
cpp: 17
pretty: "LibRapid_MacOS_GCC-11_C++17_MPFR"
- os: macos-latest
cc: gcc-11
cxx: g++-11
blas: on
fftw: on
mpfr: on
cpp: 17
pretty: "LibRapid_MacOS_GCC-11_C++17_BLAS_FFTW_MPFR"
- os: macos-latest
cc: gcc-11
cxx: g++-11
blas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_MacOS_GCC-11_C++20_MPFR"
- os: macos-latest
cc: gcc-11
cxx: g++-11
blas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_MacOS_GCC-11_C++20_BLAS_FFTW_MPFR"
- os: windows-latest
cc: ../llvm/clang
cxx: ../llvm/clang++
blas: off
fftw: off
mpfr: on
cpp: 17
pretty: "LibRapid_Windows_Clang_C++17_MPFR"
- os: windows-latest
cc: ../llvm/clang
cxx: ../llvm/clang++
blas: on
fftw: on
mpfr: on
cpp: 17
pretty: "LibRapid_Windows_Clang_C++17_BLAS_FFTW_MPFR"
- os: windows-latest
cc: ./llvm/clang
cxx: ./llvm/clang++
blas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Windows_Clang_C++20_MPFR"
- os: windows-latest
cc: ./llvm/clang
cxx: ./llvm/clang++
blas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Windows_Clang_C++20_BLAS_FFTW_MPFR"
- os: windows-latest
cc: msvc
cxx: msvc
blas: off
fftw: off
mpfr: on
cpp: 17
pretty: "LibRapid_Windows-Latest_MSVC_C++17"
- os: windows-latest
cc: msvc
cxx: msvc
blas: on
fftw: on
mpfr: on
cpp: 17
pretty: "LibRapid_Windows-Latest_MSVC_C++17"
- os: windows-latest
cc: msvc
cxx: msvc
blas: off
fftw: off
mpfr: on
cpp: 20
pretty: "LibRapid_Windows-Latest_MSVC_C++20"
- os: windows-latest
cc: msvc
cxx: msvc
blas: on
fftw: on
mpfr: on
cpp: 20
pretty: "LibRapid_Windows-Latest_MSVC_C++20"
steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "15.0"
directory: "./llvm"
env: on
- name: Install XCode
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/[email protected]
# Tests must pass in both debug and release mode
- name: Compile (Debug)
run: |
mkdir buildDebug
cd buildDebug
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=${{ matrix.cpp }} -DLIBRAPID_BUILD_EXAMPLES=on -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_GET_BLAS=${{ matrix.blas }} -DLIBRAPID_USE_MULTIPREC=${{ matrix.mpfr }}
cmake --build . --config Debug
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
- name: Run Tests (Debug)
run: |
cd buildDebug
ctest -C Debug --output-on-failure
- name: Compile (Release)
run: |
mkdir buildRelease
cd buildRelease
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{ matrix.cpp }} -DLIBRAPID_BUILD_EXAMPLES=on -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_GET_BLAS=${{ matrix.blas }} -DLIBRAPID_USE_MULTIPREC=${{ matrix.mpfr }}
cmake --build . --config Release
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
- name: Run Tests (Release)
run: |
cd buildRelease
ctest -C Release --output-on-failure
# - name: Store Debug Build
# uses: actions/upload-artifact@v3
# with:
# name: ${{ matrix.pretty }}_Debug
# path: buildDebug
# - name: Store Release Build
# uses: actions/upload-artifact@v3
# with:
# name: ${{ matrix.pretty }}_Release
# path: buildRelease
# Zip debug build before uploading
# - name: Zip build results before uploading
# uses: vimtor/[email protected]
# continue-on-error: true
# with:
# files: ./buildDebug ./buildRelease
# recursive: true
# dest: ${{ matrix.pretty }}.zip
# - name: Store Build Artifacts
# uses: actions/upload-artifact@v3
# continue-on-error: true
# with:
# name: ${{ matrix.pretty }}
# path: ${{ matrix.pretty }}.zip
quodona:
name: Run Qodana
needs: compile
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
with:
submodules: recursive
# - name: Qodana Scan
# uses: JetBrains/qodana-action@main
# env:
# QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
build-docs:
name: Build Documentation Locally
needs: [ compile ]
runs-on: ubuntu-latest
steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
with:
submodules: recursive
- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Build Doxygen
id: build_doxygen
continue-on-error: true
run: |
git clone --recursive https://github.com/doxygen/doxygen.git
cd doxygen
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"
cmake --build . --config Release
sudo make install
env:
CC: gcc
CXX: g++
- name: Install Doxygen on Error
if: steps.build_doxygen.outcome != 'success'
run: |
sudo apt install doxygen
- name: Upgrade Source Distribution
continue-on-error: true
run: |
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
- name: Install LaTeX
continue-on-error: true
run: |
sudo apt-get install -y texlive-full
- name: Install Requirements
continue-on-error: true
run: |
cd docs
pip install -r requirements.txt
- name: Force install Sphinx Build
run: |
sudo apt-get install python3-sphinx
- name: Configure Files
run: |
touch .is_local
- name: Build HTML Documentation
run: |
cd docs
make html
- name: Build PDf Documentation
# continue-on-error: true
run: |
cd docs
make latexpdf
- name: Store Artifacts
uses: actions/upload-artifact@v3
with:
name: Documentation
path: docs/build/**
run-benchmarks:
name: Run Benchmarks
needs: [ compile ]
runs-on: ubuntu-latest
steps:
- name: Create a Test File
run: |
mkdir BENCH_RESULTS
touch BENCH_RESULTS/hello.txt
echo "Hello, World!" > BENCH_RESULTS/hello.txt
- name: Upload Benchmark Results
uses: actions/upload-artifact@v3
with:
name: benchmark-results-for-${{ github.sha }}
path: BENCH_RESULTS/
code-coverage:
name: Code Coverage
needs: [ compile ]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
with:
submodules: recursive
- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install Coverage Tools
run: |
sudo apt install lcov
sudo apt install gcovr
- name: Compile and Run
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLIBRAPID_CODE_COV=on -DLIBRAPID_BUILD_EXAMPLES=on -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_GET_BLAS=ON -DLIBRAPID_GET_FFTW=on -DLIBRAPID_USE_MULTIPREC=on
cmake --build .
env:
CC: gcc-11
CXX: g++-11
- name: Run Tests
run: |
cd build
ctest -C Debug --output-on-failure
- name: Upload Coverage Reports
uses: codecov/codecov-action@v3
trigger-docs:
name: Trigger Documentation Build
needs: [ run-benchmarks, quodona, build-docs ]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- name: Checkout LibRapid
uses: actions/checkout@v3
with:
submodules: recursive
- name: Trigger RTDs build
uses: dfm/rtds-action@v1
with:
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }}
commit_ref: ${{ github.ref }}
success:
name: Success
needs: [ trigger-docs ]
runs-on: ubuntu-latest
steps:
- name: Print Success
run: |
echo "Success!"