-
Notifications
You must be signed in to change notification settings - Fork 7
226 lines (220 loc) · 8.72 KB
/
linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: 'CI Tests: C++'
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 ALPAQA_WITH_IPOPT=On \
-D ALPAQA_WITH_CUTEST=On \
-D ALPAQA_WITH_CUTEST_EXAMPLES=Off \
-D ALPAQA_WITH_DRIVERS=On \
-D ALPAQA_WITH_GRADIENT_CHECKER=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