-
Notifications
You must be signed in to change notification settings - Fork 14
172 lines (149 loc) · 5.22 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build
on: [push]
jobs:
lint:
name: 'Lint'
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: linter-node_modules-${{hashFiles('**/package-lock.json') }}
- name: Install dependencies
env:
JOBS: 'max'
run: npm install
- name: Run linter
run: npm run lint
build:
name: Build (${{ matrix.os }} - ${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Build for supported platforms
# https://github.com/electron/electron-packager/blob/ebcbd439ff3e0f6f92fa880ff28a8670a9bcf2ab/src/targets.js#L9
include:
- os: ubuntu-20.04
arch: arm64
- os: ubuntu-20.04
arch: x64
- os: macOS-11
arch: arm64
openssl_dir: '/tmp/openssl@1.1/1.1.1l_1'
- os: macOS-11
arch: x64
openssl_dir: '/usr/local/opt/openssl@1.1'
- os: windows-2019
arch: x64
openssl_dir: 'C:\Program Files\OpenSSL-Win64\'
# - os: ubuntu-20.04
# arch: armv7l
# - os: windows-2019
# arch: arm64
# openssl_dir: 'C:\Program Files\OpenSSL-Win64\'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ matrix.os }}-${{ matrix.arch }}-node_modules-${{hashFiles('**/package-lock.json') }}
- name: Install Build dependencies (macOS-arm64)
if: |
matrix.os == 'macOS-11'
&& matrix.arch == 'arm64'
run: |
curl -L -H "Authorization: Bearer QQ==" -o /tmp/openssl-1.1.1l_1-arm64.tar.gz https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:8f5b0bee61c1570b9f0fc0a21d6c322e904ae7975bdaada5787451d18e9677a6
tar -xvf /tmp/openssl-1.1.1l_1-arm64.tar.gz -C /tmp
- name: Install Build dependencies (Windows)
if: matrix.os == 'windows-2019'
run: choco install openssl
- name: Install Build dependencies (Ubuntu)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt update
sudo apt install libkrb5-dev
- name: Install dependencies
env:
JOBS: 'max'
npm_config_openssl_dir: ${{ matrix.openssl_dir }}
run: |
npm install
- name: Rebuild native modules
env:
JOBS: 'max'
npm_config_openssl_dir: ${{ matrix.openssl_dir }}
run: |
npm run rebuild:native-modules -- --arch=${{ matrix.arch }}
npm run prepare:nodegit
- name: Load Developer Certificates (macOS)
if: |
startsWith(github.ref, 'refs/tags/')
&& matrix.os == 'macOS-11'
env:
MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
run:
chmod +x scripts/setupMacOSCertificates.sh && ./scripts/setupMacOSCertificates.sh
- name: Compile and Sign
if: startsWith(github.ref, 'refs/tags/')
env:
npm_config_openssl_dir: ${{ matrix.openssl_dir }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
GMAIL_OAUTH_CLIENT_ID: ${{ secrets.GMAIL_OAUTH_CLIENT_ID }}
GMAIL_OAUTH_CLIENT_SECRET: ${{ secrets.GMAIL_OAUTH_CLIENT_SECRET }}
run:
npm run make -- --arch=${{ matrix.arch }}
- name: Compile
if: startsWith(github.ref, 'refs/tags/') == false
env:
npm_config_openssl_dir: ${{ matrix.openssl_dir }}
GMAIL_OAUTH_CLIENT_ID: ${{ secrets.GMAIL_OAUTH_CLIENT_ID }}
GMAIL_OAUTH_CLIENT_SECRET: ${{ secrets.GMAIL_OAUTH_CLIENT_SECRET }}
run: npm run make -- --arch=${{ matrix.arch }}
- name: Test
if: |
matrix.os != 'ubuntu-20.04'
&& matrix.arch == 'x64'
&& matrix.os != 'macOS-11'
&& matrix.os != 'windows-2019'
run: npm run test
- name: Test (Ubuntu)
if: |
matrix.os == 'ubuntu-20.04'
&& matrix.arch == 'x64'
run: xvfb-run --auto-servernum -- npm test
- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ matrix.arch }}
path: |
out/make
test/output
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: "out/make/**"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}