Build on GH Actions. Set up nightly.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta
2020-05-14 14:03:17 +02:00
parent d9a866579c
commit 6bb852c613
19 changed files with 1246 additions and 1100 deletions

View File

@@ -1,13 +0,0 @@
const os = require('os');
const path = require('path');
// To be able to propagate the `process.versions.electron` to the backend main, so that we can load natives correctly.
process.env.THEIA_ELECTRON_VERSION = process.versions.electron;
process.env.THEIA_DEFAULT_PLUGINS = `local-dir:${path.resolve(__dirname, '..', 'plugins')}`;
process.env.THEIA_PLUGINS = [
process.env.THEIA_PLUGINS,
`local-dir:${path.resolve(os.homedir(), '.arduinoProIDE', 'plugins')}`
].filter(Boolean).join(',');
require('../src-gen/frontend/electron-main.js');

View File

@@ -0,0 +1,24 @@
const isCI = require('is-ci');
const { notarize } = require('electron-notarize');
exports.default = async function notarizing(context) {
if (!isCI) {
console.log('Skipping notarization: not on CI.');
return;
}
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin') {
return;
}
const appName = context.packager.appInfo.productFilename;
const appBundleId = context.packager.config.appId;
console.log(`>>> Notarizing ${appBundleId} at ${appOutDir}/${appName}.app...`);
return await notarize({
appBundleId,
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.AC_USERNAME,
appleIdPassword: process.env.AC_PASSWORD,
});
};

View File

@@ -1,57 +0,0 @@
//@ts-check
// Patches the `src-gen/backend/main.js` so that the forked backend process has the `process.versions.electron` in the bundled electron app.
// https://github.com/eclipse-theia/theia/issues/7358#issue-583306096
const args = process.argv.slice(2);
if (!args.length) {
console.error(`Expected an argument pointing to the app folder. An app folder is where you have the package.json and src-gen folder.`);
process.exit(1);
}
if (args.length > 1) {
console.error(`Expected exactly one argument pointing to the app folder. Got multiple instead: ${JSON.stringify(args)}`);
process.exit(1);
}
const arg = args.shift();
if (!arg) {
console.error('App path was not specified.');
process.exit(1);
}
const fs = require('fs');
const path = require('path');
const appPath = path.resolve((path.isAbsolute(arg) ? path.join(process.cwd(), arg) : arg));
if (!fs.existsSync(appPath)) {
console.error(`${appPath} does not exist.`);
process.exit(1);
}
if (!fs.lstatSync(appPath).isDirectory()) {
console.error(`${appPath} is not a directory.`);
process.exit(1);
}
const patched = path.join(appPath, 'src-gen', 'backend', 'original-main.js');
if (fs.existsSync(patched)) {
console.error(`Already patched. ${patched} already exists.`);
process.exit(1);
}
const toPatch = path.join(appPath, 'src-gen', 'backend', 'main.js');
if (fs.existsSync(patched)) {
console.error(`Cannot patch. ${toPatch} does not exist.`);
process.exit(1);
}
console.log(`⏱️ >>> Patching ${toPatch}...`);
const originalContent = fs.readFileSync(toPatch, { encoding: 'utf8' });
const patchedContent = `if (typeof process.versions.electron === 'undefined' && typeof process.env.THEIA_ELECTRON_VERSION === 'string') {
process.versions.electron = process.env.THEIA_ELECTRON_VERSION;
}
require('./original-main');
`
fs.writeFileSync(patched, originalContent);
fs.writeFileSync(toPatch, patchedContent);
console.log(`👌 <<< Patched ${toPatch}. Original 'main.js' is now at ${patched}.`);