-
Notifications
You must be signed in to change notification settings - Fork 14
325 lines (293 loc) · 14.6 KB
/
bflat-cicd.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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: CI
on:
pull_request:
branches: [ bflat-main, bflat-release/7.0, bflat-release/8.0 ]
workflow_dispatch:
inputs:
version:
description: 'Encoded version (e.g. 7.0.0-preview.7.22375.6)'
required: true
buildid:
description: 'Build ID (e.g. 20220725.6)'
required: true
jobs:
build_and_test:
strategy:
matrix:
include:
- os: linux-glibc
container: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64
arch: arm64
vm: ubuntu-latest
crossrootfs: /crossrootfs/arm64
rid: linux-arm64
- os: linux-glibc
container: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64
arch: x64
vm: ubuntu-latest
crossrootfs: /crossrootfs/x64
rid: linux-x64
- os: linux-bionic
container: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-android-amd64
arch: arm64
vm: ubuntu-latest
rid: linux-bionic-arm64
- os: windows
arch: x64
vm: windows-latest
- os: windows
arch: arm64
vm: windows-latest
runs-on: ${{ matrix.vm }}
name: Build and test ${{ matrix.os }} ${{ matrix.arch }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v1
- name: Build the product (Linux)
env:
ROOTFS_DIR: ${{ matrix.crossrootfs }}
run: ./build.sh clr.nativeaotlibs+clr.nativeaotruntime+clr.alljits+clr.tools+libs.native+libs.sfx -c Release -arch ${{ matrix.arch }} /p:CrossBuild=true -ci /p:OfficialBuildId="${{ github.event.inputs.buildid }}" /p:GenerateDocumentationFile=false
if: ${{ matrix.vm == 'ubuntu-latest' && matrix.os != 'linux-bionic' }}
- name: Build the product (Linux Bionic)
run: ./build.sh clr.nativeaotlibs+clr.nativeaotruntime+libs.native+libs.sfx -c Release -os ${{ matrix.os }} -arch ${{ matrix.arch }} -ci /p:OfficialBuildId="${{ github.event.inputs.buildid }}" /p:GenerateDocumentationFile=false
if: ${{ matrix.vm == 'ubuntu-latest' && matrix.os == 'linux-bionic' }}
- name: Build the product (Windows)
shell: cmd
run: build.cmd clr.nativeaotlibs+clr.nativeaotruntime+clr.alljits+clr.tools+libs.native+libs.sfx -c Release -arch ${{ matrix.arch }} -ci /p:OfficialBuildId="${{ github.event.inputs.buildid }}" /p:GenerateDocumentationFile=false
if: ${{ matrix.vm == 'windows-latest' }}
- name: Package compiler
if: ${{ matrix.os == 'linux-glibc' && matrix.arch == 'x64' && github.event.inputs.version != '' }}
run: ./dotnet.sh pack bflat/pack/ILCompiler.Compiler.nuproj -p:Version=${{ github.event.inputs.version }} -p:IntermediateOutputPath=$GITHUB_WORKSPACE/artifacts/bin/coreclr/linux.x64.Release/ilc/ -p:RepositoryUrl=https://github.com/bflattened/runtime
- name: Archive compiler package
if: ${{ matrix.os == 'linux-glibc' && matrix.arch == 'x64' && github.event.inputs.version != '' }}
uses: actions/upload-artifact@v2
with:
name: nuget
path: bflat/pack/bin/Release/BFlat.Compiler.${{ github.event.inputs.version }}.nupkg
- name: ZIP native compiler (Linux)
run: |
mkdir artifacts/bflat-compiler-native
cp -t artifacts/bflat-compiler-native artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/ilc/libclrjit_* artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/ilc/libjitinterface_* artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/ilc/libobjwriter*
cp -t artifacts/bflat-compiler-native THIRD-PARTY-NOTICES.TXT artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/build/WindowsAPIs.txt
./dotnet.sh run --project bflat/zip/zip.csproj -- artifacts/bflat-compiler-native-${{ matrix.os }}-${{ matrix.arch }}.zip artifacts/bflat-compiler-native
if: ${{ matrix.vm == 'ubuntu-latest' && matrix.os != 'linux-bionic' }}
- name: ZIP native compiler (Windows)
run: |
mkdir artifacts\bflat-compiler-native
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\ilc\clrjit_* artifacts\bflat-compiler-native\
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\ilc\jitinterface_* artifacts\bflat-compiler-native\
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\ilc\objwriter* artifacts\bflat-compiler-native\
copy THIRD-PARTY-NOTICES.TXT artifacts\bflat-compiler-native\
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\build\WindowsAPIs.txt artifacts\bflat-compiler-native\
pushd artifacts\bflat-compiler-native\
Compress-Archive * $Env:GITHUB_WORKSPACE\artifacts\bflat-compiler-native-${{ matrix.os }}-${{ matrix.arch }}.zip
popd
if: ${{ matrix.vm == 'windows-latest' }}
- name: Archive native compiler artifacts
uses: actions/upload-artifact@v2
with:
name: native-compiler
path: artifacts/bflat-compiler-native-${{ matrix.os }}-${{ matrix.arch }}.zip
if: ${{ matrix.os != 'linux-bionic' }}
- name: ZIP libs (Linux)
run: |
mkdir artifacts/bflat-libs
cp -t artifacts/bflat-libs artifacts/bin/microsoft.netcore.app.runtime.${{ matrix.rid }}/Release/runtimes/${{ matrix.rid }}/lib/net8.0/*
cp -t artifacts/bflat-libs artifacts/bin/microsoft.netcore.app.runtime.${{ matrix.rid }}/Release/runtimes/${{ matrix.rid }}/native/*.Native.*a
cp -t artifacts/bflat-libs artifacts/bin/coreclr/linux.${{ matrix.arch }}.Release/aotsdk/*
./dotnet.sh run --project bflat/zip/zip.csproj -- artifacts/bflat-libs-${{ matrix.os }}-${{ matrix.arch }}.zip artifacts/bflat-libs
if: ${{ matrix.vm == 'ubuntu-latest' }}
- name: ZIP libs (Windows)
run: |
mkdir artifacts\bflat-libs
copy artifacts\bin\microsoft.netcore.app.runtime.win-${{ matrix.arch }}\Release\runtimes\win-${{ matrix.arch }}\lib\net8.0\* artifacts\bflat-libs\
copy artifacts\bin\coreclr\Windows.${{ matrix.arch }}.Release\aotsdk\* artifacts\bflat-libs\
pushd artifacts\bflat-libs\
Compress-Archive * $Env:GITHUB_WORKSPACE\artifacts\bflat-libs-${{ matrix.os }}-${{ matrix.arch }}.zip
popd
if: ${{ matrix.vm == 'windows-latest' }}
- name: Archive libs
uses: actions/upload-artifact@v2
with:
name: libs
path: artifacts/bflat-libs-${{ matrix.os }}-${{ matrix.arch }}.zip
- name: ZIP refs
if: ${{ matrix.os == 'linux-glibc' && matrix.arch == 'x64' }}
run: |
mkdir artifacts/bflat-refs
cp -t artifacts/bflat-refs artifacts/bin/microsoft.netcore.app.ref/ref/net8.0/*.dll
./dotnet.sh run --project bflat/zip/zip.csproj -- artifacts/bflat-refs.zip artifacts/bflat-refs
- name: Archive refs
if: ${{ matrix.os == 'linux-glibc' && matrix.arch == 'x64' }}
uses: actions/upload-artifact@v2
with:
name: refs
path: artifacts/bflat-refs.zip
- name: Free up disk space for test run (Windows)
shell: cmd
run: |
rmdir /S /Q artifacts\bflat-libs
rmdir /S /Q artifacts\bflat-compiler-native
rmdir /S /Q artifacts\obj\coreclr
del artifacts\bflat-libs-${{ matrix.os }}-${{ matrix.arch }}.zip
del artifacts\bflat-compiler-native-${{ matrix.os }}-${{ matrix.arch }}.zip
if: ${{ matrix.vm == 'windows-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }}
- name: Build tests (Linux)
run: ./src/tests/build.sh nativeaot release ${{ matrix.arch }} 'tree nativeaot/SmokeTests'
if: ${{ matrix.vm == 'ubuntu-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }}
- name: Build tests (Windows)
shell: cmd
run: src\tests\build.cmd nativeaot release ${{ matrix.arch }} tree nativeaot\SmokeTests
if: ${{ matrix.vm == 'windows-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }}
- name: Run tests (Linux)
run: ./src/tests/run.sh --runnativeaottests release ${{ matrix.arch }}
if: ${{ matrix.vm == 'ubuntu-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }}
- name: Run tests (Windows)
shell: cmd
run: src\tests\run.cmd runnativeaottests release ${{ matrix.arch }}
if: ${{ matrix.vm == 'windows-latest' && github.event.inputs.version == '' && matrix.arch != 'arm64' }}
build_x86_windows:
runs-on: windows-latest
name: Build and test windows x86
steps:
- uses: actions/checkout@v3
- name: Build the product (Windows)
shell: cmd
run: bldx86.cmd
- name: ZIP libs (Windows)
run: |
mkdir artifacts\bflat-libs
copy artifacts\bin\coreclr\Windows.x86.Release\aotsdk\* artifacts\bflat-libs\
pushd artifacts\bflat-libs\
Compress-Archive * $Env:GITHUB_WORKSPACE\artifacts\bflat-libs-windows-x86.zip
popd
- name: Archive libs
uses: actions/upload-artifact@v2
with:
name: libs
path: artifacts/bflat-libs-windows-x86.zip
publish:
needs: [ build_and_test, build_x86_windows ]
runs-on: ubuntu-latest
name: Publish release and NuGet
if: ${{ github.event.inputs.version != '' && github.actor == 'MichalStrehovsky' }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Create tag
run: |
git tag v${{ github.event.inputs.version }}
git push origin v${{ github.event.inputs.version }}
- name: Download all artifacts
uses: actions/download-artifact@v2
- name: Publish compiler package
run: ./dotnet.sh nuget push nuget/BFlat.Compiler.${{ github.event.inputs.version }}.nupkg -s https://nuget.pkg.github.com/bflattened/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
release_name: v${{ github.event.inputs.version }}
draft: false
prerelease: false
- name: Upload refs
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: refs/bflat-refs.zip
asset_name: bflat-refs.zip
asset_content_type: application/zip
- name: Upload libs (windows-x86)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: libs/bflat-libs-windows-x86.zip
asset_name: bflat-libs-windows-x86.zip
asset_content_type: application/zip
- name: Upload native compiler (windows-x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: native-compiler/bflat-compiler-native-windows-x64.zip
asset_name: bflat-compiler-native-windows-x64.zip
asset_content_type: application/zip
- name: Upload native compiler (linux-glibc-x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: native-compiler/bflat-compiler-native-linux-glibc-x64.zip
asset_name: bflat-compiler-native-linux-glibc-x64.zip
asset_content_type: application/zip
- name: Upload libs (windows-x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: libs/bflat-libs-windows-x64.zip
asset_name: bflat-libs-windows-x64.zip
asset_content_type: application/zip
- name: Upload libs (linux-glibc-x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: libs/bflat-libs-linux-glibc-x64.zip
asset_name: bflat-libs-linux-glibc-x64.zip
asset_content_type: application/zip
- name: Upload native compiler (windows-arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: native-compiler/bflat-compiler-native-windows-arm64.zip
asset_name: bflat-compiler-native-windows-arm64.zip
asset_content_type: application/zip
- name: Upload native compiler (linux-glibc-arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: native-compiler/bflat-compiler-native-linux-glibc-arm64.zip
asset_name: bflat-compiler-native-linux-glibc-arm64.zip
asset_content_type: application/zip
- name: Upload libs (windows-arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: libs/bflat-libs-windows-arm64.zip
asset_name: bflat-libs-windows-arm64.zip
asset_content_type: application/zip
- name: Upload libs (linux-glibc-arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: libs/bflat-libs-linux-glibc-arm64.zip
asset_name: bflat-libs-linux-glibc-arm64.zip
asset_content_type: application/zip
- name: Upload libs (linux-bionic-arm64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: libs/bflat-libs-linux-bionic-arm64.zip
asset_name: bflat-libs-linux-bionic-arm64.zip
asset_content_type: application/zip