mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
BRE-536/Add-ARM-targz-builds-for-desktop-and-cli (#14270)
* Test ARM64 build * Remove sudo * Change to public preview runner * Change cache key for architectures * Test * Test * Test * remove x86 musl target - troubleshooting build error * native module troubleshooting * remove cross-platform for testing * attempt to resolve cross-platform issue * support more arm64 build types * fix missed amd to arm update * missing dependency during env setup * lxd troubleshooting * install lxd with snap instead * electron-builder debug * simplified script for testing * testing * 22.04 to 20.04 * try ubuntu 24.04 runner * add dist script * update build command * troubleshoot 24.04 compatibility * remove lxd before merging main * add comment, bump arm runner down to 22.04 * revert to tar.gz support only for this PR * testing cli arm builds * fix build target designation * adjust runner designation * runner name typo * not needed currently * adjust build.js logic and call in workflow * address styling feedback and unnecessary rust toolchain call * simplify build cli os matrix * revert x86 linux builds to cross-platform command for build.js --------- Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,10 @@ const child_process = require("child_process");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const process = require("process");
|
||||
const args = process.argv.slice(2); // Get arguments passed to the script
|
||||
const mode = args.includes("--release") ? "release" : "debug";
|
||||
const targetArg = args.find(arg => arg.startsWith("--target="));
|
||||
const target = targetArg ? targetArg.split("=")[1] : null;
|
||||
|
||||
let crossPlatform = process.argv.length > 2 && process.argv[2] === "cross-platform";
|
||||
|
||||
@@ -18,10 +22,17 @@ function buildProxyBin(target, release = true) {
|
||||
return child_process.execSync(`cargo build --bin desktop_proxy ${releaseArg} ${targetArg}`, {stdio: 'inherit', cwd: path.join(__dirname, "proxy")});
|
||||
}
|
||||
|
||||
if (!crossPlatform) {
|
||||
console.log("Building native modules in debug mode for the native architecture");
|
||||
buildNapiModule(false, false);
|
||||
buildProxyBin(false, false);
|
||||
if (!crossPlatform && !target) {
|
||||
console.log(`Building native modules in ${mode} mode for the native architecture`);
|
||||
buildNapiModule(false, mode === "release");
|
||||
buildProxyBin(false, mode === "release");
|
||||
return;
|
||||
}
|
||||
|
||||
if (target) {
|
||||
console.log(`Building for target: ${target} in ${mode} mode`);
|
||||
buildNapiModule(target, mode === "release");
|
||||
buildProxyBin(target, mode === "release");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,7 +58,8 @@ switch (process.platform) {
|
||||
|
||||
default:
|
||||
targets = [
|
||||
['x86_64-unknown-linux-musl', 'x64']
|
||||
['x86_64-unknown-linux-musl', 'x64'],
|
||||
['aarch64-unknown-linux-musl', 'arm64']
|
||||
];
|
||||
|
||||
process.env["PKG_CONFIG_ALLOW_CROSS"] = "1";
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"pack:dir": "npm run clean:dist && electron-builder --dir -p never",
|
||||
"pack:lin:flatpak": "npm run clean:dist && electron-builder --dir -p never && flatpak-builder --repo=build/.repo build/.flatpak ./resources/com.bitwarden.desktop.devel.yaml --install-deps-from=flathub --force-clean && flatpak build-bundle ./build/.repo/ ./dist/com.bitwarden.desktop.flatpak com.bitwarden.desktop",
|
||||
"pack:lin": "npm run clean:dist && electron-builder --linux --x64 -p never && export SNAP_FILE=$(realpath ./dist/bitwarden_*.snap) && unsquashfs -d ./dist/tmp-snap/ $SNAP_FILE && mkdir -p ./dist/tmp-snap/meta/polkit/ && cp ./resources/com.bitwarden.desktop.policy ./dist/tmp-snap/meta/polkit/polkit.com.bitwarden.desktop.policy && rm $SNAP_FILE && snapcraft pack ./dist/tmp-snap/ && mv ./*.snap ./dist/ && rm -rf ./dist/tmp-snap/",
|
||||
"pack:lin:arm64": "npm run clean:dist && electron-builder --dir -p never && tar -czvf ./dist/bitwarden_desktop_arm64.tar.gz -C ./dist/linux-arm64-unpacked/ .",
|
||||
"pack:mac": "npm run clean:dist && electron-builder --mac --universal -p never",
|
||||
"pack:mac:arm64": "npm run clean:dist && electron-builder --mac --arm64 -p never",
|
||||
"pack:mac:mas": "npm run clean:dist && electron-builder --mac mas --universal -p never",
|
||||
@@ -45,6 +46,7 @@
|
||||
"pack:win:ci": "npm run clean:dist && electron-builder --win --x64 --arm64 --ia32 -p never",
|
||||
"dist:dir": "npm run build && npm run pack:dir",
|
||||
"dist:lin": "npm run build && npm run pack:lin",
|
||||
"dist:lin:arm64": "npm run build && npm run pack:lin:arm64",
|
||||
"dist:mac": "npm run build && npm run pack:mac",
|
||||
"dist:mac:mas": "npm run build && npm run pack:mac:mas",
|
||||
"dist:mac:masdev": "npm run build && npm run pack:mac:masdev",
|
||||
|
||||
Reference in New Issue
Block a user