-
Notifications
You must be signed in to change notification settings - Fork 235
230 lines (204 loc) · 8.43 KB
/
test_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
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
################################################################################
#
# Github actions trigger (workflow script) for building Macaulay2
#
# See https://help.github.com/en/actions for the documentation.
#
################################################################################
name: Build and Test Macaulay2
on:
workflow_dispatch:
push:
branches:
- pre-master # when we're ready to merge 'development' into 'master', we merge it first into 'pre-master', so it can be tested
pull_request:
branches:
- master
- development
- release-1.17
schedule:
# cron time in UTC
# a scheduled job runs on the default branch: 'master'
- cron: '0 6 * * *'
defaults:
run:
working-directory: M2/BUILD/build
jobs:
build:
if: github.repository == 'Macaulay2/M2' || contains(github.ref, 'global')
name: ${{ matrix.build-system }}-${{ matrix.os }}-${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
build-system:
- cmake
- autotools
os:
- ubuntu-latest
- macos-latest
compiler:
- default
include:
- build-system: cmake
os: ubuntu-latest
compiler: gcc9
cxx: g++-9
cc: gcc-9
- build-system: cmake
os: ubuntu-latest
compiler: clang10
cxx: clang++-10
cc: clang-10
# This build tests Clang rather than AppleClang (keep)
- build-system: cmake
os: macos-latest
compiler: clang10
cxx: clang++
cc: clang
exclude:
- build-system: cmake
os: macos-latest
compiler: default
steps:
- uses: actions/checkout@v2
# ----------------------
# Install missing tools and libraries for macOS
# ----------------------
- name: Install requirements for macOS
if: runner.os == 'macOS'
run: |
brew config
brew tap macaulay2/tap
brew install autoconf automake bison ccache cmake ctags gnu-tar libtool make ninja pkg-config yasm
brew install --with-tbb --only-dependencies macaulay2/tap/M2
HOMEBREW_DEPS=`brew deps --1 --include-optional macaulay2/tap/M2 | tr '\n' ';'`
HOMEBREW_PREFIX=`brew --prefix`
echo "OPT_PREFIX=$HOMEBREW_PREFIX/opt/${HOMEBREW_DEPS//;/;$HOMEBREW_PREFIX/opt/}" >> $GITHUB_ENV
# ----------------------
# Install missing tools and libraries for Linux
# ----------------------
- name: Install requirements for Linux
if: runner.os == 'Linux'
run: |
sudo add-apt-repository -y ppa:macaulay2/macaulay2
sudo apt-get update
sudo apt-get install -y -q --no-install-recommends clang-10 gfortran libtool-bin ninja-build yasm ccache
sudo apt-get install -y -q --no-install-recommends libatomic-ops-dev libboost-stacktrace-dev \
libncurses-dev libncurses5-dev libreadline-dev libeigen3-dev liblapack-dev libxml2-dev \
libgc-dev libgdbm-dev libglpk-dev libgmp3-dev libgtest-dev libmpfr-dev libntl-dev gfan \
libgivaro-dev libboost-regex-dev fflas-ffpack libflint-dev libmps-dev libfrobby-dev \
libsingular-dev singular-data libmemtailor-dev libmathic-dev libmathicgb-dev libcdd-dev \
cohomcalg topcom 4ti2 normaliz coinor-csdp nauty lrslib w3c-markup-validator
# ----------------------
# Steps common to all build variants
# ----------------------
- name: Prepare build environment
run: |
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
if [[ "${{ runner.os }}" == "Linux" ]]
then echo "/usr/lib/ccache" >> $GITHUB_PATH
# ccache doesn't seem to create the right symlink for clang-10 on ubuntu
sudo ln -s `which clang-10` /usr/lib/ccache
sudo ln -s `which clang++-10` /usr/lib/ccache
else echo `brew --prefix ccache`/libexec >> $GITHUB_PATH
echo `brew --prefix make `/libexec/gnubin >> $GITHUB_PATH
fi
- uses: actions/cache@v2
if: matrix.build-system == 'cmake'
id: restore-cache
with:
path: |
~/.ccache
~/work/M2/M2/M2/BUILD/build/usr-host
key: build-cache-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build-system }}-${{ hashFiles('**/cmake/*-libraries.cmake', '.github/workflows/test_build.yml') }}
# restore-keys: |
# build-cache-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build-system }}-
# build-cache-${{ runner.os }}-${{ matrix.compiler }}-
# build-cache-${{ runner.os }}-
# ----------------------
# Configure and build M2 using CMake
# ----------------------
- name: Configure Macaulay2 using CMake
if: matrix.build-system == 'cmake'
run: |
cmake -S../.. -B. -GNinja \
-DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_NATIVE=OFF \
-DCMAKE_PREFIX_PATH=$OPT_PREFIX \
-DCMAKE_INSTALL_PREFIX=/usr
- name: Build libraries using Ninja
if: matrix.build-system == 'cmake'
run: |
cmake --build . --target build-libraries build-programs
- name: Build Macaulay2 using Ninja
if: matrix.build-system == 'cmake'
run: |
cmake --build . --target M2-core M2-emacs install-packages
if [[ "${{ matrix.os }}" == ubuntu-latest ]] && [[ "${{ matrix.compiler }}" == clang10 ]]; then
sudo apt-get install -y -q --no-install-recommends dpkg-dev
echo "GIT_COMMIT=`git describe --dirty --always --match HEAD`" >> $GITHUB_ENV
cpack -G DEB
fi
# ----------------------
# Configure and build M2 using Autotools
# ----------------------
- name: Configure Macaulay2 using Autotools
if: matrix.build-system == 'autotools'
run: |
make -C ../.. get-libtool get-automake get-autoconf
make -C ../.. all
export CPPFLAGS=-I`brew --prefix`/include
export LDFLAGS=-L`brew --prefix`/lib
../../configure --enable-download
- name: Build Macaulay2 using Make
if: matrix.build-system == 'autotools'
run: |
make
# ----------------------
# Run tests
# ----------------------
- name: Run Tests using CTest
if: matrix.build-system == 'cmake' && matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang10'
run: |
./M2 -q --check 1 -e 'exit 0'
# TODO: uncomment these when https://github.com/Macaulay2/M2/issues/1849 is fixed
#./M2 -q --check 2 -e 'exit 0'
#./M2 -q --check 3 -e 'exit 0'
cmake --build . --target M2-tests
cmake --build . --target M2-unit-tests
ctest -j1 --output-on-failure -R "unit-tests"
ctest -j4 --output-on-failure -R "ComputationsBook"
# TODO: add Macaulay2/tests/engine when https://github.com/Macaulay2/M2/issues/1213 is fixed
- name: Run Tests using Autotools
if: matrix.build-system == 'autotools' && matrix.os == 'ubuntu-latest' && matrix.compiler == 'default'
run: |
make check -o check-in-libraries
make -C Macaulay2/html-check-links check
# ----------------------
# Upload build artifacts
# ----------------------
- name: Upload build logs
if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.build-system }}-${{ matrix.os }}-${{ matrix.compiler }}-logs
path: |
# Autotools
M2/BUILD/build/config.log
M2/BUILD/build/include/*
M2/BUILD/build/libraries/*/build/*/config.log
# CMake
M2/BUILD/build/CMakeFiles/CMakeCache.txt
M2/BUILD/build/CMakeFiles/CMake(Error|Output).log
M2/BUILD/build/libraries/*/build/config.log
# Example errors
M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/*/example-output/*.errors
- name: Upload Macaulay2 package for Ubuntu (x86_64)
if: matrix.build-system == 'cmake' && matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang10' && success()
uses: actions/upload-artifact@v2
with:
name: Macaulay2-${{ env.GIT_COMMIT }}-ubuntu-x86_64
path: |
M2/BUILD/build/Macaulay2-*
retention-days: 1