Skip to content

Commit 5e1cb96

Browse files
authored
Auto-detect arm64 in github action (#300)
Follow up to PR #298 - make `sublime-text-arch` optional and auto-detect arch if not provided - install arch-matching build of ST - test ARM variant in CI
1 parent d4871a3 commit 5e1cb96

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

‎.github/workflows/test.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
matrix:
2525
st-version: [3, 4]
2626
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
27+
include:
28+
- st-version: 4
29+
os: "ubuntu-26.04-arm"
2730
runs-on: ${{ matrix.os }}
2831
steps:
2932
- uses: actions/checkout@v6

‎actions/setup/action.yaml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ inputs:
99
required: true
1010
default: 4
1111
sublime-text-arch:
12-
description: Sublime Text Version Arch. It could be x32 for Sublime Text 3.
13-
required: true
14-
default: x64
12+
description: >-
13+
Sublime Text build architecture: x64, arm64 (Linux, Sublime Text 4) or x32 (Sublime Text 3).
14+
Detected from the runner if empty.
15+
required: false
16+
default: ''
1517
install-package:
1618
description: Whether to install the checked out package.
1719
required: true

‎actions/setup/install_sublime_text.ps1‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ param(
99

1010
$ErrorActionPreference = 'stop'
1111

12+
# Sublime Text has no Windows arm64 build; x64 runs under emulation there.
13+
if (-not $Arch) {
14+
$Arch = 'x64'
15+
}
16+
1217
$private:MaxRetries = 20
1318
if ($Version -ge 4) {
1419
$private:SublimeTextUrl = "http://www.sublimetext.com/download_thanks"

‎actions/setup/install_sublime_text.sh‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ if [ -z $SUBLIME_TEXT_VERSION ]; then
2828
fi
2929

3030
if [ -z $SUBLIME_TEXT_ARCH ]; then
31-
SUBLIME_TEXT_ARCH=x64
31+
case "$(uname -m)" in
32+
aarch64|arm64) SUBLIME_TEXT_ARCH=arm64 ;;
33+
*) SUBLIME_TEXT_ARCH=x64 ;;
34+
esac
3235
fi
3336

34-
if [ $SUBLIME_TEXT_VERSION -ge 4 ] && [ "$SUBLIME_TEXT_ARCH" != "x64" ]; then
37+
if [ $SUBLIME_TEXT_VERSION -ge 4 ] && [ "$SUBLIME_TEXT_ARCH" != "x64" ] && [ "$SUBLIME_TEXT_ARCH" != "arm64" ]; then
3538
echo "wrong value of $SUBLIME_TEXT_ARCH for Sublime Text version $SUBLIME_TEXT_VERSION"
3639
exit 1
3740
fi
@@ -126,7 +129,7 @@ else
126129
echo "installing sublime text $SUBLIME_TEXT_VERSION"
127130
for i in {1..20}; do
128131
if [ $SUBLIME_TEXT_VERSION -ge 4 ]; then
129-
URL=$(curl -s "$STWEB" | sed -n 's/.*href="\([^"]*_x64\.tar\.xz\)".*/\1/p')
132+
URL=$(curl -s "$STWEB" | sed -n "s/.*href=\"\([^\"]*_${SUBLIME_TEXT_ARCH}\.tar\.xz\)\".*/\1/p")
130133
else
131134
if [ "$SUBLIME_TEXT_ARCH" = "x64" ]; then
132135
URL=$(curl -s "$STWEB" | sed -n 's/.*href="\([^"]*x64\.tar\.bz2\)".*/\1/p')

0 commit comments

Comments
 (0)