-
Notifications
You must be signed in to change notification settings - Fork 1.9k
149 lines (136 loc) · 5.33 KB
/
native_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
name: Native Nugets
on:
push:
branches:
- master
- 'releases/**'
pull_request:
branches:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
build_nuget_windows:
name: nuget.${{ matrix.toolset }}.${{ matrix.arch_config.arch }}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["windows-2019"]
toolset: ["v141", "v142"]
arch_config:
- { arch: x64, generator_arch: x64}
steps:
# Get repository and setup dependencies
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: ilammy/msvc-dev-cmd@v1
# Get version number
- 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
id: get_version
shell: bash
run: |
version=$(./utl/version_number.py)
echo "Generated version number: $version"
echo "version=$version" >> $GITHUB_OUTPUT
# Compile code
- name: Configure
run: >
cmake -S . -B build
-G "Visual Studio 16 2019" -A ${{ matrix.arch_config.generator_arch }}
-T ${{ matrix.toolset }}
-DVW_NUGET_PACKAGE_VERSION="${{ steps.get_version.outputs.version }}"
-DNATIVE_NUGET_PLATFORM_TAG="${{ matrix.arch_config.arch }}"
-DVW_FEAT_FLATBUFFERS=Off
-DBUILD_TESTING=Off
-DRAPIDJSON_SYS_DEP=Off
-DFMT_SYS_DEP=Off
-DSPDLOG_SYS_DEP=Off
-DVW_ZLIB_SYS_DEP=Off
-DVW_BOOST_MATH_SYS_DEP=Off
-DVW_BUILD_VW_C_WRAPPER=Off
-DVW_INSTALL=On
- name: Build and install
run: |
cmake --build build --config Debug -t vw_io vw_core vw_cli_bin vw_allreduce vw_spanning_tree_bin vw_c_wrapper vw_cache_parser vw_text_parser vw_json_parser
cmake --build build --config Release -t vw_io vw_core vw_cli_bin vw_allreduce vw_spanning_tree_bin vw_c_wrapper vw_cache_parser vw_text_parser vw_json_parser
# Install debug first so that release overwrites the exe and nothing else
cmake --install build --prefix ./nuget_staging --config Debug
cmake --install build --prefix ./nuget_staging --config Release
# Create package
- if: ${{ matrix.arch_config.arch == 'x64' }}
run: cp nuget\native\vowpalwabbit-x64.targets nuget_staging\vowpalwabbit.targets
- name: Package
shell: powershell
id: generate-nuget
run: |
cp build\nuget\native\vowpalwabbit.nuspec nuget_staging\vowpalwabbit.nuspec
cd nuget_staging
nuget pack .\vowpalwabbit.nuspec
$NugetFileName = Get-ChildItem *.nupkg -name
echo "NugetFileName=$NugetFileName" >> $GITHUB_OUTPUT
- name: Upload
uses: actions/upload-artifact@v4
with:
name: VowpalWabbitNative-${{matrix.toolset}}-x64.${{ steps.get_version.outputs.version }}.nupkg
path: nuget_staging/${{ steps.generate-nuget.outputs.NugetFileName }}
test_nuget_windows:
needs: [build_nuget_windows]
name: nuget-test.${{ matrix.toolset }}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["windows-2019"]
toolset: ["v141", "v142"]
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: ilammy/msvc-dev-cmd@v1
- name: Add msbuild to PATH
uses: microsoft/[email protected]
# Get version number
- 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
id: get_version
shell: bash
run: |
version=$(./utl/version_number.py)
echo "Generated version number: $version"
echo "version=$version" >> $GITHUB_OUTPUT
# Download and install nuget
- uses: actions/download-artifact@v4
with:
name: VowpalWabbitNative-${{matrix.toolset}}-x64.${{ steps.get_version.outputs.version }}.nupkg
path: downloaded_nugets
- name: List downloaded files
run: ls downloaded_nugets
- name: Install nuget
run: >
nuget install
-Source "${{ github.workspace }}\downloaded_nugets"
-OutputDirectory "${{ github.workspace }}\nuget\native\test\packages"
-Version "${{ steps.get_version.outputs.version }}"
-Verbosity detailed
-NonInteractive
VowpalWabbitNative-${{ matrix.toolset }}-x64
- name: Rename package install directory to omit version number
run: |
cd nuget\native\test\packages
mv * VowpalWabbitNative-${{ matrix.toolset }}-x64
# Compile and run
- name: Test nuget
run: |
cd nuget\native\test
echo "Testing debug build..."
msbuild test-${{ matrix.toolset }}.vcxproj -t:rebuild "-property:Configuration=Debug;Platform=x64"
.\bin\x64\Debug\test-${{ matrix.toolset }}.exe
echo "Testing release build..."
msbuild test-${{ matrix.toolset }}.vcxproj -t:rebuild "-property:Configuration=Release;Platform=x64"
.\bin\x64\Release\test-${{ matrix.toolset }}.exe