-
Notifications
You must be signed in to change notification settings - Fork 9
194 lines (187 loc) · 8.36 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
on:
pull_request:
push:
schedule:
- cron: '0 0 1 * *'
env:
COMMONFLAGS: '-Wall -Wextra -pedantic -Werror'
jobs:
build:
name: >
${{ matrix.os }}, ${{ matrix.compiler }}${{
matrix.version && format('-{0}', matrix.version) || ''
}}${{
matrix.boost-version &&
format(', boost-{0}', matrix.boost-version) || ''
}}${{
matrix.extra-desc && format(', {0}', matrix.extra-desc) || ''
}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# GCC builds
- {os: ubuntu-20.04, compiler: gcc, version: '7',
flags: '-Wsuggest-override'}
- {os: ubuntu-20.04, compiler: gcc, version: '8',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '9',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '10',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '11',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '12',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '13',
flags: '-Wsuggest-override'}
# Clang builds
- {os: ubuntu-20.04, compiler: clang, version: '9'}
- {os: ubuntu-20.04, compiler: clang, version: '10'}
- {os: ubuntu-20.04, compiler: clang, version: '11'}
- {os: ubuntu-20.04, compiler: clang, version: '12'}
- {os: ubuntu-latest, compiler: clang, version: '13'}
- {os: ubuntu-latest, compiler: clang, version: '14'}
- {os: ubuntu-latest, compiler: clang, version: '15'}
- {os: ubuntu-latest, compiler: clang, version: '16'}
# Windows builds
- {os: windows-2019, compiler: msvc, version: '14.1', # VS 2017
boost-version: '1.80.0'}
- {os: windows-2019, compiler: msvc, version: '14.2', # VS 2019
boost-version: '1.80.0'}
- {os: windows-latest, compiler: msvc, version: '14.3', # VS 2022
boost-version: '1.80.0'}
# macOS builds
- {os: macos-latest, compiler: clang}
# C++20 builds
- {os: ubuntu-latest, compiler: gcc, version: '13',
common-options: '--std=c++20', flags: '-Wsuggest-override',
boost-version: '1.78.0', extra-desc: 'c++20'}
- {os: ubuntu-latest, compiler: clang, version: '16',
common-options: '--std=c++20', boost-version: '1.78.0',
extra-desc: 'c++20'}
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Cache Boost binaries
if: startsWith(matrix.os, 'windows-') && matrix.boost-version
uses: actions/cache@v3
id: cache-boost
with:
path: C:\boost-${{ matrix.boost-version }}
key: >
${{ matrix.os }}-boost-${{ matrix.boost-version }}-msvc-${{
matrix.version }}-${{ hashFiles('.github/workflows/build.yml') }}
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
pip install bfg9000
- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu-')
run: >
sudo apt-get install
ninja-build
libboost-dev
libboost-iostreams-dev
libboost-program-options-dev
- name: Install Windows dependencies
if: startsWith(matrix.os, 'windows-')
run: |
choco install ninja
${gnomebase} = "https://ftp.gnome.org/pub/gnome/binaries/win32"
curl -LO ${gnomebase}/dependencies/pkg-config_0.26-1_win32.zip
curl -LO ${gnomebase}/glib/2.28/glib_2.28.8-1_win32.zip
curl -LO ${gnomebase}/dependencies/gettext-runtime_0.18.1.1-2_win32.zip
7z x -y pkg-config_0.26-1_win32.zip -oC:\pkg-config
7z x -y glib_2.28.8-1_win32.zip -oC:\pkg-config
7z x -y gettext-runtime_0.18.1.1-2_win32.zip -oC:\pkg-config
echo "PKG_CONFIG=C:\pkg-config\bin\pkg-config.exe" >> ${env:GITHUB_ENV}
- name: Install macOS dependencies
if: startsWith(matrix.os, 'macos-')
run: |
brew install ninja pkg-config boost
- name: Install Boost ${{ matrix.boost-version }} from source
if: "!startsWith(matrix.os, 'windows-') && matrix.boost-version"
run: |
export BOOST_ROOT=${HOME}/boost-${{ matrix.boost-version }}
export SRCDIR=boost_`echo ${{ matrix.boost-version }} | sed 's/\./_/g'`
curl -LO https://sourceforge.net/projects/boost/files/boost/${{ matrix.boost-version }}/${SRCDIR}.tar.bz2
tar -xjf ${SRCDIR}.tar.bz2
pushd ${SRCDIR}
./bootstrap.sh --prefix=${BOOST_ROOT} --with-libraries=program_options,iostreams
./b2 link=shared threading=multi variant=release -d0
./b2 install -d0
popd
echo "BOOST_ROOT=${BOOST_ROOT}" >> ${GITHUB_ENV}
- name: Install Boost ${{ matrix.boost-version }} from binaries
if: startsWith(matrix.os, 'windows-') && matrix.boost-version
run: |
${boostroot} = "C:\boost-${{ matrix.boost-version }}"
${msvcver} = "${{ matrix.version }}" -replace '(\d+\.\d).*','$1'
if ("${{ steps.cache-boost.outputs.cache-hit }}" -ne "true" ) {
${boost_ver} = "${{ matrix.boost-version }}" -replace '\.','_'
${boostexe} = "boost_${boost_ver}-msvc-${msvcver}-64.exe"
curl --retry 3 --retry-all-errors -LO https://sourceforge.net/projects/boost/files/boost-binaries/${{ matrix.boost-version }}/${boostexe}
Start-Process -Wait -FilePath ".\${boostexe}" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=${boostroot}"
}
echo "BOOST_INCLUDEDIR=${boostroot}" >> ${env:GITHUB_ENV}
echo "BOOST_LIBRARYDIR=${boostroot}\lib64-msvc-${msvcver}" >> ${env:GITHUB_ENV}
- name: Install gcc
if: startsWith(matrix.os, 'ubuntu-') && matrix.compiler == 'gcc'
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-${{ matrix.version }}
echo "CXX=g++-${{ matrix.version }}" >> ${GITHUB_ENV}
- name: Install clang
if: startsWith(matrix.os, 'ubuntu-') && matrix.compiler == 'clang'
run: |
export CODENAME=`lsb_release -c | sed 's/Codename:\t//'`
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${{ matrix.version }} main"
sudo apt-get update
sudo apt-get install clang-${{ matrix.version }}
echo "CXX=clang++-${{ matrix.version }}" >> ${GITHUB_ENV}
- name: Initialize MSVC ${{ matrix.version }}
if: startsWith(matrix.os, 'windows-')
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: ${{ matrix.version }}
- name: Clone mettle
uses: actions/checkout@v3
with:
repository: jimporter/mettle
path: mettle
- name: Build mettle
if: "!startsWith(matrix.os, 'windows-')"
run: |
pushd mettle
9k build --backend=ninja --prefix=${HOME} ${{ matrix.common-options }}
cd build
ninja install
popd
echo "PATH=${HOME}/bin:${PATH}" >> ${GITHUB_ENV}
echo "CPATH=${HOME}/include" >> ${GITHUB_ENV}
echo "PKG_CONFIG_PATH=${HOME}/lib/pkgconfig" >> ${GITHUB_ENV}
echo "CXXFLAGS=${COMMONFLAGS} ${{ matrix.flags }}" >> ${GITHUB_ENV}
- name: Build mettle (Windows)
if: startsWith(matrix.os, 'windows-')
run: |
pushd mettle
9k build --backend=ninja --prefix=$env:HOME\mettle ${{ matrix.common-options }}
cd build
ninja install
popd
echo "PATH=${env:HOME}\mettle;${env:PATH}" >> ${env:GITHUB_ENV}
echo "CPATH=${env:HOME}\mettle" >> ${env:GITHUB_ENV}
echo "PKG_CONFIG_PATH=${env:HOME}\mettle\pkgconfig" >> ${env:GITHUB_ENV}
echo "CXXFLAGS=/WX ${{ matrix.flags }}" >> ${env:GITHUB_ENV}
- name: Run tests
run: |
9k build --backend=ninja ${{ matrix.common-options }}
cd build
ninja test