forked from shiguredo/momo
-
Notifications
You must be signed in to change notification settings - Fork 0
269 lines (267 loc) · 9.56 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
name: build-workflow
on:
push:
paths-ignore:
- 'doc/**'
- 'html/**'
- '**.md'
- 'THANKS'
- 'LICENSE'
- 'NOTICE'
jobs:
build-windows:
strategy:
fail-fast: false
matrix:
arch:
- x86_64
name: Build momo for Windows_${{ matrix.arch }}
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- uses: microsoft/[email protected]
- name: Get Versions
run: |
Get-Content "VERSION" | Foreach-Object {
if (!$_) { continue }
$var = $_.Split('=')
New-Variable -Name $var[0] -Value $var[1] -Force
}
echo "::set-output name=boost_version::${BOOST_VERSION}"
echo "::set-output name=wincuda_version::${WINCUDA_VERSION}"
id: versions
# Boost はよくダウンロード先に繋がらずエラーになるのでキャッシュする
- name: Cache Boost ${{ steps.versions.outputs.boost_version }}
id: cache-boost
uses: actions/cache@v3
with:
path: _cache\boost
key: windows-boost-${{ steps.versions.outputs.boost_version }}.zip.v5
# CUDA のインストールバイナリのダウンロードは 3GB ぐらいあって、
# ビルドの度に取得するのはつらいのでキャッシュする
# (インストールする nvcc は解凍後で 100MB 程度なのでキャッシュ可能)
- name: Cache NVCC ${{ steps.versions.outputs.wincuda_version }}
id: cache-cuda
uses: actions/cache@v3
with:
path: build\windows_x86_64\_install\cuda\nvcc
key: windows-cuda-${{ steps.versions.outputs.wincuda_version }}.v1
- run: "& .\\build.ps1 -package"
working-directory: build
timeout-minutes: 120
- name: Output package name
run: |
Get-Content "VERSION" | Foreach-Object {
if (!$_) { continue }
$var = $_.Split('=')
New-Variable -Name $var[0] -Value $var[1] -Force
}
$WINVER_MAJOR = [System.Environment]::OSVersion.Version.Major
$RELEASE_ID = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseID
echo "PACKAGE_NAME=momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${{ matrix.arch }}.zip" >> windows_${{ matrix.arch }}.env
echo "CONTENT_TYPE=application/zip" >> windows_${{ matrix.arch }}.env
echo "::set-output name=name::momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${{ matrix.arch }}.zip"
id: package_name
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.package_name.outputs.name }}
path: _package/${{ steps.package_name.outputs.name }}
- name: Upload Environment
uses: actions/upload-artifact@v3
with:
name: windows_${{ matrix.arch }}.env
path: windows_${{ matrix.arch }}.env
build-macos:
strategy:
fail-fast: false
matrix:
arch:
- arm64
- x86_64
name: Build momo for macOS_${{ matrix.arch }}
runs-on: macos-11.0
steps:
- uses: actions/checkout@v3
- name: Get Versions
run: |
source VERSION
echo "::set-output name=boost_version::${BOOST_VERSION}"
id: versions
- name: Cache Boost ${{ steps.versions.outputs.boost_version }}
id: cache-boost
uses: actions/cache@v3
with:
path: _cache/boost
key: macos-boost-${{ steps.versions.outputs.boost_version }}.tar.gz.v2
- run: ./build.sh --package macos_${{ matrix.arch }}
working-directory: build
timeout-minutes: 120
- name: Output package name
shell: bash
run: |
source VERSION
MACOS_VERSION=`sw_vers -productVersion | cut -d '.' -f-2`
echo "PACKAGE_NAME=momo-${MOMO_VERSION}_macos-${MACOS_VERSION}_${{ matrix.arch }}.tar.gz" >> macos_${{ matrix.arch }}.env
echo "CONTENT_TYPE=application/gzip" >> macos_${{ matrix.arch }}.env
echo "::set-output name=name::momo-${MOMO_VERSION}_macos-${MACOS_VERSION}_${{ matrix.arch }}.tar.gz"
id: package_name
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.package_name.outputs.name }}
path: _package/${{ steps.package_name.outputs.name }}
- name: Upload Environment
uses: actions/upload-artifact@v3
with:
name: macos_${{ matrix.arch }}.env
path: macos_${{ matrix.arch }}.env
build-linux:
strategy:
fail-fast: false
matrix:
name:
- raspberry-pi-os_armv6
- raspberry-pi-os_armv7
- raspberry-pi-os_armv8
- ubuntu-18.04_armv8_jetson_nano
- ubuntu-18.04_armv8_jetson_xavier
- ubuntu-18.04_x86_64
- ubuntu-20.04_x86_64
name: Build momo for ${{ matrix.name }}
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
- name: Get Versions
run: |
source VERSION
echo "::set-output name=boost_version::${BOOST_VERSION}"
id: versions
- name: Cache Boost ${{ steps.versions.outputs.boost_version }}
id: cache-boost
uses: actions/cache@v3
with:
path: _cache/boost
key: ${{ matrix.name }}-boost-${{ steps.versions.outputs.boost_version }}.tar.gz.v2
- run: ./build.sh --no-tty --no-mount --package ${{ matrix.name }}
working-directory: build
timeout-minutes: 120
- name: Output package name
shell: bash
run: |
source VERSION
echo "PACKAGE_NAME=momo-${MOMO_VERSION}_${{ matrix.name }}.tar.gz" >> ${{ matrix.name }}.env
echo "CONTENT_TYPE=application/gzip" >> ${{ matrix.name }}.env
echo "::set-output name=name::momo-${MOMO_VERSION}_${{ matrix.name }}.tar.gz"
id: package_name
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.package_name.outputs.name }}
path: _package/${{ steps.package_name.outputs.name }}
- name: Upload Environment
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}.env
path: ${{ matrix.name }}.env
create-release:
name: Create Release
if: contains(github.ref, 'tags/202')
needs:
- build-windows
- build-macos
- build-linux
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Output upload url
shell: bash
run: echo "UPLOAD_URL='${{ steps.create_release.outputs.upload_url }}'" > create-release.env
- name: Upload create-release Environment
uses: actions/upload-artifact@v3
with:
name: create-release.env
path: create-release.env
upload-assets:
name: Upload Assets to Release
needs:
- create-release
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
name:
- windows_x86_64
- macos_arm64
- macos_x86_64
- raspberry-pi-os_armv6
- raspberry-pi-os_armv7
- raspberry-pi-os_armv8
- ubuntu-18.04_armv8_jetson_nano
- ubuntu-18.04_armv8_jetson_xavier
- ubuntu-18.04_x86_64
- ubuntu-20.04_x86_64
steps:
- uses: actions/download-artifact@v3
with:
name: ${{ matrix.name }}.env
path: ${{ matrix.name }}.env
- uses: actions/download-artifact@v3
with:
name: create-release.env
path: create-release.env
- name: Env to output
shell: bash
run: |
source ${{ matrix.name }}.env/${{ matrix.name }}.env
source create-release.env/create-release.env
echo "::set-output name=package_name::$PACKAGE_NAME"
echo "::set-output name=content_type::$CONTENT_TYPE"
echo "::set-output name=upload_url::$UPLOAD_URL"
id: env
- uses: actions/download-artifact@v3
with:
name: ${{ steps.env.outputs.package_name }}
path: ${{ steps.env.outputs.package_name }}
- name: Upload ${{ matrix.name }} Release Asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.env.outputs.upload_url }}
asset_path: ${{ steps.env.outputs.package_name }}/${{ steps.env.outputs.package_name }}
asset_name: ${{ steps.env.outputs.package_name }}
asset_content_type: ${{ steps.env.outputs.content_type }}
notification:
name: Slack Notification
runs-on: ubuntu-latest
needs:
- build-windows
- build-macos
- build-linux
- create-release
- upload-assets
if: always()
steps:
- uses: actions/checkout@v3
- uses: rtCamp/action-slack-notify@v2
if: |
needs.build-windows.result == 'failure' ||
needs.build-macos.result == 'failure' ||
needs.build-linux.result == 'failure' ||
needs.create-release.result == 'failure' ||
needs.upload-assets.result == 'failure'
env:
SLACK_CHANNEL: open-momo
SLACK_COLOR: danger
SLACK_TITLE: Failure build
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}