[CI] link libgcc statically #477
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 Tests: C++' | |
on: | |
push: | |
tags-ignore: | |
- '**' | |
branches: | |
- '**' | |
release: | |
types: ['released', 'prereleased'] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: ubuntu:jammy | |
strategy: | |
matrix: | |
include: | |
- host: x86_64-bionic-linux-gnu | |
openblas-target: HASWELL | |
- host: aarch64-rpi3-linux-gnu | |
openblas-target: CORTEXA53 | |
env: | |
CMAKE_C_COMPILER_LAUNCHER: ccache | |
CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
CCACHE_DIR: /root/.ccache | |
CONAN_HOME: /root/.conan2 | |
LDFLAGS: '-static-libstdc++ -static-libgcc -flto=auto' | |
steps: | |
# Git clone | |
- name: Install git | |
run: apt -y update && apt -y install --no-install-recommends git ca-certificates | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# Tools | |
- name: Install tools | |
id: tools | |
uses: ./.github/workflows/new-toolchain | |
with: | |
host: ${{ matrix.host }} | |
# Ccache | |
- name: Prepare ccache directory | |
run: mkdir -p "${{ env.CCACHE_DIR }}" | |
- name: Cache ccache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CCACHE_DIR }}/p | |
key: ${{ runner.os }}-linux-bin-${{ matrix.host }}-ccache-${{ github.run_id }} | |
restore-keys: ${{ runner.os }}-linux-bin-${{ matrix.host }}-ccache | |
# Conan | |
- name: Cache Conan | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CONAN_HOME }} | |
key: ${{ runner.os }}-linux-bin-${{ matrix.host }}-conan-${{ github.run_id }} | |
restore-keys: ${{ runner.os }}-linux-bin-${{ matrix.host }}-conan | |
- name: Install Conan | |
run: | | |
python3 -m pip install -U conan | |
conan --version | |
conan profile detect -f | |
git clone https://github.com/tttapa/conan-recipes tttapa-conan-recipes | |
conan remote add tttapa-conan-recipes tttapa-conan-recipes --force | |
# Install dependencies | |
- name: Install dependencies (RelWithDebInfo) | |
run: > | |
conan install . --build=missing | |
-pr:h "${{ steps.tools.outputs.conan-profile }}" | |
-c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" | |
-c tools.build:skip_test=True | |
-o \&:shared=True | |
-o \&:with_ipopt=True -o \&:with_external_casadi=False | |
-o \&:with_qpalm=True -o \&:with_cutest=True | |
-o \&:with_examples=False | |
-o "openblas/*:target=${{ matrix.openblas-target }}" | |
-s build_type=RelWithDebInfo | |
# Configure and Build | |
- name: Configure (RelWithDebInfo) | |
run: cmake --preset conan-default | |
- name: Build (RelWithDebInfo) | |
run: cmake --build --preset conan-relwithdebinfo | |
# Cleanup | |
- name: Cleanup (RelWithDebInfo) | |
run: rm build/CMakeCache.txt | |
# Install dependencies | |
- name: Install dependencies (Debug) | |
run: > | |
conan install . --build=missing | |
-pr:h "${{ steps.tools.outputs.conan-profile }}" | |
-c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" | |
-c tools.build:skip_test=True | |
-o \&:shared=True | |
-o \&:with_ipopt=True -o \&:with_external_casadi=False | |
-o \&:with_qpalm=True -o \&:with_cutest=True | |
-o \&:with_examples=False | |
-o "openblas/*:target=${{ matrix.openblas-target }}" | |
-s build_type=Debug | |
# Configure and Build | |
- name: Configure (Debug) | |
run: cmake --preset conan-default | |
- name: Build (Debug) | |
run: cmake --build --preset conan-debug | |
# Package | |
- name: Package | |
run: | | |
cpack -G 'TGZ;DEB' -C "RelWithDebInfo;Debug" | |
working-directory: build | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: alpaqa-${{ matrix.host }} | |
retention-days: 1 | |
path: | | |
build/alpaqa*.tar.gz | |
build/*alpaqa*.deb | |
test: | |
# TODO | |
if: false | |
needs: [build] | |
runs-on: ubuntu-latest | |
container: ubuntu:jammy | |
strategy: | |
matrix: | |
config: [RelWithDebInfo, Debug] | |
host: [x86_64-bionic-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@v4 | |
with: | |
submodules: recursive | |
- name: Download | |
uses: actions/download-artifact@v4 | |
with: | |
name: alpaqa-${{ matrix.host }} | |
path: package | |
- name: Install | |
run: apt install -y ./package/*alpaqa*.deb | |
- name: Build examples (${{ matrix.config }}) | |
run: | | |
cmake -B build-examples -S examples \ | |
-G "Ninja Multi-Config" | |
cmake --build build-examples -j --config ${{ matrix.config }} | |
- name: Build tests (${{ matrix.config }}) | |
run: | | |
cmake -B build-tests -S test \ | |
-G "Ninja Multi-Config" | |
cmake --build build-tests -j --config ${{ matrix.config }} | |
- name: Upload (${{ matrix.config }}) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: alpaqa-${{ matrix.host }}-test-examples-${{ matrix.config }} | |
retention-days: 1 | |
path: | | |
build-examples/C++/CustomCppProblem/${{ matrix.config }}/custom-cpp-problem-example | |
build-examples/C++/SimpleUnconstrProblem/${{ matrix.config }}/simple-unconstr-cpp-problem-example | |
build-examples/C++/CustomControlCppProblem/${{ matrix.config }}/custom-control-cpp-problem-example | |
build-examples/C++/FortranProblem/${{ matrix.config }}/fortran-problem-example | |
build-examples/C++/DLProblem/${{ matrix.config }}/dl-problem-example | |
build-examples/C++/DLProblem/${{ matrix.config }}/test-matmul | |
build-tests/${{ matrix.config }}/tests | |
build-tests/${{ matrix.config }}/librosenbrock_functions_test.so | |
- name: Run examples (${{ matrix.config }}) | |
run: | | |
set -ex | |
./build-examples/C++/CustomCppProblem/${{ matrix.config }}/custom-cpp-problem-example | |
./build-examples/C++/SimpleUnconstrProblem/${{ matrix.config }}/simple-unconstr-cpp-problem-example | |
./build-examples/C++/CustomControlCppProblem/${{ matrix.config }}/custom-control-cpp-problem-example | |
./build-examples/C++/FortranProblem/${{ matrix.config }}/fortran-problem-example | |
./build-examples/C++/DLProblem/${{ matrix.config }}/dl-problem-example | |
./build-examples/C++/DLProblem/${{ matrix.config }}/test-matmul | |
- name: Run tests (${{ matrix.config }}) | |
run: | | |
set -ex | |
./build-tests/${{ matrix.config }}/tests | |
cmake --build build-tests -t test --config ${{ matrix.config }} | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
- name: Install Valgrind | |
run: | | |
apt update | |
apt install -y valgrind --no-install-recommends | |
- name: Run examples (Valgrind, ${{ matrix.config }}) | |
run: | | |
set -ex | |
valgrind --gen-suppressions=all --suppressions=scripts/valgrind/cpp.supp --error-exitcode=234 ./build-examples/C++/CustomCppProblem/${{ matrix.config }}/custom-cpp-problem-example | |
valgrind --gen-suppressions=all --suppressions=scripts/valgrind/cpp.supp --error-exitcode=234 ./build-examples/C++/SimpleUnconstrProblem/${{ matrix.config }}/simple-unconstr-cpp-problem-example | |
valgrind --gen-suppressions=all --suppressions=scripts/valgrind/cpp.supp --error-exitcode=234 ./build-examples/C++/CustomControlCppProblem/${{ matrix.config }}/custom-control-cpp-problem-example | |
valgrind --gen-suppressions=all --suppressions=scripts/valgrind/cpp.supp --error-exitcode=234 ./build-examples/C++/FortranProblem/${{ matrix.config }}/fortran-problem-example | |
valgrind --gen-suppressions=all --suppressions=scripts/valgrind/cpp.supp --error-exitcode=234 ./build-examples/C++/DLProblem/${{ matrix.config }}/dl-problem-example | |
valgrind --gen-suppressions=all --suppressions=scripts/valgrind/cpp.supp --error-exitcode=234 ./build-examples/C++/DLProblem/${{ matrix.config }}/test-matmul | |
- name: Run tests (Valgrind, ${{ matrix.config }}) | |
run: | | |
valgrind --gen-suppressions=all --suppressions=scripts/valgrind/cpp.supp --error-exitcode=234 ./build-tests/${{ matrix.config }}/tests | |
test-deb: | |
needs: [build] | |
runs-on: ubuntu-latest | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
host: [x86_64-bionic-linux-gnu] | |
container: | |
- 'debian:bullseye' | |
- 'debian:bookworm' | |
- 'debian:sid' | |
- 'ubuntu:focal' | |
- 'ubuntu:jammy' | |
- 'ubuntu:rolling' | |
steps: | |
- name: Download | |
uses: actions/download-artifact@v4 | |
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' }} | |
# TODO: test | |
needs: [test-deb] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
host: [x86_64-bionic-linux-gnu, aarch64-rpi3-linux-gnu] | |
steps: | |
- name: Download | |
uses: actions/download-artifact@v4 | |
with: | |
name: alpaqa-${{ matrix.host }} | |
path: package | |
- name: Release | |
uses: softprops/action-gh-release@17cd0d34deddf848fc0e7d9be5202c148c270a0a | |
with: | |
files: | | |
package/alpaqa*.tar.gz | |
package/*alpaqa*.deb |