-
Notifications
You must be signed in to change notification settings - Fork 6
173 lines (143 loc) · 4.9 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
name: Package Agent
on:
push:
branches:
- master
- release
jobs:
### BUILD ###
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
node-version:
- 14.x
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- name: Cache
id: cache-packages
uses: actions/[email protected]
with:
path: node_modules
key: ${{ 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-latest' }}
run: |
npm run buildLinux --if-present
chmod +x bin/cli-linux-x64 *.sh
ls -l bin
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'macos-latest' }}
run: |
npm run buildMacos --if-present
chmod +x bin/cli-macos-x64 *.sh
ls -l bin
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'windows-latest' }}
run: npm run buildWin --if-present
- 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@v2
if: ${{ matrix.os == 'windows-latest' }}
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@v2
if: ${{ matrix.os == 'windows-latest' }}
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@v2
if: ${{ matrix.os == 'ubuntu-latest' }}
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@v2
if: ${{ matrix.os == 'macos-latest' }}
with:
name: katalon-agent-macos-x64-${{ env.BUILD_VERSION }}
path: |
bin/cli-macos-x64
bin/start.sh
### DEPLOY ###
deploy:
name: Deploy staging cloud agent
needs: build
strategy:
matrix:
node-version:
- 10.x
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: npm install --only dev
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.STAGING_AWS_API_KEY }}
aws-secret-access-key: ${{ secrets.STAGING_AWS_SECRET_KEY }}
aws-region: us-east-1
- name: Download artifacts
uses: actions/download-artifact@v2
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
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/*
cd katalon-agent-linux-x64-$BUILD_VERSION
tar cvzf ../packages/katalon-agent-linux-x64-$BUILD_VERSION.tar.gz *
cd ..
ls -laR
aws s3 cp katalon-agent-linux-x64-$BUILD_VERSION/cli-linux-x64 s3://katalon-testops-agent-beta/cloud/cli-linux-x64 --acl public-read
aws s3 sync packages/ s3://katalon-testops-agent-beta/$BUILD_VERSION --acl public-read