[CI] enable runtime checks, test with Valgrind #271
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: Linux Binaries | |
on: | |
push: | |
tags-ignore: | |
- '**' | |
branches: | |
- '**' | |
release: | |
types: ['released', 'prereleased'] | |
env: | |
PYTHON_VERSION: '3.11' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: ubuntu:jammy | |
strategy: | |
matrix: | |
host: [x86_64-centos7-linux-gnu, aarch64-rpi3-linux-gnu] | |
env: | |
CMAKE_C_COMPILER_LAUNCHER: ccache | |
CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
CCACHE_DIR: /root/.ccache | |
steps: | |
# Git clone | |
- name: Install git | |
run: apt -y update && apt -y install --no-install-recommends git ca-certificates | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# Tools | |
- name: Install tools | |
uses: ./.github/workflows/toolchain | |
with: | |
host: ${{ matrix.host }} | |
python-version: ${{ env.PYTHON_VERSION }} | |
# Ccache | |
- name: Prepare ccache directory | |
run: mkdir -p "${{ env.CCACHE_DIR }}" | |
- name: Cache ccache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ runner.os }}-linux-bin-${{ matrix.host }}-ccache-${{ github.run_id }} | |
restore-keys: ${{ runner.os }}-linux-bin-${{ matrix.host }}-ccache | |
# Configure | |
- name: Configure | |
run: | | |
host="${{ matrix.host }}" | |
staging="/opt/$host" | |
case $host in | |
aarch64*) quadmath=Off ;; | |
*) quadmath=On ;; | |
esac | |
cmake -B package -S. \ | |
-G "Ninja Multi-Config" \ | |
-D BUILD_SHARED_LIBS=On \ | |
-D CMAKE_POSITION_INDEPENDENT_CODE=On \ | |
-D ALPAQA_WITH_EXAMPLES=Off \ | |
-D ALPAQA_WITH_TESTS=Off \ | |
-D ALPAQA_WARNINGS_AS_ERRORS=On \ | |
-D ALPAQA_WITH_QUAD_PRECISION=$quadmath \ | |
-D ALPAQA_WITH_CASADI=On \ | |
-D CMAKE_TOOLCHAIN_FILE="$staging/cmake/$host.toolchain.cmake" \ | |
-D CMAKE_PREFIX_PATH="$staging/mumps/usr/local;$staging/ipopt/usr/local" \ | |
-D CMAKE_FIND_ROOT_PATH="$staging/eigen;$staging/casadi;$staging/openblas;$staging/mumps;$staging/ipopt" | |
env: | |
CXXFLAGS: '-static-libstdc++' | |
# Build | |
- name: Build RelWithDebInfo | |
run: | | |
cmake --build package --config RelWithDebInfo -j | |
- name: Build Debug | |
run: | | |
cmake --build package --config Debug -j | |
# Package | |
- name: Package | |
run: | | |
cpack -G 'TGZ;DEB' -C "RelWithDebInfo;Debug" | |
working-directory: package | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: alpaqa-${{ matrix.host }} | |
retention-days: 1 | |
path: | | |
package/alpaqa*.tar.gz | |
package/*alpaqa*.deb | |
test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
container: ubuntu:jammy | |
strategy: | |
matrix: | |
host: [x86_64-centos7-linux-gnu] | |
steps: | |
# Git clone | |
- name: Install git | |
run: > | |
apt -y update && apt -y install --no-install-recommends | |
git ca-certificates g++ gfortran cmake ninja-build pkg-config | |
python3-pip libeigen3-dev libgtest-dev libgmock-dev | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Download | |
uses: actions/download-artifact@v3 | |
with: | |
name: alpaqa-${{ matrix.host }} | |
path: package | |
- name: Install | |
run: apt install -y ./package/*alpaqa*.deb | |
- name: Build examples (RelWithDebInfo) | |
run: | | |
cmake -B build-examples -S examples \ | |
-G "Ninja Multi-Config" | |
cmake --build build-examples -j --config RelWithDebInfo | |
- name: Build tests (RelWithDebInfo) | |
run: | | |
cmake -B build-tests -S test \ | |
-G "Ninja Multi-Config" | |
cmake --build build-tests -j --config RelWithDebInfo | |
- name: Upload (RelWithDebInfo) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: alpaqa-${{ matrix.host }}-test-examples-release | |
retention-days: 1 | |
path: | | |
build-examples/C++/CustomCppProblem/RelWithDebInfo/custom-cpp-problem-example | |
build-examples/C++/SimpleUnconstrProblem/RelWithDebInfo/simple-unconstr-cpp-problem-example | |
build-examples/C++/CustomControlCppProblem/RelWithDebInfo/custom-control-cpp-problem-example | |
build-examples/C++/FortranProblem/RelWithDebInfo/fortran-problem-example | |
build-examples/C++/DLProblem/RelWithDebInfo/dl-problem-example | |
build-examples/C++/DLProblem/RelWithDebInfo/test-matmul | |
build-tests/RelWithDebInfo/tests | |
build-tests/RelWithDebInfo/librosenbrock_functions_test.so | |
- name: Build examples (Debug) | |
run: | | |
cmake --build build-examples -j --config Debug | |
- name: Build tests (Debug) | |
run: | | |
cmake --build build-tests -j --config Debug | |
- name: Upload (Debug) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: alpaqa-${{ matrix.host }}-test-examples-debug | |
retention-days: 1 | |
path: | | |
build-examples/C++/CustomCppProblem/Debug/custom-cpp-problem-example | |
build-examples/C++/SimpleUnconstrProblem/Debug/simple-unconstr-cpp-problem-example | |
build-examples/C++/CustomControlCppProblem/Debug/custom-control-cpp-problem-example | |
build-examples/C++/FortranProblem/Debug/fortran-problem-example | |
build-examples/C++/DLProblem/Debug/dl-problem-example | |
build-examples/C++/DLProblem/Debug/test-matmul | |
build-tests/Debug/tests | |
build-tests/Debug/librosenbrock_functions_test.so | |
- name: Run examples (RelWithDebInfo) | |
run: | | |
./build-examples/C++/CustomCppProblem/RelWithDebInfo/custom-cpp-problem-example | |
./build-examples/C++/SimpleUnconstrProblem/RelWithDebInfo/simple-unconstr-cpp-problem-example | |
./build-examples/C++/CustomControlCppProblem/RelWithDebInfo/custom-control-cpp-problem-example | |
./build-examples/C++/FortranProblem/RelWithDebInfo/fortran-problem-example | |
./build-examples/C++/DLProblem/RelWithDebInfo/dl-problem-example | |
./build-examples/C++/DLProblem/RelWithDebInfo/test-matmul | |
- name: Run examples (Debug) | |
run: | | |
./build-examples/C++/CustomCppProblem/Debug/custom-cpp-problem-example | |
./build-examples/C++/SimpleUnconstrProblem/Debug/simple-unconstr-cpp-problem-example | |
./build-examples/C++/CustomControlCppProblem/Debug/custom-control-cpp-problem-example | |
./build-examples/C++/FortranProblem/Debug/fortran-problem-example | |
./build-examples/C++/DLProblem/Debug/dl-problem-example | |
./build-examples/C++/DLProblem/Debug/test-matmul | |
- name: Run tests (RelWithDebInfo) | |
run: | | |
./build-tests/RelWithDebInfo/tests | |
cmake --build build-tests -t test --config RelWithDebInfo | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
- name: Run tests (Debug) | |
run: | | |
./build-tests/Debug/tests | |
cmake --build build-tests -t test --config Debug | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
- name: Install Valgrind | |
run: | | |
apt update | |
apt install -y valgrind --no-install-recommends | |
- name: Run examples (Valgrind, RelWithDebInfo) | |
run: | | |
valgrind --gen-suppressions=all ./build-examples/C++/CustomCppProblem/RelWithDebInfo/custom-cpp-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/SimpleUnconstrProblem/RelWithDebInfo/simple-unconstr-cpp-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/CustomControlCppProblem/RelWithDebInfo/custom-control-cpp-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/FortranProblem/RelWithDebInfo/fortran-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/DLProblem/RelWithDebInfo/dl-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/DLProblem/RelWithDebInfo/test-matmul | |
- name: Run examples (Valgrind, Debug) | |
run: | | |
valgrind --gen-suppressions=all ./build-examples/C++/CustomCppProblem/Debug/custom-cpp-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/SimpleUnconstrProblem/Debug/simple-unconstr-cpp-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/CustomControlCppProblem/Debug/custom-control-cpp-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/FortranProblem/Debug/fortran-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/DLProblem/Debug/dl-problem-example | |
valgrind --gen-suppressions=all ./build-examples/C++/DLProblem/Debug/test-matmul | |
- name: Run tests (Valgrind, RelWithDebInfo) | |
run: | | |
valgrind --gen-suppressions=all ./build-tests/RelWithDebInfo/tests | |
- name: Run tests (Valgrind, Debug) | |
run: | | |
valgrind --gen-suppressions=all ./build-tests/Debug/tests | |
test-deb: | |
needs: [build] | |
runs-on: ubuntu-latest | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
host: [x86_64-centos7-linux-gnu] | |
container: | |
- 'debian:bullseye' | |
- 'debian:bookworm' | |
- 'debian:sid' | |
- 'ubuntu:focal' | |
- 'ubuntu:jammy' | |
- 'ubuntu:rolling' | |
steps: | |
- name: Download | |
uses: actions/download-artifact@v3 | |
with: | |
name: alpaqa-${{ matrix.host }} | |
path: package | |
- name: Update | |
run: apt update | |
- name: Install | |
run: apt install -y ./package/*alpaqa*.deb | |
- name: Run | |
run: alpaqa-driver | |
release: | |
if: ${{ github.event.action == 'released' || github.event.action == 'prereleased' }} | |
needs: [test, test-deb] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
host: [x86_64-centos7-linux-gnu, aarch64-rpi3-linux-gnu] | |
steps: | |
- name: Download | |
uses: actions/download-artifact@v3 | |
with: | |
name: alpaqa-${{ matrix.host }} | |
path: package | |
- name: Release | |
uses: softprops/action-gh-release@17cd0d34deddf848fc0e7d9be5202c148c270a0a | |
with: | |
files: | | |
package/alpaqa*.tar.gz | |
package/*alpaqa*.deb |