-
Notifications
You must be signed in to change notification settings - Fork 6
233 lines (206 loc) · 7.63 KB
/
package_agent.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
name: Package Agent
'on':
push:
branches:
- master
- release
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for actions/checkout
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-22.04
- macos-13
- macos-14
- windows-2022
node-version:
- 20.9.0
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# - name: Cache
# id: cache-packages
# uses: actions/cache@v4
# with:
# path: node_modules
# key: new-${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- name: Install packages
if: steps.cache-packages.outputs.cache-hit != 'true'
run: npm ci
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
npm run build
node --experimental-sea-config sea-config.json
cp $(command -v node) agent
npx postject agent NODE_SEA_BLOB agent.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
chmod +x agent
mkdir bin
cp agent bin/cli-linux-x64
npm run afterbuild
ls -al bin
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'macos-13' }}
run: |
ls -al
npm run build
node --experimental-sea-config sea-config.json
cp $(command -v node) agent
codesign --remove-signature agent
npx postject agent NODE_SEA_BLOB agent.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
--macho-segment-name NODE_SEA
# codesign --sign - agent
mkdir bin
chmod +x agent
cp agent bin/cli-macos-x64
npm run afterbuild
ls -al bin
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'macos-14' }}
run: |
npm run build
node --experimental-sea-config sea-config.json
cp $(command -v node) agent
codesign --remove-signature agent
npx postject agent NODE_SEA_BLOB agent.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
--macho-segment-name NODE_SEA
# codesign --sign - agent
mkdir bin
chmod +x agent
cp agent bin/cli-macos-arm64
npm run afterbuild
ls -al bin
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'windows-2022' }}
run: |
npm run build
node --experimental-sea-config sea-config.json
node -e "require('fs').copyFileSync(process.execPath, 'agent.exe')"
# $signtool = "C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\signtool.exe"
# $signtool remove /s agent.exe
npx postject agent.exe NODE_SEA_BLOB agent.blob `
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
# $signtool sign /fd SHA256 agent.exe
# chmod +x agent
md bin -ea 0
cp agent.exe bin/cli-win-x64.exe
cp agent.exe bin/cli-win-x86.exe
npm run afterbuild
# ls -al
- name: Set BUILD_VERSION environment variable
run: echo "BUILD_VERSION=$(node -p "require('./package').version")" >> $GITHUB_ENV
shell: bash
- name: Upload Windows x64 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'windows-2022' }}
with:
name: katalon-agent-win-x64-${{ env.BUILD_VERSION }}
path: |
bin/cli-win-x64.exe
bin/nssm.exe
bin/*.bat
- name: Upload Windows x86 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'windows-2022' }}
with:
name: katalon-agent-win-x86-${{ env.BUILD_VERSION }}
path: |
bin/cli-win-x86.exe
bin/nssm.exe
bin/*.bat
- name: Upload Linux x64 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-22.04' }}
with:
name: katalon-agent-linux-x64-${{ env.BUILD_VERSION }}
path: |
bin/cli-linux-x64
bin/*.sh
- name: Upload MacOS x64 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'macos-13' }}
with:
name: katalon-agent-macos-x64-${{ env.BUILD_VERSION }}
path: |
bin/cli-macos-x64
bin/start.sh
- name: Upload MacOS ARM64 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'macos-14' }}
with:
name: katalon-agent-macos-arm64-${{ env.BUILD_VERSION }}
path: |
bin/cli-macos-arm64
bin/start.sh
deploy:
name: Deploy staging cloud agent
environment: staging
needs: build
strategy:
matrix:
node-version:
- 20.9.0
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: npm install --only dev
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/katalon-github-oidc-federation
role-session-name: github-actions
aws-region: ${{ vars.AWS_REGION }}
mask-aws-account-id: 'no'
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: .
- name: Add execute permission to downloaded artifacts
run: chmod +x katalon-agent-linux-*/* katalon-agent-macos-*/*
- name: Set BUILD_VERSION environment variable
run: echo "BUILD_VERSION=$(node -p "require('./package').version")" >> $GITHUB_ENV
- name: Package artifacts
env:
GZIP: -9
run: |
set -x
mkdir -p packages
ls -la
cp katalon-agent-linux-x64-$BUILD_VERSION/cli-linux-x64 packages/cli-linux-x64
zip -9 -j packages/katalon-agent-win-x64-$BUILD_VERSION.zip katalon-agent-win-x64-$BUILD_VERSION/*
zip -9 -j packages/katalon-agent-win-x86-$BUILD_VERSION.zip katalon-agent-win-x86-$BUILD_VERSION/*
zip -9 -j packages/katalon-agent-linux-x64-$BUILD_VERSION.zip katalon-agent-linux-x64-$BUILD_VERSION/*
zip -9 -j packages/katalon-agent-macos-x64-$BUILD_VERSION.zip katalon-agent-macos-x64-$BUILD_VERSION/*
zip -9 -j packages/katalon-agent-macos-arm64-$BUILD_VERSION.zip katalon-agent-macos-arm64-$BUILD_VERSION/*
cd katalon-agent-linux-x64-$BUILD_VERSION
tar cvzf ../packages/katalon-agent-linux-x64-$BUILD_VERSION.tar.gz *
cd ..
ls -laR
aws s3 sync packages/ s3://katalon-testops-agent-beta/$BUILD_VERSION --acl public-read