-
Notifications
You must be signed in to change notification settings - Fork 3
195 lines (169 loc) · 5.74 KB
/
build.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
name: Build and test
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
strategy:
matrix:
name: [ubuntu-gcc-10,
ubuntu-gcc-11,
# ubuntu-gcc-11-sanitize,
ubuntu-gcc-12,
ubuntu-gcc-12-debugoptimized,
ubuntu-clang-13,
# macos-xcode-12.5
]
include:
- name: ubuntu-gcc-9
os: ubuntu-latest
compiler: gcc
version: "9"
buildtype: "release"
- name: ubuntu-gcc-10
os: ubuntu-latest
compiler: gcc
version: "10"
buildtype: "release"
- name: ubuntu-gcc-11
os: ubuntu-latest
compiler: gcc
version: "11"
buildtype: "release"
- name: ubuntu-gcc-12
os: ubuntu-latest
compiler: gcc
version: "12"
buildtype: "release"
# To enable this, we'd probably need to add `export ASAN_OPTIONS=detect_odr_violation=0`.
#
# - name: ubuntu-gcc-11-sanitize
# os: ubuntu-latest
# compiler: gcc
# version: "11"
# buildtype: "release"
# sanitize: "address"
#
- name: ubuntu-gcc-12-debugoptimized
os: ubuntu-latest
compiler: gcc
version: "12"
buildtype: "debugoptimized"
- name: ubuntu-clang-13
os: ubuntu-latest
compiler: clang
version: "13"
buildtype: "release"
# Currently we get "dyld: Library not loaded: @rpath/librestbed.4.dylib"
# when attempting to run executables.
#
# - name: macos-xcode-12.5
# os: macos-latest
# compiler: xcode
# version: "12.5"
# buildtype: "release"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install (Linux)
if: runner.os == 'Linux'
run: |
sudo apt install -y ccache libboost-all-dev
sudo rm -rf /usr/local/share/boost
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.version }}
echo "CC=ccache gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=ccache g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.version }}
echo "CC=ccache clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=ccache clang++-${{ matrix.version }}" >> $GITHUB_ENV
fi
- name: Install (macOS)
if: runner.os == 'macOS'
run: |
brew install pkg-config boost ccache coreutils
echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.version }}.app/Contents/Developer" >> $GITHUB_ENV
echo "CC=ccache clang" >> $GITHUB_ENV
echo "CXX=ccache clang++" >> $GITHUB_ENV
- name: Install meson
run: |
python3 -mpip install meson ninja
# Caches for different branches are isolated, so we don't need to put the branch name into the key.
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
ccache --set-config=cache_dir=$HOME/.ccache
if [ "${{ runner.os }}" = "Linux" ]; then
stamp=$(date '+%s')
else
stamp=$(gdate '+%s')
fi
echo "${stamp}"
echo "timestamp=${stamp}" >> $GITHUB_OUTPUT
- name: ccache cache files
uses: pat-s/[email protected]
with:
path: ~/.ccache
key: ${{ matrix.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.name }}-ccache-
- name: build restbed
run: |
cd
git clone --recursive https://github.com/corvusoft/restbed.git
mkdir restbed/build
cd restbed/build
cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_TESTS=NO -DBUILD_SSL=NO -DCMAKE_INSTALL_PREFIX="${HOME}/local/" -G Ninja
ninja install
echo "LD_LIBRARY_PATH=${HOME}/local/library:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: build g3log
run: |
cd
git clone https://github.com/KjellKod/g3log.git
mkdir g3log/build
cd g3log/build
cmake .. -DCMAKE_INSTALL_PREFIX="/usr/" -DUSE_DYNAMIC_LOGGING_LEVELS=ON -G Ninja
ninja package
sudo dpkg -i g3log*.deb
- name: Configure otcetera
run: |
cd ${GITHUB_WORKSPACE}
ARGS="${ARGS} -Drestbed_dir=${HOME}/local/"
if [ "${{ runner.os }}" = "Linux" ] && [ "${{ matrix.name }}" != "windows" ] && [ "${{ matrix.sanitize }}" != "" ] ; then
# Address sanitizer can't find its dylibs on OS X?
ARGS="${ARGS} -Db_sanitize=${{ matrix.sanitize }}"
fi
echo "CPPFLAGS=-g $CPPFLAGS" >> $GITHUB_ENV
echo meson setup build --prefix=$HOME/local --buildtype=${{ matrix.buildtype }} ${ARGS}
meson setup build --prefix=$HOME/local --buildtype=${{ matrix.buildtype }} ${ARGS}
- name: Build otcetera
run: |
ccache -p
ninja -C build install -j4
ccache -s
- name: Run otcetera tests
run: |
$HOME/local/bin/otc-version-reporter
$HOME/local/bin/otc-solve-subproblem -h
python3 -mpip install requests
ninja -C build test
- name: Upload test files if they failed
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-results-${{ matrix.name }}
path: expected
- name: Upload test files if they failed
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-resultsws-${{ matrix.name }}
path: expected-ws