-
-
Notifications
You must be signed in to change notification settings - Fork 333
257 lines (252 loc) · 14.8 KB
/
deploy.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
name: Run Deploy
on:
workflow_dispatch:
inputs:
version:
description: New Version
default: ""
required: true
publish:
description: Make Public(true or false)
default: "false"
required: true
jobs:
RunDeploy:
runs-on: windows-2022
steps:
# check users permission
- name: "Check Permissions"
uses: "lannonbr/repo-permission-check-action@2.0.0"
with:
permission: "admin"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Install Dependencies
- name: Clone Repository
uses: actions/checkout@v2
- name: Install Python Deploy Tools
run: |
python -m pip install wheel
python -m pip install twine
python -m pip install awscli
shell: cmd
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Typescript
run: |
npm install -g ts-node
shell: cmd
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11.0.3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Print Inputs
run: |
echo ${{ github.event.inputs.version }}
echo ${{ github.event.inputs.publish }}
- name: Compile x64
run: |
mkdir %GITHUB_WORKSPACE%\build64
cd %GITHUB_WORKSPACE%\build64
cmake -DBRAINFLOW_VERSION=%GITHUB_SHA% -DWARNINGS_AS_ERRORS=ON -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_VERSION=8.1 -DCMAKE_INSTALL_PREFIX=..\installed64\ ..
cmake --build . --target install --config Release -j 2 --parallel 2
shell: cmd
# Download all artifacts from AWS
- name: Download Linux Libs
run: |
New-Item $env:GITHUB_WORKSPACE\linux -itemtype directory
aws s3 cp s3://brainflow/$env:GITHUB_SHA/linux/ $env:GITHUB_WORKSPACE\linux\ --recursive
ls $env:GITHUB_WORKSPACE\linux\
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Download MacOS Libs
run: |
New-Item $env:GITHUB_WORKSPACE\macos -itemtype directory
aws s3 cp s3://brainflow/$env:GITHUB_SHA/macos_release/ $env:GITHUB_WORKSPACE\macos\ --recursive
ls $env:GITHUB_WORKSPACE\macos\
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Download Win x64 Libs
run: |
New-Item $env:GITHUB_WORKSPACE\win64 -itemtype directory
aws s3 cp s3://brainflow/$env:GITHUB_SHA/win64/lib/ $env:GITHUB_WORKSPACE\win64\ --recursive
ls $env:GITHUB_WORKSPACE\win64\
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Download Win x32 Libs
run: |
New-Item $env:GITHUB_WORKSPACE\win32 -itemtype directory
aws s3 cp s3://brainflow/$env:GITHUB_SHA/win32/lib/ $env:GITHUB_WORKSPACE\win32\ --recursive
ls $env:GITHUB_WORKSPACE\win32\
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Install 7Zip PowerShell Module
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose
# Prepare packages
- name: Prepare Libs
run: |
New-Item $env:GITHUB_WORKSPACE\compiled_libs -itemtype directory
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\compiled_libs" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\compiled_libs" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\compiled_libs" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\compiled_libs" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\compiled_libs
Compress-7Zip -Path $env:GITHUB_WORKSPACE\compiled_libs -ArchiveFileName $env:GITHUB_WORKSPACE\compiled_libs.tar -Format Tar
aws s3 cp $env:GITHUB_WORKSPACE\compiled_libs.tar s3://brainflow/$env:GITHUB_SHA/compiled_libs.tar
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Prepare Node Package
run: |
cd $env:GITHUB_WORKSPACE\nodejs_package\
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\nodejs_package\brainflow\lib
(gc .\package.json).replace('0.0.0-development', $env:VERSION) | Out-File -encoding ASCII package.json
type package.json
npm install
npm run build
npm pack
aws s3 cp $env:GITHUB_WORKSPACE\nodejs_package\ s3://brainflow/$env:GITHUB_SHA/npm --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
- name: Prepare Java Package
run: |
cd $env:GITHUB_WORKSPACE\java_package\brainflow
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources
(gc .\pom.xml).replace('0.0.1-SNAPSHOT', $env:VERSION) | Out-File -encoding ASCII pom.xml
type pom.xml
(gc .\settings.xml).replace('USER',$env:PUBLISH_USER) | Out-File -encoding ASCII settings.xml
(gc .\settings.xml).replace('TOKEN',$env:PUBLISH_TOKEN) | Out-File -encoding ASCII settings.xml
mvn package
aws s3 cp $env:GITHUB_WORKSPACE\java_package\brainflow\target\ s3://brainflow/$env:GITHUB_SHA/jars --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
- name: Prepare Python Package
run: |
cd $env:GITHUB_WORKSPACE\python_package\
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\python_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\python_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\python_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\python_package\brainflow\lib" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\python_package\brainflow\lib
(gc .\setup.py).replace('0.0.1', $env:VERSION) | Out-File -encoding ASCII setup.py
type setup.py
python setup.py sdist bdist_wheel
aws s3 cp $env:GITHUB_WORKSPACE\python_package\ s3://brainflow/$env:GITHUB_SHA/whl --recursive
env:
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
- name: Prepare Rust Package
run: |
cd $env:GITHUB_WORKSPACE\rust_package\brainflow
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\rust_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\rust_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\rust_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\rust_package\brainflow\lib" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\rust_package\brainflow\lib
(gc .\Cargo.toml).replace('0.0.1', $env:VERSION) | Out-File -encoding ASCII Cargo.toml
type Cargo.toml
cargo login $env:CARGO_TOKEN
# cargo publish --dry-run --allow-dirty
# aws s3 cp $env:GITHUB_WORKSPACE\rust_package\brainflow s3://brainflow/$env:GITHUB_SHA/rust --recursive
env:
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
- name: Prepare Nuget Package
run: |
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" -Recurse -Force -Filter *.*
Get-ChildItem -Path "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" *.a | foreach { Remove-Item -Path $_.FullName }
Get-ChildItem -Path "$env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib" *.lib | foreach { Remove-Item -Path $_.FullName }
ls $env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow\lib
cd $env:GITHUB_WORKSPACE\csharp_package\brainflow
dotnet restore brainflow.sln
msbuild brainflow.sln /p:Configuration=Release /p:Platform="Any CPU"
cd $env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow
(gc .\brainflow.csproj).replace('0.0.1', $env:VERSION) | Out-File -encoding ASCII brainflow.csproj
type brainflow.csproj
dotnet pack brainflow.csproj -c Release
aws s3 cp $env:GITHUB_WORKSPACE\csharp_package\brainflow\brainflow s3://brainflow/$env:GITHUB_SHA/nuget --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
NUGET_ENABLE_LEGACY_CSPROJ_PACK: true
- name: Prepare Matlab Package
run: |
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\matlab_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\matlab_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\matlab_package\brainflow\lib" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\matlab_package\brainflow\lib" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\matlab_package\brainflow\lib
Compress-7Zip -Path $env:GITHUB_WORKSPACE\matlab_package -ArchiveFileName $env:GITHUB_WORKSPACE\matlab_package.tar -Format Tar
aws s3 cp $env:GITHUB_WORKSPACE\matlab_package.tar s3://brainflow/$env:GITHUB_SHA/matlab_package.tar
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
VERSION: ${{ github.event.inputs.version }}
# publish packages
- name: Publish Packages
if: github.event.inputs.publish == 'true'
run: |
cd $env:GITHUB_WORKSPACE\nodejs_package
echo "//registry.npmjs.org/:_authToken=$env:NPM_TOKEN" > .npmrc
npm publish
cd $env:GITHUB_WORKSPACE\java_package\brainflow
mvn -s $env:GITHUB_WORKSPACE\java_package\brainflow\settings.xml deploy -Dregistry=https://maven.pkg.github.com/brainflow-dev -Dtoken=$env:PUBLISH_TOKEN
cd $env:GITHUB_WORKSPACE\python_package
twine upload --skip-existing dist/*.whl --user __token__ --password $env:PYPI_PASSWORD
cd $env:GITHUB_WORKSPACE\rust_package\brainflow
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
# create java package for java 8, will be removed
- name: Java 8 package
run: |
cd $env:GITHUB_WORKSPACE\java_package\brainflow
(gc .\pom.xml).replace('<source>11</source>', '<source>1.8</source>') | Out-File -encoding ASCII pom.xml
(gc .\pom.xml).replace('<target>11</target>', '<target>1.8</target>') | Out-File -encoding ASCII pom.xml
type pom.xml
mvn clean
Remove-Item "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\java\module-info.java"
Copy-Item "$env:GITHUB_WORKSPACE\linux\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\macos\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win64\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
Copy-Item "$env:GITHUB_WORKSPACE\win32\*" -Destination "$env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources" -Recurse -Force -Filter *.*
ls $env:GITHUB_WORKSPACE\java_package\brainflow\src\main\resources
mvn package
aws s3 cp $env:GITHUB_WORKSPACE\java_package\brainflow\target\ s3://brainflow/$env:GITHUB_SHA/jars_java8 --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}