Skip to content

Version 1.0.0a11

Version 1.0.0a11 #301

Workflow file for this run

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_SINGLE_PRECISION=On \
-D ALPAQA_WITH_LONG_DOUBLE=On \
-D ALPAQA_WITH_QUAD_PRECISION=$quadmath \
-D ALPAQA_WITH_CASADI=On \
-D CMAKE_TOOLCHAIN_FILE="$staging/$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:
config: [RelWithDebInfo, Debug]
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 (${{ 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@v3
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-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