-
Notifications
You must be signed in to change notification settings - Fork 4
206 lines (183 loc) · 5.43 KB
/
cmake.yml
File metadata and controls
206 lines (183 loc) · 5.43 KB
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
name: CMake Build
on:
push:
branches: [main]
tags: '*'
pull_request:
branches: [main]
workflow_dispatch:
inputs:
cmake_flags:
description: Extra flags to pass to CMake
required: false
default: ''
ctest_flags:
description: Extra flags to pass to CTest
required: false
default: ''
make_flags:
description: Extra flags to pass to make
required: false
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
INSTALL_PREFIX: /tmp/libasdf
jobs:
build_matrix:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14]
cc: [clang, gcc]
cmake_options: ["", "-DENABLE_ASAN=ON"]
exclude:
- os: macos-14
cc: gcc
cmake_options: ""
- os: macos-14
cc: gcc
cmake_options: "-DENABLE_ASAN=ON"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
- name: Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt update
sudo apt install -y \
build-essential \
clang \
libfyaml-dev \
libbz2-dev \
liblz4-dev \
zlib1g-dev \
libbsd-dev \
libstatgrab-dev
- name: MacOS dependencies
if: startsWith(matrix.os, 'macos')
run: |
brew update
brew install \
argp-standalone \
libfyaml \
libstatgrab \
libbsd \
lz4
- name: Setup ccache action
uses: Chocobo1/setup-ccache-action@v1.5.1
- name: Linux build
if: startsWith(matrix.os, 'ubuntu')
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PREFIX }} \
-DENABLE_TESTING_ALL=YES \
${{ matrix.cmake_options }} \
${{ github.event.inputs.cmake_flags }}
make VERBOSE=1 ${{ github.event.inputs.make_flags }}
- name: MacOS build
if: startsWith(matrix.os, 'macos')
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cc }}++
PKG_CONFIG_PATH: /opt/homebrew/lib/pkgconfig:/usr/local/lib/pkgconfig
run: |
mkdir -p build
cd build
export SDKROOT="$(xcrun --show-sdk-path)"
hbroot=/opt/homebrew
cmake .. \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PREFIX }} \
-DENABLE_TESTING_ALL=YES \
-DARGP_NO_PKGCONFIG=YES \
-DARGP_LIBDIR=${hbroot}/lib \
-DARGP_INCLUDEDIR=${hbroot}/include \
${{ matrix.cmake_options }} \
${{ github.event.inputs.cmake_flags }}
make VERBOSE=1 ${{ github.event.inputs.make_flags }}
- name: Install
run: |
cd build
make VERBOSE=1 install
- name: Generate source archive
run: |
cd build
make VERBOSE=1 package_source
- name: Generate binary archives
run: |
cd build
make VERBOSE=1 package
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
ctest -C ${{env.BUILD_TYPE}} \
${{ github.event.inputs.ctest_flags }}
- name: Output test logs on failure
if: failure()
working-directory: ${{github.workspace}}/build
run: |
logfile=Testing/Temporary/LastTest.log
if ! [ -f "$logfile" ]; then
echo "No log file. Did the tests run at all?"
exit 0
fi
cat "$logfile"
# Test the documentation build if the build passes
docs:
name: 'Build documentation'
runs-on: ubuntu-latest
needs: build_matrix
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
- name: Install documentation dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libclang-dev \
libfyaml-dev \
libbz2-dev \
liblz4-dev \
zlib1g-dev \
libstatgrab-dev \
llvm \
python3-sphinx \
python3-clang
# Don't use docs/requirements.txt here since we are trying with the
# system packages for sphinx and clang
pip install furo hawkmoth
- name: Set LD_LIBRARY_PATH
run: echo "LD_LIBRARY_PATH=$(llvm-config --libdir):$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Configure
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PREFIX }} \
-DENABLE_DOCS=YES \
${{ matrix.cmake_options }} \
${{ github.event.inputs.cmake_flags }}
- name: Build Sphinx documentation
run: |
cd build
make docs SPHINX_FLAGS=-W
- name: Install Sphinx documentation
run: |
cd build
make install