Skip to content

Squash merge dev into main. Changes: #7

Squash merge dev into main. Changes:

Squash merge dev into main. Changes: #7

name: Build DigiLivolo software
on:
push:
branches: [ main ]
tags:
- "v*.*.*"
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc, clang]
include:
- os: windows-latest
c_compiler: gcc
cpp_compiler: g++
- os: windows-latest
c_compiler: clang
cpp_compiler: clang++
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
steps:
- uses: ConorMacBride/install-package@v1
with:
apt: libudev-dev
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/software/build" >> "$GITHUB_OUTPUT"
- name: Install Ninja
id: ninja
uses: turtlesec-no/get-ninja@main
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DUSE_SYSTEM_HIDAPI=false
-G Ninja
-S ${{ github.workspace }}/software
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }}
- name: Copy Linux binary
if: startsWith(matrix.os, 'ubuntu') && matrix.c_compiler == 'gcc'
shell: bash
run: |
cp ${{ steps.strings.outputs.build-output-dir }}/digilivolo ${{ steps.strings.outputs.build-output-dir }}/digilivolo-linux-x86_64
ls -l ${{ steps.strings.outputs.build-output-dir }}/digilivolo-linux-x86_64
file ${{ steps.strings.outputs.build-output-dir }}/digilivolo-linux-x86_64
- name: Copy Windows binary
if: startsWith(matrix.os, 'windows') && matrix.c_compiler == 'gcc'
run: |
copy ${{ steps.strings.outputs.build-output-dir }}\digilivolo.exe ${{ steps.strings.outputs.build-output-dir }}\digilivolo-win-x86_64.exe
dir ${{ steps.strings.outputs.build-output-dir }}\digilivolo-win-x86_64.exe
- name: Make and upload release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: false
generate_release_notes: true
make_latest: true
files: |
${{ steps.strings.outputs.build-output-dir }}/digilivolo-linux-x86_64
${{ steps.strings.outputs.build-output-dir }}/digilivolo-win-x86_64.exe