Skip to content

Commit 06b512b

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 06b512b

1 file changed

Lines changed: 105 additions & 0 deletions

File tree

.github/workflows/crosscompile.yml

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

0 commit comments

Comments
 (0)