mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Improve hak & build ia32 again by default (#369)
* Improve hak & build ia32 again by default * Test both x86_64 and i686 in CI * Improve macOS job name * Try other things * Iterating this is no fun * Attempt again * pwsh is the default, use cmd * Update the incantation for 2022 * Avoid warning multiple times * Consolidate build tool setup * Move default targets to electron-builder and fix warnings
This commit is contained in:
parent
ec62b8b2cf
commit
f1f659b6a0
31
.github/workflows/build.yaml
vendored
31
.github/workflows/build.yaml
vendored
@ -5,10 +5,18 @@ on:
|
|||||||
branches: [ develop, master ]
|
branches: [ develop, master ]
|
||||||
jobs:
|
jobs:
|
||||||
windows:
|
windows:
|
||||||
name: Windows
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: x86_64-pc-windows-msvc
|
||||||
|
arch: x64
|
||||||
|
- target: i686-pc-windows-msvc
|
||||||
|
arch: x86
|
||||||
|
build-args: --ia32
|
||||||
|
name: Windows (${{ matrix.arch }})
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Cache .hak
|
- name: Cache .hak
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
@ -17,11 +25,10 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
./.hak
|
./.hak
|
||||||
|
|
||||||
- name: Install nmake
|
- name: Set up build tools
|
||||||
uses: ilammy/msvc-dev-cmd@v1
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
with:
|
||||||
- name: Install Microsoft Build Tools
|
arch: ${{ matrix.arch }}
|
||||||
uses: microsoft/setup-msbuild@v1.1
|
|
||||||
|
|
||||||
# ActiveTCL package on choco is from 2015,
|
# ActiveTCL package on choco is from 2015,
|
||||||
# this one is newer but includes more than we need
|
# this one is newer but includes more than we need
|
||||||
@ -41,6 +48,7 @@ jobs:
|
|||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
@ -51,19 +59,18 @@ jobs:
|
|||||||
run: "yarn install --pure-lockfile"
|
run: "yarn install --pure-lockfile"
|
||||||
|
|
||||||
- name: Build Natives
|
- name: Build Natives
|
||||||
shell: pwsh
|
|
||||||
run: |
|
run: |
|
||||||
refreshenv
|
refreshenv
|
||||||
yarn build:native
|
yarn build:native --target ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Build App
|
- name: Build App
|
||||||
run: "yarn build --publish never"
|
run: "yarn build --publish never -w ${{ matrix.build-args }}"
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
name: Linux
|
name: Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Cache .hak
|
- name: Cache .hak
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
@ -92,10 +99,10 @@ jobs:
|
|||||||
run: "yarn build --publish never"
|
run: "yarn build --publish never"
|
||||||
|
|
||||||
macos:
|
macos:
|
||||||
name: macOS
|
name: macOS (universal)
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Cache .hak
|
- name: Cache .hak
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const { notarize } = require('electron-notarize');
|
const { notarize } = require('electron-notarize');
|
||||||
|
|
||||||
|
let warned = false;
|
||||||
exports.default = async function(context) {
|
exports.default = async function(context) {
|
||||||
const { electronPlatformName, appOutDir } = context;
|
const { electronPlatformName, appOutDir } = context;
|
||||||
const appId = context.packager.info.appInfo.id;
|
const appId = context.packager.info.appInfo.id;
|
||||||
@ -11,10 +12,13 @@ exports.default = async function(context) {
|
|||||||
// from the keychain, so we need to get it from the environment.
|
// from the keychain, so we need to get it from the environment.
|
||||||
const userId = process.env.NOTARIZE_APPLE_ID;
|
const userId = process.env.NOTARIZE_APPLE_ID;
|
||||||
if (userId === undefined) {
|
if (userId === undefined) {
|
||||||
|
if (!warned) {
|
||||||
console.log("*************************************");
|
console.log("*************************************");
|
||||||
console.log("* NOTARIZE_APPLE_ID is not set. *");
|
console.log("* NOTARIZE_APPLE_ID is not set. *");
|
||||||
console.log("* This build will NOT be notarised. *");
|
console.log("* This build will NOT be notarised. *");
|
||||||
console.log("*************************************");
|
console.log("*************************************");
|
||||||
|
warned = true;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,15 +46,19 @@ function computeSignToolArgs(options, keyContainer) {
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let warned = false;
|
||||||
exports.default = async function(options) {
|
exports.default = async function(options) {
|
||||||
const keyContainer = process.env.SIGNING_KEY_CONTAINER;
|
const keyContainer = process.env.SIGNING_KEY_CONTAINER;
|
||||||
if (keyContainer === undefined) {
|
if (keyContainer === undefined) {
|
||||||
|
if (!warned) {
|
||||||
console.warn(
|
console.warn(
|
||||||
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" +
|
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" +
|
||||||
"! Skipping Windows signing. !\n" +
|
"! Skipping Windows signing. !\n" +
|
||||||
"! SIGNING_KEY_CONTAINER not defined. !\n" +
|
"! SIGNING_KEY_CONTAINER not defined. !\n" +
|
||||||
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
|
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
|
||||||
);
|
);
|
||||||
|
warned = true;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ export default async function copy(hakEnv: HakEnv, moduleInfo: DependencyInfo):
|
|||||||
// (and if you set glob.cwd it just breaks because it can't find the files)
|
// (and if you set glob.cwd it just breaks because it can't find the files)
|
||||||
const oldCwd = process.cwd();
|
const oldCwd = process.cwd();
|
||||||
try {
|
try {
|
||||||
|
await mkdirp(moduleInfo.moduleOutDir);
|
||||||
process.chdir(moduleInfo.moduleOutDir);
|
process.chdir(moduleInfo.moduleOutDir);
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
rimraf(moduleInfo.cfg.prune, {}, err => {
|
rimraf(moduleInfo.cfg.prune, {}, err => {
|
||||||
|
@ -36,25 +36,21 @@ async function getRuntimeVersion(projectRoot: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default class HakEnv {
|
export default class HakEnv {
|
||||||
public target: Target;
|
public readonly target: Target;
|
||||||
public projectRoot: string;
|
|
||||||
public runtime: string;
|
public runtime: string;
|
||||||
public runtimeVersion: string;
|
public runtimeVersion: string;
|
||||||
public dotHakDir: string;
|
public dotHakDir: string;
|
||||||
|
|
||||||
constructor(prefix: string, targetId: TargetId) {
|
constructor(public readonly projectRoot: string, targetId: TargetId | null) {
|
||||||
let target;
|
|
||||||
if (targetId) {
|
if (targetId) {
|
||||||
target = TARGETS[targetId];
|
this.target = TARGETS[targetId];
|
||||||
} else {
|
} else {
|
||||||
target = getHost();
|
this.target = getHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target) {
|
if (!this.target) {
|
||||||
throw new Error(`Unknown target ${targetId}!`);
|
throw new Error(`Unknown target ${targetId}!`);
|
||||||
}
|
}
|
||||||
this.target = target;
|
|
||||||
this.projectRoot = prefix;
|
|
||||||
this.dotHakDir = path.join(this.projectRoot, '.hak');
|
this.dotHakDir = path.join(this.projectRoot, '.hak');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ async function main() {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetIds = [] as TargetId[];
|
const targetIds: TargetId[] = [];
|
||||||
// Apply `--target <target>` option if specified
|
// Apply `--target <target>` option if specified
|
||||||
// Can be specified multiple times for the copy command to bundle
|
// Can be specified multiple times for the copy command to bundle
|
||||||
// multiple archs into a single universal output module)
|
// multiple archs into a single universal output module)
|
||||||
@ -84,13 +84,13 @@ async function main() {
|
|||||||
}
|
}
|
||||||
const hakEnv = hakEnvs[0];
|
const hakEnv = hakEnvs[0];
|
||||||
|
|
||||||
const deps = {} as Record<string, DependencyInfo>;
|
const deps: Record<string, DependencyInfo> = {};
|
||||||
|
|
||||||
const hakDepsCfg = packageJson.hakDependencies || {};
|
const hakDepsCfg = packageJson.hakDependencies || {};
|
||||||
|
|
||||||
for (const dep of Object.keys(hakDepsCfg)) {
|
for (const dep of Object.keys(hakDepsCfg)) {
|
||||||
const hakJsonPath = path.join(prefix, 'hak', dep, 'hak.json');
|
const hakJsonPath = path.join(prefix, 'hak', dep, 'hak.json');
|
||||||
let hakJson;
|
let hakJson: Record<string, any>;
|
||||||
try {
|
try {
|
||||||
hakJson = await require(hakJsonPath);
|
hakJson = await require(hakJsonPath);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -125,7 +125,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmds;
|
let cmds: string[];
|
||||||
if (process.argv.length < 3) {
|
if (process.argv.length < 3) {
|
||||||
cmds = ['check', 'fetch', 'fetchDeps', 'build', 'copy', 'link'];
|
cmds = ['check', 'fetch', 'fetchDeps', 'build', 'copy', 'link'];
|
||||||
} else if (METACOMMANDS[process.argv[2]]) {
|
} else if (METACOMMANDS[process.argv[2]]) {
|
||||||
|
@ -94,22 +94,17 @@ const x8664UnknownLinuxGnu: Target = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const TARGETS: Record<TargetId, Target> = {
|
export const TARGETS: Record<TargetId, Target> = {
|
||||||
|
// macOS
|
||||||
'aarch64-apple-darwin': aarch64AppleDarwin,
|
'aarch64-apple-darwin': aarch64AppleDarwin,
|
||||||
'x86_64-apple-darwin': x8664AppleDarwin,
|
'x86_64-apple-darwin': x8664AppleDarwin,
|
||||||
'universal-apple-darwin': universalAppleDarwin,
|
'universal-apple-darwin': universalAppleDarwin,
|
||||||
|
// Windows
|
||||||
'i686-pc-windows-msvc': i686PcWindowsMsvc,
|
'i686-pc-windows-msvc': i686PcWindowsMsvc,
|
||||||
'x86_64-pc-windows-msvc': x8664PcWindowsMsvc,
|
'x86_64-pc-windows-msvc': x8664PcWindowsMsvc,
|
||||||
|
// Linux
|
||||||
'x86_64-unknown-linux-gnu': x8664UnknownLinuxGnu,
|
'x86_64-unknown-linux-gnu': x8664UnknownLinuxGnu,
|
||||||
};
|
};
|
||||||
|
|
||||||
// The set of targets we build by default, sorted by increasing complexity so
|
|
||||||
// that we fail fast when the native host target fails.
|
|
||||||
export const ENABLED_TARGETS: Target[] = [
|
|
||||||
TARGETS['universal-apple-darwin'],
|
|
||||||
TARGETS['x86_64-unknown-linux-gnu'],
|
|
||||||
TARGETS['x86_64-pc-windows-msvc'],
|
|
||||||
];
|
|
||||||
|
|
||||||
export function getHost(): Target {
|
export function getHost(): Target {
|
||||||
return Object.values(TARGETS).find(target => (
|
return Object.values(TARGETS).find(target => (
|
||||||
target.platform === process.platform &&
|
target.platform === process.platform &&
|
||||||
|
Loading…
Reference in New Issue
Block a user