-
Notifications
You must be signed in to change notification settings - Fork 85
208 lines (179 loc) · 6.63 KB
/
package_for_test.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Package Neuron for Test
on:
issue_comment:
types: [created, edited]
push:
jobs:
packaging:
if: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/package')) || github.event_name == 'push' }}
strategy:
matrix:
node:
- 18.12.0
os:
- macos-latest
- ubuntu-20.04
- windows-2019
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}(Node.js ${{ matrix.node }})
env:
MAC_SHOULD_CODE_SIGN: ${{ github.event_name != 'pull_request' && secrets.APPLE_ID != '' }}
WIN_CERTIFICATE_BASE64: ${{ secrets.WIN_CERTIFICATE_BASE64 }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout for push
uses: actions/checkout@v3
if: ${{ github.event_name == 'push' }}
- name: Checkout for PR
uses: actions/checkout@v3
if: ${{ github.event_name == 'issue_comment' }}
with:
ref: refs/pull/${{ github.event.issue.number }}/merge
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: "yarn"
- name: Restore
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: 2022-12-21-${{ runner.os }}-${{ hashFiles('**/yarn.lock')}}
- name: Add msbuild to PATH
if: matrix.os == 'windows-2019'
uses: microsoft/[email protected]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true"
- name: Install libudev
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev
- name: Install Lerna
run: yarn global add lerna
- name: Bootstrap
run: |
yarn
env:
CI: false
- name: Package for MacOS
if: ${{ matrix.os == 'macos-latest' && env.MAC_SHOULD_CODE_SIGN == 'true' }}
run: |
./scripts/download-ckb.sh mac
yarn package:test mac
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
CSC_LINK: ${{ secrets.MAC_CERTIFICATE_BASE64 }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
TEAM_ID: ${{ secrets.TEAM_ID }}
- name: Package for MacOS for skip code sign
if: ${{ matrix.os == 'macos-latest' && env.MAC_SHOULD_CODE_SIGN == 'false' }}
run: |
export CSC_IDENTITY_AUTO_DISCOVERY=false
./scripts/download-ckb.sh mac
yarn package:test mac
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SKIP_NOTARIZE: true
- name: Package for Windows
if: ${{ matrix.os == 'windows-2019' && env.WIN_CERTIFICATE_BASE64 != '' }}
run: |
bash ./scripts/download-ckb.sh win
yarn build
bash ./scripts/copy-ui-files.sh
bash ./scripts/package-for-test.sh win
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: ${{ secrets.WIN_CERTIFICATE_BASE64 }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CERTIFICATE_PASSWORD }}
- name: Package for Windows for skip code sign
if: ${{ matrix.os == 'windows-2019' && env.WIN_CERTIFICATE_BASE64 == '' }}
run: |
bash ./scripts/download-ckb.sh win
yarn build
bash ./scripts/copy-ui-files.sh
bash ./scripts/package-for-test.sh win
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Package for Linux
if: matrix.os == 'ubuntu-20.04'
run: |
./scripts/download-ckb.sh
yarn package:test linux
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Neuron App Zip
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: Neuron-Mac-x64
path: release/Neuron-*-mac-x64.zip
- name: Upload Neuron App Zip(arm64)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: Neuron-Mac-arm64
path: release/Neuron-*-mac-arm64.zip
- name: Upload Neuron Dmg
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: Neuron-Dmg-x64
path: release/Neuron-*-x64.dmg
- name: Upload Neuron Dmg(arm64)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: Neuron-Dmg-arm64
path: release/Neuron-*-arm64.dmg
- name: Upload Neuron Win
if: matrix.os == 'windows-2019'
uses: actions/upload-artifact@v3
with:
name: Neuron-Win
path: release/Neuron-*-setup.exe
- name: Upload Neuron Linux
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: Neuron-Linux
path: release/Neuron-*.AppImage
comment_when_package_success:
needs: [packaging]
name: Append links to the Pull Request
runs-on: ubuntu-latest
steps:
- name: Comment by push event
if: ${{ github.event_name == 'push' }}
uses: peter-evans/commit-comment@v2
with:
body: |
Packaging for test is done in [${{ github.run_id }}](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})
- name: Comment by pull request comment event
if: ${{ github.event_name == 'issue_comment' }}
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ github.event.comment.id }}
body: |
Packaging for test is done in [${{ github.run_id }}](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). @${{ github.event.comment.user.login }}
edit-mode: append
comment_when_package_failed:
needs: [packaging]
if: ${{ always() && needs.packaging.result == 'failure' }}
name: Append failed comment to the comment
runs-on: ubuntu-latest
steps:
- name: Comment by pull request comment event when package failed
if: ${{ github.event_name == 'issue_comment' }}
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ github.event.comment.id }}
body: Packageing failed in [${{ github.run_id }}](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). @${{ github.event.comment.user.login }}
edit-mode: append