Skip to content

Commit f8c1d15

Browse files
committed
ci: Try cross-building to aarch64-apple-darwin on GitHub Actions
1 parent f8bc103 commit f8c1d15

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@ jobs:
3535
# emacs-version: '27.2'
3636
- os: windows-2019
3737
emacs-version: '27.2'
38+
- os: macos-11
39+
emacs-version: '27.2'
40+
# Cross build
41+
target: aarch64-apple-darwin
3842
runs-on: ${{ matrix.os }}
3943
steps:
4044
- name: Set up Rust
4145
run: |
4246
rustup install stable
4347
rustc -Vv
4448
cargo -V
49+
- name: Set up Rust's cross-build target
50+
if: matrix.target
51+
run: |
52+
rustup target add ${{ matrix.target }}
4553
4654
- uses: purcell/setup-emacs@v3.0
4755
if: runner.os != 'Windows'
@@ -70,11 +78,13 @@ jobs:
7078
- run: .github/script/setup-cask
7179

7280
- run: bin/setup
73-
- run: bin/build
81+
- run: bin/build -target "${{ matrix.target }}"
7482

7583
- run: bin/inspect-binaries
7684
continue-on-error: true
7785

7886
- name: Install tree-sitter CLI
87+
if: ${{ !matrix.target }}
7988
run: npm install -g tree-sitter-cli@0.19.3
8089
- run: bin/test
90+
if: ${{ !matrix.target }}

bin/build

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ case $profile_ in
4848
(debug)
4949
;;
5050
(*)
51-
echo "Unknown profile $profile_"
51+
echo "!! Unknown profile $profile_"
5252
exit 1
5353
esac
5454
case $target in
@@ -59,18 +59,28 @@ case $target in
5959
('')
6060
;;
6161
(*)
62-
echo "Unsupport cross-build target $target"
62+
echo "!! Unsupport cross-build target $target"
6363
exit 1
6464
;;
6565
esac
6666

67+
echo "!! Building the dynamic module"
6768
(
6869
cd "$core_root"
6970
cargo build --all "${extra_args[@]}"
7071

7172
cp -f "$target_dir/$profile_/$MODULE_ORIGINAL" "$MODULE_RENAMED"
7273
version=$(cargo pkgid | cut -d'#' -f2 | cut -d: -f2)
7374
echo "$version".1 | tr -d $'\n' > DYN-VERSION
75+
)
76+
77+
echo "!! Building Lisp code"
78+
if [[ $target != '' ]]; then
79+
echo "!! Will skip building Lisp since this is a cross build"
80+
exit 0
81+
fi
82+
(
83+
cd "$core_root"
7484
cask build
7585
)
7686
(

bin/build.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ $module_name = "tsc_dyn"
88
$module_renamed = $module_name.replace("_", "-")
99
$core_root = "$project_root\core"
1010

11+
echo "!! Building the dynamic module"
1112
Push-Location $core_root
1213
try {
1314
switch ($profile) {
@@ -24,6 +25,7 @@ try {
2425
Pop-Location
2526
}
2627

28+
echo "!! Building Lisp code"
2729
Push-Location $project_root
2830
try {
2931
cask build

bin/inspect-binaries

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ PROJECT_ROOT=$(cd "$here/.."; pwd)
1010

1111
case $system in
1212
(Linux)
13+
echo ┌─────────────────────────────────────────────────────────────────────
14+
echo └ Dynamic module:
15+
file core/tsc-dyn.so
1316
ldd core/tsc-dyn.so
14-
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17+
echo ┌─────────────────────────────────────────────────────────────────────
18+
echo └ Emacs:
1519
ldd "$(which emacs)"
1620
;;
1721
(Darwin)
22+
echo ┌─────────────────────────────────────────────────────────────────────
23+
echo └ Dynamic module:
24+
file core/tsc-dyn.dylib
1825
otool -L core/tsc-dyn.dylib
19-
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26+
echo ┌─────────────────────────────────────────────────────────────────────
27+
echo └ Emacs:
2028
otool -L "$(which emacs)"
2129
;;
2230
(*)

0 commit comments

Comments
 (0)