Skip to content

Commit 4502feb

Browse files
committed
Update from the newest template.
1 parent 9b5a872 commit 4502feb

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

.github/workflows/many-platforms.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,3 +886,42 @@ jobs:
886886
${{ env.package }}-*/build/callback/minitests*.output.*
887887
retention-days: 7
888888
overwrite: true
889+
# This is not a platform-specific test, but very useful for finding cross-compilation bugs.
890+
check-cross:
891+
name: make check with a cross-compiler
892+
needs: build-tarball
893+
runs-on: ubuntu-22.04
894+
steps:
895+
# This is needed because we run a script stored in this repository.
896+
- uses: actions/checkout@v4
897+
# Download the artifact to $GITHUB_WORKSPACE.
898+
# Doc: https://github.com/actions/download-artifact?tab=readme-ov-file#usage
899+
- uses: actions/download-artifact@v4
900+
with:
901+
name: tarball
902+
- run: uname -a
903+
- run: id
904+
- run: env | LC_ALL=C sort
905+
- run: pwd
906+
# Install Ubuntu packages.
907+
# List of packages: https://packages.ubuntu.com/
908+
- run: sudo apt update; sudo apt install g++-riscv64-linux-gnu
909+
- run: |
910+
pwd
911+
export CPPFLAGS="-Wall"
912+
export CC="riscv64-linux-gnu-gcc"
913+
export CXX="riscv64-linux-gnu-g++"
914+
./build-on.sh '${{ env.package }}' '--host=riscv64-linux-gnu' 'make'
915+
# Doc: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
916+
# https://github.com/actions/upload-artifact?tab=readme-ov-file#usage
917+
- if: ${{ always() }}
918+
uses: actions/upload-artifact@v4
919+
with:
920+
name: logs-cross
921+
path: |
922+
${{ env.package }}-*/build/config.cache
923+
${{ env.package }}-*/build/config.log
924+
${{ env.package }}-*/build/config.status
925+
${{ env.package }}-*/build/log[12]
926+
retention-days: 7
927+
overwrite: true

build-on.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
# Copyright (C) 2024 Free Software Foundation, Inc.
3+
# Copyright (C) 2024-2025 Free Software Foundation, Inc.
44
#
55
# This file is free software: you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License as published
@@ -24,6 +24,11 @@ make="$3"
2424

2525
set -x
2626

27+
case "$configure_options" in
28+
--host=riscv*) cross_compiling=true ;;
29+
*) cross_compiling=false ;;
30+
esac
31+
2732
# Unpack the tarball.
2833
tarfile=`echo "$package"-*.tar.gz`
2934
packagedir=`echo "$tarfile" | sed -e 's/\.tar\.gz$//'`
@@ -39,7 +44,9 @@ cd build
3944
# Build.
4045
$make > log2 2>&1; rc=$?; cat log2; test $rc = 0 || exit 1
4146

42-
# Run the tests.
43-
$make check > log3 2>&1; rc=$?; cat log3; test $rc = 0 || exit 1
47+
if ! $cross_compiling; then
48+
# Run the tests.
49+
$make check > log3 2>&1; rc=$?; cat log3; test $rc = 0 || exit 1
50+
fi
4451

4552
cd ..

0 commit comments

Comments
 (0)