-
Notifications
You must be signed in to change notification settings - Fork 40
200 lines (180 loc) · 7.92 KB
/
dotnet_nugets.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
# Changing this name will cause github.run_number to be reset and affect the
# versioning strategy of this file. Therefore, if we change this name major or
# minor must also be changed to ensure a correct lineage of versions.
name: .NET Nugets
on:
workflow_dispatch:
push:
tags:
- '*'
branches:
- master
pull_request:
branches:
- '*'
env:
VCPKG_DEFAULT_BINARY_CACHE: ${{github.workspace}}/vcpkg_binary_cache
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
build-nuget-dotnet:
strategy:
fail-fast: false
matrix:
config:
- { os: "windows-latest", os_name: "windows-latest", runtime_id: "win-x64", vcpkg_target_triplet: "x64-windows-static" }
- { os: "ubuntu-latest", os_name: "ubuntu-latest", runtime_id: "linux-x64", vcpkg_target_triplet: "x64-linux" }
- { os: "macos-13", os_name: "macos-latest", runtime_id: "osx-x64", vcpkg_target_triplet: "x64-osx" }
runs-on: ${{matrix.config.os}}
name: build-nuget-dotnet (${{ matrix.config.os_name }}, ${{ matrix.config.runtime_id }}, ${{ matrix.config.vcpkg_target_triplet }})
steps:
- uses: actions/checkout@v2
- run: |
git submodule update --init ext_libs/vcpkg ext_libs/vowpal_wabbit ext_libs/zstd
cd ext_libs/vowpal_wabbit
git submodule update --init ext_libs/eigen
- name: Setup MSVC Developer Command Prompt
if: ${{ startsWith(matrix.config.os, 'windows') }}
uses: ilammy/msvc-dev-cmd@v1
- uses: lukka/get-cmake@latest
- name: Install dotnet t4
if: ${{ startsWith(matrix.config.os, 'windows') }}
run: dotnet tool install --global dotnet-t4
- run: echo "VCPKG_COMMIT=$(git rev-parse :ext_libs/vcpkg)" >> $GITHUB_ENV
shell: bash
- run: mkdir -p ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
- name: Cache vcpkg binary cache
uses: actions/cache@v3
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}/*
key: ${{ matrix.config.os_name }}-build-${{ matrix.config.vcpkg_target_triplet }}-${{ hashFiles('vcpkg.json') }}-${{ env.VCPKG_COMMIT }}
- name: Configure .NET Core
run: >
cmake -S . -B build -G Ninja
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/ext_libs/vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=${{ matrix.config.vcpkg_target_triplet }}
-DVCPKG_HOST_TRIPLET=${{ matrix.config.vcpkg_target_triplet }}
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
-Drlclientlib_BUILD_DOTNET=On
-Drlclientlib_DOTNET_USE_MSPROJECT=Off
-DBUILD_FLATBUFFERS=Off
-DRAPIDJSON_SYS_DEP=ON
-DFMT_SYS_DEP=ON
-DSPDLOG_SYS_DEP=ON
-DVW_ZLIB_SYS_DEP=ON
-DVW_BOOST_MATH_SYS_DEP=ON
-DVW_BUILD_VW_C_WRAPPER=Off
-DBUILD_TESTING=Off
-DRL_OPENSSL_SYS_DEP=On
-DRL_CPPRESTSDK_SYS_DEP=On
- run: cmake --build build --config RelWithDebInfo -t rlnetnative
- if: ${{ startsWith(matrix.config.os, 'windows') }}
run: cmake --build build --config RelWithDebInfo -t rl.net
- if: ${{ startsWith(matrix.config.os, 'windows') }}
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.config.os_name }}
path: build/binaries/*.dll
- if: ${{ startsWith(matrix.config.os, 'windows') }}
uses: actions/upload-artifact@v4
with:
name: symbols-${{ matrix.config.os_name }}
path: build/binaries/*.pdb
- if: ${{ startsWith(matrix.config.os, 'ubuntu') }}
run: |
mkdir -p symbols
objcopy --only-keep-debug build/bindings/cs/rl.net.native/librlnetnative.so symbols/librlnetnative.debug
strip --strip-debug --strip-unneeded build/bindings/cs/rl.net.native/librlnetnative.so
- if: ${{ startsWith(matrix.config.os, 'ubuntu') }}
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.config.os_name }}
path: build/bindings/cs/rl.net.native/librlnetnative.so
- if: ${{ startsWith(matrix.config.os, 'ubuntu') }}
uses: actions/upload-artifact@v4
with:
name: symbols-${{ matrix.config.os_name }}
path: symbols/librlnetnative.debug
- if: ${{ startsWith(matrix.config.os, 'macos') }}
run: |
mkdir -p symbols
dsymutil build/bindings/cs/rl.net.native/librlnetnative.dylib --flat -o symbols/librlnetnative.dSYM
strip -S build/bindings/cs/rl.net.native/librlnetnative.dylib
- if: ${{ startsWith(matrix.config.os, 'macos') }}
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.config.os_name }}
path: build/bindings/cs/rl.net.native/librlnetnative.dylib
- if: ${{ startsWith(matrix.config.os, 'macos') }}
uses: actions/upload-artifact@v4
with:
name: symbols-${{ matrix.config.os_name }}
path: symbols/librlnetnative.dSYM
package-nuget:
needs: build-nuget-dotnet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update git tags
# Needed because actions/checkout performs a shallow checkout without tags
run: git fetch --unshallow --tags --recurse-submodules=no
- name: Get version number
shell: bash
run: |
GENERATED_VERSION=$(./.scripts/version_number.py)
echo "Generated version number: $version"
echo "RL_NUGET_VERSION=$GENERATED_VERSION" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Display structure of artifacts
run: ls -R artifacts
- uses: NuGet/[email protected]
- run: nuget pack nuget/dotnet/rl.net.nuspec -Properties RL_NUGET_PACKAGE_VERSION=$RL_NUGET_VERSION -BasePath artifacts -OutputDirectory nuget_output
- uses: actions/upload-artifact@v4
with:
name: dist
path: nuget_output/
test-nuget:
needs: package-nuget
strategy:
fail-fast: false
matrix:
config:
- { os: "windows-latest", os_name: "windows-latest", runtime_id: "win-x64" }
- { os: "ubuntu-latest", os_name: "ubuntu-latest", runtime_id: "linux-x64" }
- { os: "macos-13", os_name: "macos-latest", runtime_id: "osx-x64" }
runs-on: ${{matrix.config.os}}
name: test-nuget (${{ matrix.config.os_name }}, ${{ matrix.config.runtime_id }})
steps:
- uses: actions/checkout@v2
- name: Update git tags
# Needed because actions/checkout performs a shallow checkout without tags
run: git fetch --unshallow --tags --recurse-submodules=no
- name: Get version number
shell: bash
run: |
GENERATED_VERSION=$(./.scripts/version_number.py)
echo "Generated version number: $version"
echo "RL_NUGET_VERSION=$GENERATED_VERSION" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: actions/setup-dotnet@v3
- name: Install package
# enable error ignoring state with +e because we need to restore from two sources
run: |
set +e
cd nuget/dotnet/test
dotnet add dotnetcore_nuget_test.csproj package RL.Net --version ${{ env.RL_NUGET_VERSION }} --source "${{github.workspace}}/dist" --no-restore
dotnet restore dotnetcore_nuget_test.csproj --runtime ${{matrix.config.runtime_id}} --source "${{github.workspace}}/dist"
dotnet restore dotnetcore_nuget_test.csproj --runtime ${{matrix.config.runtime_id}}
- name: Build and run test
run: |
cd nuget/dotnet/test
dotnet build dotnetcore_nuget_test.csproj --runtime ${{matrix.config.runtime_id}} --output build --no-restore --self-contained
./build/dotnetcore_nuget_test