-
Notifications
You must be signed in to change notification settings - Fork 7
254 lines (248 loc) · 9.79 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
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:
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 }}
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 }}/p
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
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
- 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
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
- 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
- run: conan cache clean
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