-
Notifications
You must be signed in to change notification settings - Fork 59
299 lines (264 loc) · 11.7 KB
/
make-mingw.yaml
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
name: make-mingw
on: [push]
concurrency: ci-mingw-${{ github.ref }}
jobs:
mingw:
runs-on: ${{ matrix.os }}
name: mingw-w64 ${{ matrix.msystem }}
defaults:
run:
# Use MSYS2 as default shell
shell: msys2 {0}
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
# For available GitHub-hosted runners, see: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
os: [windows-latest]
msystem: [MINGW64, CLANG64]
include:
- msystem: MINGW64
mingw-prefix: mingw64
target-prefix: mingw-w64-x86_64
cc: gcc
cxx: g++
f77: gfortran
extra-config-flags: ""
ccache-max: 0.9G
allow-error: false
- msystem: CLANG64
mingw-prefix: clang64
target-prefix: mingw-w64-clang-x86_64
cc: clang
# It looks like we and graphicsmagick++ aren't ready for C++17 yet.
cxx: "clang++ -std=gnu++14"
f77: flang
# Clang seems to require a different set of dllexport attributes than GCC.
extra-config-flags:
--disable-lib-visibility-flags
ccache-max: 400M
# This configuration is not fully supported yet
allow-error: true
env:
CHERE_INVOKING: 1
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
F77: ${{ matrix.f77 }}
# perl uses cmd shell by default
PERL5SHELL: bash -l -c
steps:
- name: get CPU name
# The runners for the 32-bit target sometimes get stuck in configure
# when using the Fortran compiler.
# Does that error depend on the processor of the selected runner?
shell: pwsh
run : |
Get-CIMInstance -Class Win32_Processor | Select-Object -Property Name
- name: install MSYS2 build environment
uses: msys2/setup-msys2@v2
with:
update: true
# Use pre-installed version to save disc space on partition with source.
# We need that space for building.
release: false
# The packages are listed in (alphabetically sorted) blocks:
# The first block is for mandatory dependencies.
# The second block is for optional dependencies needed when building from a release tarball.
# The third block is for additional dependencies needed when building from a repository checkout.
# The fourth block is for additional run-time dependencies (to run test suite) that aren't needed to build.
install: >-
base-devel
${{ matrix.target-prefix }}-autotools
${{ matrix.target-prefix }}-cc
${{ matrix.target-prefix }}-fc
${{ matrix.target-prefix }}-gperf
${{ matrix.target-prefix }}-openblas
${{ matrix.target-prefix }}-pcre2
${{ matrix.target-prefix }}-arpack
${{ matrix.target-prefix }}-curl
${{ matrix.target-prefix }}-fftw
${{ matrix.target-prefix }}-fltk
${{ matrix.target-prefix }}-gl2ps
${{ matrix.target-prefix }}-glpk
${{ matrix.target-prefix }}-ghostscript
${{ matrix.target-prefix }}-gnuplot
${{ matrix.target-prefix }}-graphicsmagick
${{ matrix.target-prefix }}-hdf5
${{ matrix.target-prefix }}-libsndfile
${{ matrix.target-prefix }}-portaudio
${{ matrix.target-prefix }}-qhull
${{ matrix.target-prefix }}-qrupdate
${{ matrix.target-prefix }}-qscintilla
${{ matrix.target-prefix }}-qt5-base
${{ matrix.target-prefix }}-qt5-imageformats
${{ matrix.target-prefix }}-qt5-svg
${{ matrix.target-prefix }}-qt5-tools
${{ matrix.target-prefix }}-rapidjson
${{ matrix.target-prefix }}-suitesparse
${{ matrix.target-prefix }}-sundials
git
${{ matrix.target-prefix }}-ccache
${{ matrix.target-prefix }}-icoutils
${{ matrix.target-prefix }}-librsvg
${{ matrix.target-prefix }}-texinfo
unzip
zip
msystem: ${{ matrix.msystem }}
- name: checkout repository
uses: actions/checkout@v4
- name: prepare ccache
# create key with human readable timestamp
# used in action/cache/restore and action/cache/save steps
id: ccache-prepare
run: |
echo "ccachedir=$(cygpath -m $(ccache -k cache_dir))" >> $GITHUB_OUTPUT
echo "key=ccache:${{ matrix.os }}:${{ matrix.msystem }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
echo "timestamp=$(date +"%Y-%m-%d_%H-%M-%S")" >> $GITHUB_OUTPUT
- name: restore ccache
# Setup the github cache used to maintain the ccache from one job to the next
uses: actions/cache/restore@v4
with:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
key: ${{ steps.ccache-prepare.outputs.key }}
restore-keys: |
ccache:${{ matrix.os }}:${{ matrix.msystem }}:${{ github.ref }}
ccache:${{ matrix.os }}:${{ matrix.msystem }}:refs/heads/default
- name: configure ccache
# Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota.
run: |
which ccache
test -d ${{ steps.ccache-prepare.outputs.ccachedir }} || mkdir -p ${{ steps.ccache-prepare.outputs.ccachedir }}
echo "max_size = ${{ matrix.ccache-max }}" > ${{ steps.ccache-prepare.outputs.ccachedir }}/ccache.conf
echo "compression = true" >> ${{ steps.ccache-prepare.outputs.ccachedir }}/ccache.conf
ccache -p
ccache -s
# create ccache helper script for Fortran compiler
echo -e '#!/bin/bash\nccache '$MINGW_PREFIX'/bin/'$F77' "$@"' > $MINGW_PREFIX/lib/ccache/bin/$F77
# prepend path to ccache helper scripts to PATH
echo 'export PATH="$MINGW_PREFIX/lib/ccache/bin:$PATH"' >> ~/.bash_profile
- name: bootstrap
run: GNULIB_URL=https://github.com/coreutils/gnulib.git ./bootstrap
- name: configure
# configure sometimes hangs while compiling 32bit Fortran.
# It should take much less than 30 minutes. Cancel the step if it takes longer.
timeout-minutes: 30
# FIXME: Fix building with Java support. Override JAVA_HOME for now.
# FIXME: How do we get a working TeX environment in MSYS2? Disable building the documentation for now.
run: |
echo $PATH
which $CC
echo $CC --version
$CC --version
which ${CXX% *}
echo ${CXX% *} --version
${CXX% *} --version
which $F77
echo $F77 --version
$F77 --version
mkdir .build
echo "::group::Run configure script"
cd .build && ../configure \
JAVA_HOME="" \
--enable-relocate-all \
--disable-docs \
${{ matrix.extra-config-flags }}
echo "::endgroup::"
echo "::group::Show config.log"
cat ./config.log
echo "::endgroup::"
- name: build
# Spawning processes seems to have a big overhead on this platform. Use a somewhat larger number of parallel processes to compensate for that.
run: |
make -C ./.build all -j8 V=1
- name: ccache status
continue-on-error: true
run: ccache -s
- name: save ccache
# Save the cache after we are done (successfully) building
uses: actions/cache/save@v4
with:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
key: ${{ steps.ccache-prepare.outputs.key }}
- name: check
# Continuing on error in this step means that jobs will be "green" even
# if the test suite crashes. But if we don't continue, we'll loose the
# ccache and other jobs will be cancelled, too.
# It would be nice if we could mark the job as "yellow" (and continue)
# in that case. The second best thing is to display a warning in the
# job summary (see below).
continue-on-error: true
timeout-minutes: 60
# mkoctfile seems to have trouble when gcc is called via ccache. So,
# remove the directory with the ccache wrappers from PATH.
run: |
export PATH=$(echo "$PATH" | sed -e "s|$MINGW_PREFIX/lib/ccache/bin:||g")
make -C ./.build check RUN_OCTAVE_OPTIONS="--no-gui-libs" | tee ./test-suite.log
- name: display test suite log
continue-on-error: true
# Displaying the log shouldn't take long. Cancel the step if it does.
timeout-minutes: 5
run: cat ./.build/test/fntests.log
- name: test history file creation
# see bug #62365
# Pipe to an interactive session to trigger appending the command to
# the history. This will trigger the creation of a history file.
run: |
echo "history_file (make_absolute_filename ('./a/b/c/history')); disp ('test')" | ./.build/run-octave -i
[ -f ./a/b/c/history ] || echo "::warning::Creating history file failed"
- name: install
run: |
mkdir -p /c/octave/pkg
make -C ./.build DESTDIR=/c/octave/pkg install
- name: test stand-alone executable
continue-on-error: ${{ matrix.allow-error }}
run: |
unset CC
unset CXX
export PATH=$(echo "$PATH" | sed -e "s|$MINGW_PREFIX/lib/ccache/bin:||g")
export PATH="/c/octave/pkg/${{ matrix.mingw-prefix }}/bin:$PATH"
cd examples/code
mkoctfile --link-stand-alone embedded.cc -o embedded
./embedded.exe
- name: test Octave packages
continue-on-error: ${{ matrix.allow-error }}
env:
# colon separated list of packages
PACKAGE_NAMES: "control:stk"
run: |
unset CC
unset CXX
export PATH=$(echo "$PATH" | sed -e "s|$MINGW_PREFIX/lib/ccache/bin:||g")
export PATH="/c/octave/pkg/${{ matrix.mingw-prefix }}/bin:$PATH"
IFS=':' read -r -a packages <<< "${PACKAGE_NAMES}"
for package in "${packages[@]}"; do
printf " \033[0;32m==>\033[0m Octave package \033[0;32m${package}\033[0m\n"
echo "::group::Install ${package}"
octave --eval "pkg install -verbose -forge ${package}"
echo "::endgroup::"
echo "::group::Test ${package}"
octave --eval "pkg test ${package}"
echo "::endgroup::"
echo "::group::Test log for ${package}"
cat ${GITHUB_WORKSPACE}/fntests.log
echo "::endgroup::"
done
- name: analyze test suite results
# Make sure the test summary lists 0 "FAIL"s and no "REGRESSION"
run: |
[ -n "$(grep -e "FAIL\s*0" ./test-suite.log)" ] || echo "::warning::At least one test failed"
[ -z "$(grep -e "REGRESSION" ./test-suite.log)" ] || echo "::warning::At least one regression in test suite"
echo Finished analyzing test suite results.
- name: compress build artifact
if: matrix.msystem == 'MINGW64'
continue-on-error: true
run: |
cd /c/octave/pkg
tar -cvzf octave.tar.gz *
- name: upload build artifact
if: matrix.msystem == 'MINGW64'
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target-prefix }}-octave-${{ steps.ccache-prepare.outputs.timestamp }}
path: C:\octave\pkg\octave.tar.gz
retention-days: 7