-
Notifications
You must be signed in to change notification settings - Fork 40
160 lines (149 loc) · 5.38 KB
/
build_nuget.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
name: Windows Nuget
on:
push:
tags:
- '*'
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.build_type }}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["windows-2019"]
build_type: ["Debug", "Release"]
toolset: ["v141", "v142"]
steps:
# Get repository and setup dependencies
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: ilammy/msvc-dev-cmd@v1
# NASM required to compile OpenSSL assembly language code
- uses: ilammy/setup-nasm@v1
- name: Dependencies
# cd .. to change out of directory with vcpkg.json manifest file
run: >
cd ..;
vcpkg install
--host-triplet=x64-windows
--triplet=x64-windows
flatbuffers
boost-filesystem
boost-thread
boost-program-options
boost-test
boost-align
boost-math
boost-uuid
boost-system
boost-date-time
boost-regex
boost-asio
boost-interprocess
# 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=$(./.scripts/version_number.py)
echo "Generated version number: $version"
echo "version=$version" >> $GITHUB_OUTPUT
# Compile code and create package
- name: Configure
run: >
cmake -S . -B build
-G "Visual Studio 16 2019" -A x64
-T ${{ matrix.toolset }}
-DVCPKG_MANIFEST_MODE=Off
-DRL_BUILD_NUGET=On
-DRL_NUGET_PACKAGE_NAME=RLClientLibNativeStatic
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DRL_NUGET_PACKAGE_VERSION="${{ steps.get_version.outputs.version }}"
-DNATIVE_NUGET_PLATFORM_TAG=x64
-DCMAKE_TOOLCHAIN_FILE="${env:VCPKG_INSTALLATION_ROOT}\scripts\buildsystems\vcpkg.cmake"
-DVCPKG_TARGET_TRIPLET=x64-windows
-Drlclientlib_BUILD_DOTNET=Off
- name: Compile
run: cmake --build ./build --config ${{ matrix.build_type }} -v
- name: Create Nuget package
run: cmake --install ./build --config ${{ matrix.build_type }} --prefix ./nuget_staging -v
# Upload the package
- name: Get file name
id: nuget_name
shell: bash
run: |
cd nuget_staging
ls
NugetFileName=(*.nupkg)
echo "Found nuget package: ${NugetFileName[0]}"
echo "NugetFileName=${NugetFileName[0]}" >> $GITHUB_OUTPUT
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: RLClientLibNativeStatic-${{ matrix.toolset }}-${{ matrix.build_type }}-x64.${{ steps.get_version.outputs.version }}.nupkg
path: nuget_staging/${{ steps.nuget_name.outputs.NugetFileName }}
test_nuget_windows:
needs: [build_nuget_windows]
name: nuget-test.${{ matrix.toolset }}-${{ matrix.build_type }}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["windows-2019"]
build_type: ["Debug", "Release"]
toolset: ["v141", "v142"]
steps:
- uses: actions/checkout@v2
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=$(./.scripts/version_number.py)
echo "Generated version number: $version"
echo "version=$version" >> $GITHUB_OUTPUT
# Download and install nuget
- uses: actions/download-artifact@v4
with:
name: RLClientLibNativeStatic-${{ matrix.toolset }}-${{ matrix.build_type }}-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\test\packages"
-Version "${{ steps.get_version.outputs.version }}"
-Verbosity detailed
-NonInteractive
RLClientLibNativeStatic-${{ matrix.toolset }}-${{ matrix.build_type }}-x64
- name: Rename package install directory to omit version number
run: |
cd nuget\test\packages
mv * RLClientLibNativeStatic-${{ matrix.toolset }}-${{ matrix.build_type }}-x64
# Compile and run
- name: Build test
run: |
cd nuget\test
msbuild test_rl_nuget.vcxproj -t:rebuild "-property:Configuration=${{ matrix.build_type }};Platform=x64;PlatformToolset=${{ matrix.toolset }}"
.\bin\x64\${{ matrix.build_type }}\test_rl_nuget.exe