Build using Ninja on Windows and Linux Desktop #2285
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_platform: "", | ||
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", | ||
cmake_platform: "", | ||
glibc_version: "2_31", | ||
cmake_generator: '-G "Ninja"' | ||
build_type: RelWithDebInfo | ||
} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
- name: Setup python3 | ||
uses: actions/setup-python@v2 | ||
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/[email protected] | ||
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=${{ cmatrix.config.build_type }} ${{ cmatrix.config.cmake_generator }} | ||
- name: Build | ||
run: | | ||
cmake --build build --config ${{ cmatrix.config.build_type }} -j ${{ steps.cpu-cores.outputs.count }} | ||
# - name: Build & Test | ||
# uses: ashutoshvarma/action-cmake-build@v1 | ||
# with: | ||
# build-dir: ${{ github.workspace }}/build | ||
# cc: ${{ matrix.config.cc }} | ||
# cxx: ${{ matrix.config.cxx }} | ||
# build-type: $ENV{BUILD_TYPE} | ||
# configure-options: ${{ matrix.config.cmake_generator }} | ||
# build-options: --config $ENV{BUILD_TYPE} | ||
# run-test: true | ||
# ctest-options: -C $ENV{BUILD_TYPE} -E System --output-on-failure | ||
# parallel: ${{ steps.cpu-cores.outputs.count }} | ||
# - name: Configure | ||
# run: | | ||
# cmake -S . -B build -D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} | ||
# shell: cmake -P {0} | ||
# run: | | ||
# set(ENV{CC} ${{ matrix.config.cc }}) | ||
# set(ENV{CXX} ${{ matrix.config.cxx }}) | ||
# set(path_separator ":") | ||
# if ("${{ runner.os }}" STREQUAL "Windows") | ||
# set(path_separator ";") | ||
# endif() | ||
# set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") | ||
# execute_process( | ||
# COMMAND cmake | ||
# -S . | ||
# -B build | ||
# -D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} | ||
# ${{ matrix.config.cmake_generator }} | ||
# RESULT_VARIABLE result | ||
# ) | ||
# if (NOT result EQUAL 0) | ||
# message(FATAL_ERROR "Bad exit status") | ||
# endif() | ||
# | ||
# - name: Build | ||
# run: | | ||
# cmake --build build --config $ENV{BUILD_TYPE} -j ${{ steps.cpu-cores.outputs.count }} | ||
# # shell: cmake -P {0} | ||
# # run: | | ||
# # execute_process( | ||
# # COMMAND cmake --build build --config $ENV{BUILD_TYPE} -j ${{ steps.cpu-cores.outputs.count }} | ||
# # RESULT_VARIABLE result | ||
# # OUTPUT_VARIABLE output | ||
# # ERROR_VARIABLE output | ||
# # ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE | ||
# # ) | ||
# # if (NOT result EQUAL 0) | ||
# # string(REGEX MATCH "FAILED:.*$" error_message "${output}") | ||
# # string(REPLACE "\n" "%0A" error_message "${error_message}") | ||
# # message("::error::${error_message}") | ||
# # message(FATAL_ERROR "Build failed") | ||
# # endif() | ||
# 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 ${{ cmatrix.config.build_type }} -E System --output-on-failure | ||
# - name: Run Tests | ||
# shell: cmake -P {0} | ||
# run: | | ||
# include(ProcessorCount) | ||
# ProcessorCount(N) | ||
# | ||
# execute_process( | ||
# COMMAND ctest -j ${N} -C $ENV{BUILD_TYPE} -E System --output-on-failure | ||
# WORKING_DIRECTORY build | ||
# RESULT_VARIABLE result | ||
# ) | ||
# if (NOT result EQUAL 0) | ||
# message(FATAL_ERROR "Running tests failed!") | ||
# endif() | ||
- 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 |