Skip to content

Commit 2343e75

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 2343e75

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

.github/workflows/crosscompile.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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+
# Add arm64 sources from ports.ubuntu.com
62+
printf '%s\n' \
63+
"Types: deb" \
64+
"URIs: http://ports.ubuntu.com/" \
65+
"Suites: noble noble-updates" \
66+
"Components: main universe" \
67+
"Architectures: ${{ matrix.arch }}" \
68+
| sudo tee /etc/apt/sources.list.d/ports-${{ matrix.arch }}.sources
69+
sudo apt-get update -qq || :
70+
sudo apt-get install --no-install-recommends -qq -y \
71+
crossbuild-essential-${{ matrix.arch }} \
72+
libssl-dev:${{ matrix.arch }} \
73+
libyaml-dev:${{ matrix.arch }} \
74+
zlib1g-dev:${{ matrix.arch }} \
75+
libffi-dev:${{ matrix.arch }} \
76+
libreadline-dev:${{ matrix.arch }} \
77+
libncurses-dev:${{ matrix.arch }} \
78+
autoconf ruby
79+
80+
- name: Build baseruby
81+
run: |
82+
mkdir ../baseruby
83+
cd ../baseruby
84+
../src/configure --prefix=$PWD/install --disable-install-doc
85+
make
86+
make install
87+
88+
- name: Run configure
89+
run: >-
90+
../src/configure -C --disable-install-doc
91+
--prefix=/usr
92+
--build=x86_64-linux-gnu
93+
--host=${{ matrix.host }}
94+
--with-baseruby=$PWD/../baseruby/install/bin/ruby
95+
96+
- run: make
97+
98+
- run: make install DESTDIR=$PWD/install
99+
100+
- name: Verify cross-compiled binary
101+
run: |
102+
file install/usr/bin/ruby
103+
file install/usr/bin/ruby | grep -q '${{ matrix.host }}\|aarch64'
104+
105+
- uses: ./.github/actions/slack
106+
with:
107+
label: cross ${{ matrix.host }}
108+
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
109+
if: ${{ failure() }}
110+
111+
defaults:
112+
run:
113+
working-directory: build

0 commit comments

Comments
 (0)