Skip to content

Commit 9bcdeee

Browse files
committed
GitHub-CI (make-cross): Add runners that cross-build for some Linux targets.
* .github/workflows/make-cross.yaml: Add file with CI rules to cross-build Octave on Ubuntu for the architectures armhf, ppc64el, s390x, and riscv64.
1 parent 2a73450 commit 9bcdeee

File tree

1 file changed

+299
-0
lines changed

1 file changed

+299
-0
lines changed

.github/workflows/make-cross.yaml

Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
name: make-cross-build
2+
on:
3+
workflow_dispatch:
4+
# schedule:
5+
# # Run job every Wednesday and Saturday at 16:30 UTC
6+
# - cron: '30 16 * * 3,6'
7+
push:
8+
concurrency: ci-cross-build-${{ github.ref }}
9+
10+
jobs:
11+
12+
cross-build:
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
# Allow other runners in the matrix to continue if some fail
17+
fail-fast: false
18+
19+
matrix:
20+
# List of architectures that are supported by Ubuntu:
21+
# https://canonical-ubuntu-packaging-guide.readthedocs-hosted.com/en/latest/reference/architectures/
22+
arch: [armhf, ppc64el, s390x, riscv64]
23+
include:
24+
- arch: armhf
25+
target-triple: arm-linux-gnueabihf
26+
os: ubuntu-24.04-arm
27+
ccache-max: 1G
28+
- arch: ppc64el
29+
target-triple: powerpc64le-linux-gnu
30+
os: ubuntu-24.04-arm
31+
ccache-max: 1G
32+
- arch: s390x
33+
target-triple: s390x-linux-gnu
34+
os: ubuntu-24.04
35+
ccache-max: 1G
36+
- arch: riscv64
37+
target-triple: riscv64-linux-gnu
38+
os: ubuntu-24.04-arm
39+
ccache-max: 1.4G
40+
41+
name: cross ${{ matrix.arch }}
42+
43+
env:
44+
CC: ${{ matrix.target-triple }}-gcc
45+
CXX: ${{ matrix.target-triple }}-g++
46+
F77: ${{ matrix.target-triple }}-gfortran
47+
48+
steps:
49+
- name: get CPU information
50+
run: lscpu
51+
52+
- name: checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: install toolchain for ${{ matrix.arch }}
56+
run: |
57+
sudo apt -qq update
58+
sudo apt install -y \
59+
g++-${{ matrix.target-triple }} \
60+
gfortran-${{ matrix.target-triple }} \
61+
autoconf automake bison ccache \
62+
dvipng epstool fig2dev flex gnuplot-x11 gperf gzip icoutils \
63+
libtool make perl pstoedit qt6-tools-dev-tools rsync tar texinfo \
64+
qemu-user-binfmt
65+
66+
- name: add repositories for ${{ matrix.arch }} packages
67+
# deb822-style format:
68+
# https://manpages.ubuntu.com/manpages/noble/man5/sources.list.5.html
69+
run: |
70+
sudo dpkg --add-architecture ${{ matrix.arch }}
71+
case ${{ matrix.os }} in
72+
"ubuntu-24.04-arm")
73+
sudo bash -c 'cat - >/etc/apt/sources.list.d/ubuntu.sources' <<-EOF
74+
Types: deb
75+
URIs: http://ports.ubuntu.com/ubuntu-ports/
76+
Suites: noble noble-updates noble-backports
77+
Components: main restricted universe multiverse
78+
Architectures: arm64 ${{ matrix.arch }}
79+
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
80+
81+
Types: deb
82+
URIs: http://security.ports.ubuntu.com/ubuntu-ports/
83+
Suites: noble-security
84+
Components: main restricted universe multiverse
85+
Architectures: arm64 ${{ matrix.arch }}
86+
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
87+
88+
EOF
89+
;;
90+
"ubuntu-24.04")
91+
sudo bash -c 'cat - >/etc/apt/sources.list.d/ubuntu.sources' <<-EOF
92+
Types: deb
93+
URIs: http://archive.ubuntu.com/ubuntu/
94+
Suites: noble noble-updates noble-backports
95+
Components: main restricted universe multiverse
96+
Architectures: amd64
97+
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
98+
99+
Types: deb
100+
URIs: http://security.ubuntu.com/ubuntu/
101+
Suites: noble-security
102+
Components: main restricted universe multiverse
103+
Architectures: amd64
104+
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
105+
106+
Types: deb
107+
URIs: http://ports.ubuntu.com/ubuntu-ports/
108+
Suites: noble noble-updates noble-backports
109+
Components: main restricted universe multiverse
110+
Architectures: ${{ matrix.arch }}
111+
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
112+
113+
Types: deb
114+
URIs: http://security.ports.ubuntu.com/ubuntu-ports/
115+
Suites: noble-security
116+
Components: main restricted universe multiverse
117+
Architectures: ${{ matrix.arch }}
118+
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
119+
120+
EOF
121+
;;
122+
esac
123+
sudo apt update
124+
125+
- name: install dependencies for ${{ matrix.arch }}
126+
run: |
127+
sudo apt install -y \
128+
libarpack2-dev:${{ matrix.arch }} \
129+
libblas-dev:${{ matrix.arch }} \
130+
libcurl4-gnutls-dev:${{ matrix.arch }} \
131+
libfftw3-dev:${{ matrix.arch }} \
132+
libfltk1.3-dev:${{ matrix.arch }} \
133+
libfontconfig1-dev:${{ matrix.arch }} \
134+
libfreetype6-dev:${{ matrix.arch }} \
135+
libgl1-mesa-dev:${{ matrix.arch }} \
136+
libgl2ps-dev:${{ matrix.arch }} \
137+
libglpk-dev:${{ matrix.arch }} \
138+
libgraphicsmagick++1-dev:${{ matrix.arch }} \
139+
libhdf5-dev:${{ matrix.arch }} \
140+
liblapack-dev:${{ matrix.arch }} \
141+
libosmesa6-dev:${{ matrix.arch }} \
142+
libpcre2-dev:${{ matrix.arch }} \
143+
libqhull-dev:${{ matrix.arch }} \
144+
libqscintilla2-qt6-dev:${{ matrix.arch }} \
145+
libqrupdate-dev:${{ matrix.arch }} \
146+
libreadline-dev:${{ matrix.arch }} \
147+
librsvg2-bin:${{ matrix.arch }} \
148+
libsndfile1-dev:${{ matrix.arch }} \
149+
libsuitesparse-dev:${{ matrix.arch }} \
150+
libxft-dev:${{ matrix.arch }} \
151+
portaudio19-dev:${{ matrix.arch }} \
152+
qt6-5compat-dev:${{ matrix.arch }} \
153+
qt6-base-dev:${{ matrix.arch }} \
154+
qt6-tools-dev:${{ matrix.arch }} \
155+
rapidjson-dev:${{ matrix.arch }} \
156+
zlib1g-dev:${{ matrix.arch }}
157+
158+
- name: prepare ccache
159+
# create key with human readable timestamp
160+
# used in action/cache/restore and action/cache/save steps
161+
id: ccache-prepare
162+
run: |
163+
echo "key=ccache:cross:${{ matrix.os }}:${{ matrix.arch }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
164+
165+
- name: restore ccache
166+
# setup the github cache used to maintain the ccache from one job to the next
167+
uses: actions/cache/restore@v4
168+
with:
169+
path: ~/.ccache
170+
key: ${{ steps.ccache-prepare.outputs.key }}
171+
restore-keys: |
172+
ccache:cross:${{ matrix.os }}:${{ matrix.arch }}:${{ github.ref }}
173+
ccache:cross:${{ matrix.os }}:${{ matrix.arch }}:refs/heads/default
174+
175+
- name: configure ccache
176+
env:
177+
CCACHE_MAX: ${{ matrix.ccache-max }}
178+
run: |
179+
test -d ~/.ccache || mkdir ~/.ccache
180+
echo "max_size = $CCACHE_MAX" >> ~/.ccache/ccache.conf
181+
ccache -s
182+
echo "/usr/lib/ccache" >> $GITHUB_PATH
183+
184+
- name: bootstrap
185+
run: GNULIB_URL=https://github.com/coreutils/gnulib.git ./bootstrap
186+
187+
- name: configure
188+
id: configure
189+
timeout-minutes: 30
190+
run: |
191+
echo $PATH
192+
echo which ccache
193+
which ccache
194+
which $CC
195+
echo $CC --version
196+
$CC --version
197+
which ${CXX% *}
198+
echo ${CXX% *} --version
199+
${CXX% *} --version
200+
which $F77
201+
echo $F77 --version
202+
$F77 --version
203+
echo $CC --version
204+
$CC --version
205+
mkdir .build
206+
echo "::group::Run configure script"
207+
cd .build && ../configure \
208+
--host=${{ matrix.target-triple }} \
209+
--disable-docs \
210+
--disable-java \
211+
JAVA_HOME="" \
212+
PKG_CONFIG_PATH=/usr/lib/${{ matrix.target-triple }}/pkgconfig/
213+
echo "::endgroup::"
214+
215+
- name: display config.log
216+
if: always() && (steps.configure.outcome != 'skipped')
217+
continue-on-error: true
218+
# Displaying the log shouldn't take long. Cancel the step if it does.
219+
timeout-minutes: 5
220+
run: cat ./.build/config.log
221+
222+
- name: build
223+
run: XDG_RUNTIME_DIR=$RUNNER_TEMP make -C ./.build -j $(nproc) all V=1
224+
225+
- name: ccache status
226+
run: ccache -s
227+
228+
- name: save ccache
229+
# Save the cache after we are done (successfully) building
230+
uses: actions/cache/save@v4
231+
with:
232+
path: ~/.ccache
233+
key: ${{ steps.ccache-prepare.outputs.key }}
234+
235+
- name: check
236+
id: run-test-suite
237+
timeout-minutes: 60
238+
# Without "-cli", there are deadlocks or crashes while running some
239+
# tests that are related to graphics. This might be due to using qemu
240+
# or xvfb-run or a combination of the two or an actual issue in Octave.
241+
run: XDG_RUNTIME_DIR=$RUNNER_TEMP RUN_OCTAVE_OPTIONS="-cli" make -C ./.build check | tee ./test-suite.log
242+
243+
- name: display test suite log
244+
if: always() && (steps.run-test-suite.outcome != 'skipped')
245+
continue-on-error: true
246+
# Displaying the log shouldn't take long. Cancel the step if it does.
247+
timeout-minutes: 5
248+
run: cat ./.build/test/fntests.log
249+
250+
- name: test history file creation
251+
# see bug #62365
252+
# Pipe to an interactive session to trigger appending the command to
253+
# the history. This will trigger the creation of a history file.
254+
run: |
255+
echo "history_file (make_absolute_filename ('./a/b/c/history')); disp ('test')" | ./.build/run-octave -i
256+
[ -f ./a/b/c/history ] || echo "::warning::Creating history file failed"
257+
258+
- name: install
259+
run: |
260+
sudo make -C ./.build install
261+
262+
- name: test stand-alone executable
263+
run: |
264+
unset CC
265+
unset CXX
266+
cd examples/code
267+
mkoctfile --link-stand-alone embedded.cc -o embedded
268+
LD_LIBRARY_PATH="/usr/local/lib/octave/$(octave --eval "disp(version())")" \
269+
./embedded
270+
271+
- name: test Octave packages
272+
env:
273+
# colon separated list of packages
274+
PACKAGE_NAMES: "control:stk"
275+
run: |
276+
unset CC
277+
unset CXX
278+
IFS=':' read -r -a packages <<< "${PACKAGE_NAMES}"
279+
for package in "${packages[@]}"; do
280+
printf " \033[0;32m==>\033[0m Octave package \033[0;32m${package}\033[0m\n"
281+
echo "::group::Install ${package}"
282+
octave --eval "pkg install -verbose -forge ${package}"
283+
echo "::endgroup::"
284+
if [ ${{ matrix.arch }} = "armhf" ]; then
285+
echo "::group::Test ${package}"
286+
octave --eval "pkg test ${package}"
287+
echo "::endgroup::"
288+
echo "::group::Test log for ${package}"
289+
cat ${GITHUB_WORKSPACE}/fntests.log
290+
echo "::endgroup::"
291+
fi
292+
done
293+
294+
- name: analyze test suite results
295+
# Make sure the test summary lists 0 "FAIL"s and no "REGRESSION"
296+
run: |
297+
[ -n "$(grep -e "FAIL\s*0" ./test-suite.log)" ] || exit 1
298+
[ -z "$(grep -e "REGRESSION" ./test-suite.log)" ] || exit 1
299+
echo No unknown failing tests.

0 commit comments

Comments
 (0)