forked from ni/VireoSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
272 lines (248 loc) · 7.61 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
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# Copyright (c) 2020 National Instruments
# SPDX-License-Identifier: MIT
on:
pull_request:
push:
branches-ignore:
- 'gh-pages'
tags:
- 'v*'
jobs:
lint:
# if: 'false'
runs-on: ubuntu-20.04
timeout-minutes: 25
steps:
- uses: actions/checkout@v2
# Install lint dependencies
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- uses: actions/setup-node@v1
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
# Run lint
- run: make lint
- run: npm run lint
- run: npm run lint-markdown
web:
# if: 'false'
runs-on: ubuntu-20.04
timeout-minutes: 25
steps:
- uses: actions/checkout@v2
# Install web dependencies
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- run: nohup python -m httpbin.core --port 64526 --host 0.0.0.0 &
- uses: actions/setup-node@v1
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: make install-wasi-sdk-linux
- run: make vwasi
- run: |
git clone https://github.com/juj/emsdk.git
cd emsdk
git checkout tags/2.0.23
- run: |
emsdk/emsdk install 2.0.23
emsdk/emsdk activate 2.0.23
- run: . emsdk/emsdk_env.sh && emcc -v
# Build web
- run: . emsdk/emsdk_env.sh && make vjs
- run: . emsdk/emsdk_env.sh && make vjs BUILD=debug
- run: . emsdk/emsdk_env.sh && make vjs BUILD=profile
- run: . emsdk/emsdk_env.sh && make vjs BUILD=release TARGET=asmjs-unknown-emscripten
- run: npm pack
- uses: actions/upload-artifact@v2
with:
name: npm package
path: ./vireo-*.tgz
if-no-files-found: error
# Test web
- run: make testjs
env:
TZ: CST6CDT
- run: make testhttpbin
env:
TZ: CST6CDT
- run: make testwasi
- run: npm run test-min
env:
TZ: CST6CDT
- run: npm run test-asmjs
env:
TZ: CST6CDT
# Publish web npm package
- if: startsWith(github.ref, 'refs/tags/v')
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
web-windows:
# if: 'false'
runs-on: windows-2019
timeout-minutes: 25
steps:
- uses: actions/checkout@v2
# Install web-windows dependencies
- uses: actions/setup-node@v1
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: make install-wasi-sdk-windows
- run: make vwasi
- run: choco install make -y
- run: choco install gnuwin32-coreutils.portable -y
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- run: |
python -m pip install --upgrade pip
pip install tox
- run: Start-Process npm "run httpbin" -PassThru
- run: |
git clone https://github.com/juj/emsdk.git
cd emsdk
git checkout tags/2.0.23
- run: |
emsdk\emsdk install 2.0.23
emsdk\emsdk activate 2.0.23
- run: emsdk\emsdk_env.ps1 && emcc -v
# Build web-windows
- run: emsdk\emsdk_env.ps1 && make vjs
- run: npm pack
- uses: actions/upload-artifact@v2
with:
name: npm package win build
path: ./vireo-*.tgz
if-no-files-found: error
# Test web-windows
- run: tzutil /s "Central Standard Time"
- run: make testjs
- run: make testwasi
- run: npm run test-min
setup:
runs-on: ubuntu-20.04
timeout-minutes: 25
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- if: startsWith(github.ref, 'refs/tags/v')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
continue-on-error: true
windows:
# if: 'false'
needs: setup
runs-on: windows-2019
timeout-minutes: 25
steps:
- uses: actions/checkout@v2
# Install windows dependencies
- uses: microsoft/setup-msbuild@v1
- uses: actions/setup-node@v1
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
# Build windows
- run: msbuild /m /p:Configuration=Debug /p:PlatformTarget=Win32 Vireo_VS\VireoCommandLine.sln
- name: calculate release name
run: |
$Env:ESH_VERSION=(Get-Content -Raw -Path package.json | ConvertFrom-Json).version
echo "ESH_VERSION=$Env:ESH_VERSION" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
$Env:ESH_32_DEBUG="esh_$($Env:ESH_VERSION)_i686-pc-windows-msvc_debug.zip"
echo "ESH_32_DEBUG=$Env:ESH_32_DEBUG" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: powershell
- run: 7z a %ESH_32_DEBUG% .\dist\Debug\esh.exe .\dist\Debug\esh.pdb .\README.md .\LICENSE.txt
shell: cmd
working-directory: ${{env.GITHUB_WORKSPACE}}
- uses: actions/upload-artifact@v2
with:
name: ${{ env.ESH_32_DEBUG }}
path: ${{ env.ESH_32_DEBUG }}
if-no-files-found: error
- uses: nuget/setup-nuget@v1
- run: nuget pack VireoSDK.nuspec -properties version="$Env:ESH_VERSION"
- uses: actions/upload-artifact@v2
with:
name: nuget package
path: ./*.nupkg
if-no-files-found: error
# Test windows
- run: tzutil /s "Central Standard Time"
- run: cd test-it && node test.js -n --dots
# Publish windows release and nuget package
- if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.upload_url }}
asset_name: ${{ env.ESH_32_DEBUG }}
asset_path: ${{ env.ESH_32_DEBUG }}
asset_content_type: application/zip
- if: startsWith(github.ref, 'refs/tags/v')
run: |
$PACKAGE_PATH = (get-item ./*.nupkg).FullName
nuget push $PACKAGE_PATH -ApiKey ${{secrets.NUGET_TOKEN}} -Source "https://api.nuget.org/v3/index.json"
linux:
# if: 'false'
needs: setup
runs-on: ubuntu-20.04
timeout-minutes: 25
steps:
- uses: actions/checkout@v2
# Install linux dependencies
- uses: actions/setup-node@v1
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: echo gcc -v
# Build linux
- run: make native
- name: calculate release name
run: |
export ESH_VERSION=$(node -p "require('./package.json').version")
export ESH_64_RELEASE="esh_"$ESH_VERSION"_x86_64-unknown-linux-gnu_release.zip"
echo "ESH_64_RELEASE=$ESH_64_RELEASE" >> $GITHUB_ENV
- run: zip -j $ESH_64_RELEASE dist/esh README.md LICENSE.txt
- uses: actions/upload-artifact@v2
with:
name: ${{ env.ESH_64_RELEASE }}
path: ${{ env.ESH_64_RELEASE }}
if-no-files-found: error
# Test linux
- run: make unittest
env:
TZ: CST6CDT
- run: make testnative
env:
TZ: CST6CDT
# Publish linux release
- if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.upload_url }}
asset_name: ${{ env.ESH_64_RELEASE }}
asset_path: ${{ env.ESH_64_RELEASE }}
asset_content_type: application/zip