Skip to content

Commit 6bb852c

Browse files
author
Akos Kitta
committed
Build on GH Actions. Set up nightly.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
1 parent d9a8665 commit 6bb852c

19 files changed

+1281
-1135
lines changed

.github/workflows/build.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Arduino Pro IDE
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- 'v[0-9]+.[0-9]+.[0-9]+*'
9+
pull_request:
10+
branches:
11+
- master
12+
schedule:
13+
- cron: '0 3 * * *' # run every day at 3AM (https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
14+
15+
env:
16+
IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.head_ref == 'gh-actions' }} # TODO: remove OR once PR is merged.
17+
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }}
18+
19+
jobs:
20+
build:
21+
strategy:
22+
matrix:
23+
config:
24+
- os: windows-2016
25+
- os: ubuntu-latest
26+
- os: turin-macmini # self-hosted macOS
27+
28+
runs-on: ${{ matrix.config.os }}
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v2
33+
34+
- name: Install Node.js 10.x
35+
uses: actions/setup-node@v1
36+
with:
37+
node-version: '10.x'
38+
registry-url: 'https://registry.npmjs.org'
39+
40+
- name: Install Python 2.7
41+
uses: actions/setup-python@v2
42+
with:
43+
python-version: '2.7'
44+
45+
- name: Build
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
49+
run: yarn
50+
51+
- name: Test
52+
run: yarn test
53+
54+
- name: Package
55+
shell: bash
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/Microsoft/vscode/issues/28434#issuecomment-346199674
59+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
60+
AC_USERNAME: ${{ secrets.AC_USERNAME }}
61+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
62+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
63+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
64+
run: |
65+
if [ "$RUNNER_OS" == "macOS" ]; then
66+
echo ">>> Detected macOS runner. Updating keychain for the app signing..."
67+
echo "${{ secrets.KEYCHAIN }}" | base64 --decode > ~/Library/Keychains/apple-developer.keychain-db
68+
security list-keychains -s ~/Library/Keychains/apple-developer.keychain-db
69+
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" ~/Library/Keychains/apple-developer.keychain-db
70+
echo "<<< The keychain has been successfully updated."
71+
fi
72+
yarn --cwd ./electron/packager/
73+
yarn --cwd ./electron/packager/ package
74+
75+
- name: Upload [GitHub Actions]
76+
uses: actions/upload-artifact@v2
77+
with:
78+
name: ${{ runner.os }}
79+
path: electron/build/dist/build-artifacts/
80+
81+
- name: Upload [S3]
82+
if: env.IS_NIGHTLY == 'true'
83+
uses: kittaakos/upload-s3-action@v0.0.1
84+
with:
85+
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
86+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
87+
aws_bucket: ${{ secrets.DOWNLOADS_BUCKET }}
88+
source_dir: electron/build/dist/build-artifacts/
89+
destination_dir: arduino-pro-ide/nightly/

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{
1414
"type": "node",
1515
"request": "launch",
16-
"name": "Launch Electron Packager",
16+
"name": "Electron Packager",
1717
"program": "${workspaceRoot}/electron/packager/index.js",
1818
"cwd": "${workspaceFolder}/electron/packager"
1919
},

arduino-ide-extension/scripts/generate-protocol.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
}
3636
}
3737

38-
shell.echo('Generating TS/JS API from:');
38+
shell.echo('>>> Generating TS/JS API from:');
3939
if (shell.exec(`git -C ${repository} rev-parse --abbrev-ref HEAD`).code !== 0) {
4040
shell.exit(1);
4141
}
@@ -83,6 +83,6 @@ ${protos.join(' ')}`).code !== 0) {
8383
shell.exit(1);
8484
}
8585

86-
shell.echo('Done.');
86+
shell.echo('<<< Generation was successful.');
8787

8888
})();
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { join } from 'path';
22
import { homedir } from 'os';
33
import { injectable } from 'inversify';
4-
import { EnvVariablesServerImpl } from '@theia/core/lib/node/env-variables/env-variables-server';
54
import { FileUri } from '@theia/core/lib/node/file-uri';
5+
import { EnvVariablesServerImpl } from '@theia/core/lib/node/env-variables/env-variables-server';
6+
import { BackendApplicationConfigProvider } from '@theia/core/lib/node/backend-application-config-provider';
67

78
@injectable()
89
export class ArduinoEnvVariablesServer extends EnvVariablesServerImpl {
910

10-
protected readonly configDirUri = FileUri.create(join(homedir(), '.arduinoProIDE')).toString();
11+
protected readonly configDirUri = FileUri.create(join(homedir(), BackendApplicationConfigProvider.get().configDirName)).toString();
1112

1213
}

azure-pipelines.yml

Lines changed: 0 additions & 81 deletions
This file was deleted.

electron-app/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
}
4545
}
4646
},
47+
"backend": {
48+
"config": {
49+
"configDirName": ".arduinoProIDE"
50+
}
51+
},
4752
"generator": {
4853
"config": {
4954
"preloadTemplate": "<div class='theia-preload' style='background-color: rgb(237, 241, 242);'></div>"

electron/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ One has to manually publish the GitHub release.
4848

4949
- Select `Publish release`.
5050
-
51+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-jit</key>
6+
<true/>
7+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
8+
<true/>
9+
<key>com.apple.security.cs.disable-library-validation</key>
10+
<true/>
11+
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
12+
<true/>
13+
</dict>
14+
</plist>

electron/build/scripts/arduino-pro-ide-electron-main.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

electron/build/scripts/notarize.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const isCI = require('is-ci');
2+
const { notarize } = require('electron-notarize');
3+
4+
exports.default = async function notarizing(context) {
5+
if (!isCI) {
6+
console.log('Skipping notarization: not on CI.');
7+
return;
8+
}
9+
const { electronPlatformName, appOutDir } = context;
10+
if (electronPlatformName !== 'darwin') {
11+
return;
12+
}
13+
14+
const appName = context.packager.appInfo.productFilename;
15+
const appBundleId = context.packager.config.appId;
16+
console.log(`>>> Notarizing ${appBundleId} at ${appOutDir}/${appName}.app...`);
17+
18+
return await notarize({
19+
appBundleId,
20+
appPath: `${appOutDir}/${appName}.app`,
21+
appleId: process.env.AC_USERNAME,
22+
appleIdPassword: process.env.AC_PASSWORD,
23+
});
24+
};

electron/build/scripts/patch-backend-main.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)