Determine file path using build type #2286
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ashutoshvarma/setup-ninja@v1.1 | ||
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 }} | ||
- name: Build | ||
run: > | ||
cmake | ||
--build build | ||
--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: [Debug] Try running SystemTests | ||
if: ${{ runner.os == 'Windows' }} | ||
run: > | ||
build/RelWithDebInfo/SystemTestsRunner.exe --help | ||
- 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 |