Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arm64 Linux version of client #2342

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/build_and_test_debug_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,41 @@ jobs:
- name: Build Linux Client
run: npm run action client/electron/build linux

linux_arm64_debug_build:
name: Linux arm64 Debug Build
runs-on: ubuntu-24.04-arm
timeout-minutes: 20
needs: [web_test, backend_test]
steps:
- name: Checkout
uses: actions/checkout@v2.3.4

- name: Install Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: ./package-lock.json

- name: Install NPM Dependencies
run: |
sudo apt update && sudo apt install chromium-browser
npm ci

- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: '${{ github.workspace }}/go.mod'

- name: Build Linux Client
# electron-builder has no arm64 version fpm, so install it from
# gem and force to use system one. Based on this workaround:
# https://github.com/jordansissel/fpm/issues/1801#issuecomment-919877499
run: |
sudo gem install fpm
export USE_SYSTEM_FPM=true
npm run action client/electron/build linux -- --arch arm64

windows_debug_build:
name: Windows Debug Build
runs-on: windows-2019
Expand Down
15 changes: 13 additions & 2 deletions client/build/get_build_parameters.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@

import minimist from 'minimist';

const VALID_PLATFORMS = ['linux', 'windows', 'ios', 'macos', 'maccatalyst', 'android', 'browser'];
const VALID_PLATFORMS = [
'linux',
'windows',
'ios',
'macos',
'maccatalyst',
'android',
'browser',
];
const VALID_BUILD_MODES = ['debug', 'release'];

const MS_PER_HOUR = 1000 * 60 * 60;
Expand All @@ -33,6 +41,7 @@ export function getBuildParameters(cliArguments) {
verbose = false,
versionName = '0.0.0',
sentryDsn = process.env.SENTRY_DSN,
arch = '',
} = minimist(cliArguments);

if (platform && !VALID_PLATFORMS.includes(platform)) {
Expand All @@ -53,8 +62,10 @@ export function getBuildParameters(cliArguments) {
platform,
buildMode,
verbose,
versionName: buildMode === 'release' ? versionName : `${versionName}-${buildMode}`,
versionName:
buildMode === 'release' ? versionName : `${versionName}-${buildMode}`,
sentryDsn,
buildNumber: Math.floor(Date.now() / MS_PER_HOUR),
arch,
};
}
8 changes: 3 additions & 5 deletions client/electron/electron-builder.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"productName": "Outline",
"artifactName": "Outline-Client.${ext}",
"artifactName": "Outline-Client-${arch}.${ext}",
"asarUnpack": [ "client" ],
"directories": {
"buildResources": "output/client/electron",
Expand Down Expand Up @@ -37,11 +37,9 @@
"maintainer": "Jigsaw LLC",
"target": [{
"arch": [
"x64"
"x64",
"arm64"
q4a marked this conversation as resolved.
Show resolved Hide resolved
],
"target": "AppImage"
}, {
"arch": "x64",
"target": "deb"
}]
},
Expand Down
4 changes: 4 additions & 0 deletions client/go/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ tasks:
desc: "Build the tun2socks binary and library for Linux"
cmds: [{task: electron, vars: {TARGET_OS: "linux", TARGET_ARCH: "amd64"}}]

linux_arm64:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried to build it from macOS, will this work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any macOS hw, so I can't check this

desc: "Build the tun2socks binary and library for Linux"
cmds: [{task: electron, vars: {TARGET_OS: "linux", TARGET_ARCH: "arm64"}}]

android:
desc: "Build the tun2socks.aar library for Android"
vars:
Expand Down
13 changes: 11 additions & 2 deletions client/go/build.action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ import {getBuildParameters} from '../build/get_build_parameters.mjs';
* @param {string[]} parameters
*/
export async function main(...parameters) {
const {platform: targetPlatform} = getBuildParameters(parameters);
await spawnStream('go', 'run', 'github.com/go-task/task/v3/cmd/task', '-v', `client:tun2socks:${targetPlatform}`);
const {platform: targetPlatform, arch: targetArch} =
getBuildParameters(parameters);
const targetName =
targetArch !== '' ? `${targetPlatform}_${targetArch}` : targetPlatform;
await spawnStream(
'go',
'run',
'github.com/go-task/task/v3/cmd/task',
'-v',
`client:tun2socks:${targetName}`
);
}

if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
Expand Down