-
Notifications
You must be signed in to change notification settings - Fork 51
185 lines (165 loc) · 6.09 KB
/
build_cmake.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
name: Desktop OS Builds
on:
workflow_call:
workflow_dispatch:
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Build", artifact: "Windows.tar.xz",
os: windows-latest,
cc: "cl", cxx: "cl",
cmake_generator: '-G "Ninja Multi-Config"',
build_type: RelWithDebInfo
}
- {
name: "Ubuntu Build", artifact: "Linux.tar.xz",
os: ubuntu-20.04,
cc: "gcc-9", cxx: "g++-9",
glibc_version: "2_31",
cmake_generator: '-G "Ninja"',
build_type: RelWithDebInfo
}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup python3
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install nasm
if: ${{ runner.os == 'Windows' }}
run: choco install nasm
- name: Update Submodules
run: git submodule update --init --recursive --depth=1
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v5
with:
version: 1.12.1
- name: Setup MSVC for compilation
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- name: Configure
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: >
cmake
-S .
-B build
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
${{ matrix.config.cmake_generator }}
# It is preferable to do a clean build to ensure all object files are
# deleted and then rebuilt from scratch, which can help resolve
# inconsistencies and errors.
- name: Build
run: >
cmake
--build build
--clean-first
--config ${{ matrix.config.build_type }}
-j ${{ steps.cpu-cores.outputs.count }}
# The generated source in git must match the output of workflow builds.
# If this step fails, something is changing during build. Either:
# 1. Fix non-deterministic codegen, OR
# 2. Build locally to ensure generated files are up-to-date.
- name: Check for files dirtied by codegen
run: git diff --exit-code
- name: Run Tests
run: >
ctest
--test-dir build
-j ${{ steps.cpu-cores.outputs.count }}
-C ${{ matrix.config.build_type }}
-E System
--output-on-failure
- name: Tar Linux Server Binaries
if: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases')) && (runner.os == 'Linux') }}
run: >-
tar -cvzf ni-grpc-device-server-linux-glibc${{ matrix.config.glibc_version }}-x64.tar.gz
-C ${GITHUB_WORKSPACE}/build
ni_grpc_device_server
server_config.json
server_capabilities.json
-C ${GITHUB_WORKSPACE}
LICENSE
ThirdPartyNotices.txt
- name: Upload Linux Server Binaries Artifact
uses: actions/upload-artifact@v4
if: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases')) && (runner.os == 'Linux') }}
with:
name: ni-grpc-device-server-linux-glibc${{ matrix.config.glibc_version }}-x64
path: ni-grpc-device-server-linux-glibc${{ matrix.config.glibc_version }}-x64.tar.gz
retention-days: 5
- name: Tar Linux Test Binaries
if: ${{ runner.os == 'Linux' }}
run: >-
tar -cvzf ni-grpc-device-tests-linux-glibc${{ matrix.config.glibc_version }}-x64.tar.gz
-C ${GITHUB_WORKSPACE}/build
certs/
IntegrationTestsRunner
libTestApi.so
SystemTestsRunner
test_localhost_config.json
test_mutual_tls_config.json
UnitTestsRunner
-C ${GITHUB_WORKSPACE}
LICENSE
ThirdPartyNotices.txt
- name: Upload Linux Test Binaries Artifact
uses: actions/upload-artifact@v4
if: ${{ runner.os == 'Linux' }}
with:
name: ni-grpc-device-tests-linux-glibc${{ matrix.config.glibc_version }}-x64
path: ni-grpc-device-tests-linux-glibc${{ matrix.config.glibc_version }}-x64.tar.gz
retention-days: 5
- name: Upload Windows Server Artifact
uses: actions/upload-artifact@v4
if: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases')) && (runner.os == 'Windows') }}
with:
name: ni-grpc-device-server-windows-x64
path: |
LICENSE
ThirdPartyNotices.txt
build/RelWithDebInfo/ni_grpc_device_server.exe
build/RelWithDebInfo/server_config.json
build/RelWithDebInfo/server_capabilities.json
retention-days: 5
- name: Upload Windows Test Binaries Artifact
uses: actions/upload-artifact@v4
if: ${{ runner.os == 'Windows' }}
with:
name: ni-grpc-device-tests-windows-x64
path: |
build/RelWithDebInfo/certs/
build/RelWithDebInfo/IntegrationTestsRunner.exe
build/RelWithDebInfo/TestApi.dll
build/RelWithDebInfo/SystemTestsRunner.exe
build/RelWithDebInfo/LTE20MHz Waveform (Two Subframes).json
build/RelWithDebInfo/NR_FR2_UL_SISO_CC-1_BW-50MHz_SCS-120kHz.json
build/RelWithDebInfo/WLAN_80211n_20MHz_1Seg_2Chain_MIMO.json
build/RelWithDebInfo/test_create_capture_waveform_serial/
build/RelWithDebInfo/test_localhost_config.json
build/RelWithDebInfo/test_mutual_tls_config.json
build/RelWithDebInfo/UnitTestsRunner.exe
LICENSE
ThirdPartyNotices.txt
retention-days: 5
- name: Upload Windows Server Debug Symbols Artifact
uses: actions/upload-artifact@v4
if: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/releases')) && (runner.os == 'Windows') }}
with:
name: ni-grpc-device-server-windows-x64-debug-symbols
path: |
build/RelWithDebInfo/ni_grpc_device_server.pdb
retention-days: 5