Skip to content

Commit 6dcb554

Browse files
hsbtclaude
andcommitted
Add cross-compile workflow for out-of-source ARM build testing
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f045c1a commit 6dcb554

1 file changed

Lines changed: 110 additions & 0 deletions

File tree

.github/workflows/crosscompile.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Cross compile
2+
on:
3+
push:
4+
paths-ignore:
5+
- 'doc/**'
6+
- '**/man/*'
7+
- '**.md'
8+
- '**.rdoc'
9+
- '**/.document'
10+
- '.*.yml'
11+
pull_request:
12+
# Do not use paths-ignore for required status checks
13+
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks
14+
merge_group:
15+
16+
concurrency:
17+
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
18+
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
make:
25+
strategy:
26+
matrix:
27+
include:
28+
- host: aarch64-linux-gnu
29+
arch: arm64
30+
fail-fast: false
31+
32+
env:
33+
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
34+
35+
runs-on: ubuntu-24.04
36+
37+
if: >-
38+
${{!(false
39+
|| contains(github.event.head_commit.message, '[DOC]')
40+
|| contains(github.event.pull_request.title, '[DOC]')
41+
|| contains(github.event.pull_request.labels.*.name, 'Documentation')
42+
|| (github.event.pull_request.user.login == 'dependabot[bot]')
43+
)}}
44+
45+
steps:
46+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
47+
with:
48+
sparse-checkout-cone-mode: false
49+
sparse-checkout: /.github
50+
persist-credentials: false
51+
52+
- uses: ./.github/actions/setup/directories
53+
with:
54+
srcdir: src
55+
builddir: build
56+
makeup: true
57+
58+
- name: Install cross-compilation toolchain
59+
run: |
60+
sudo dpkg --add-architecture ${{ matrix.arch }}
61+
cat <<'EOS' | sudo tee /etc/apt/sources.list.d/ports-${{ matrix.arch }}.list
62+
deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ noble main universe
63+
deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ noble-updates main universe
64+
deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ noble-security main universe
65+
EOS
66+
sudo apt-get update -qq || :
67+
sudo apt-get install --no-install-recommends -qq -y \
68+
crossbuild-essential-${{ matrix.arch }} \
69+
libssl-dev:${{ matrix.arch }} \
70+
libyaml-dev:${{ matrix.arch }} \
71+
zlib1g-dev:${{ matrix.arch }} \
72+
libffi-dev:${{ matrix.arch }} \
73+
libreadline-dev:${{ matrix.arch }} \
74+
libncurses-dev:${{ matrix.arch }} \
75+
autoconf ruby
76+
77+
- name: Build baseruby
78+
run: |
79+
mkdir ../baseruby
80+
cd ../baseruby
81+
../src/configure --prefix=$PWD/install --disable-install-doc
82+
make
83+
make install
84+
85+
- name: Run configure
86+
run: >-
87+
../src/configure -C --disable-install-doc
88+
--prefix=/usr
89+
--build=x86_64-linux-gnu
90+
--host=${{ matrix.host }}
91+
--with-baseruby=$PWD/../baseruby/install/bin/ruby
92+
93+
- run: make
94+
95+
- run: make install DESTDIR=$PWD/install
96+
97+
- name: Verify cross-compiled binary
98+
run: |
99+
file install/usr/bin/ruby
100+
file install/usr/bin/ruby | grep -q '${{ matrix.host }}\|aarch64'
101+
102+
- uses: ./.github/actions/slack
103+
with:
104+
label: cross ${{ matrix.host }}
105+
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
106+
if: ${{ failure() }}
107+
108+
defaults:
109+
run:
110+
working-directory: build

0 commit comments

Comments
 (0)