log listener init and invocation #1342
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: Build Release Artifacts | |
on: | |
push: | |
release: | |
types: [published] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [windows-2022, ubuntu-20.04, macos-12] | |
include: | |
- os: windows-2022 | |
exe_postfix: .zip | |
friendly_name: windows | |
workflow: windows_vcpkg_static | |
generate_extra_options: -DNABTO_DEVICE_USE_VCPKG=ON -DNABTO_DEVICE_PREFER_SYSTEM_LIBS=ON | |
build_command: cmake --build build-dir --parallel --target install --config Release | |
- os: ubuntu-20.04 | |
workflow: linux_vcpkg | |
exe_postfix: | |
friendly_name: linux_x86_64 | |
build_command: cmake --build build-dir --parallel --target install | |
- os: macos-12 | |
workflow: mac_fetchcontent_universal | |
exe_postfix: | |
friendly_name: macos | |
# 2024-01-05: Sometimes mac fails on github actions when doing builds so we use make without parallellism directly, since we hope that fixes the unknown problem. | |
build_command: cd build-dir && make -j 1 install | |
name: Build | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- if: matrix.os == 'ubuntu-20.04' | |
name: Install Ninja | |
run: sudo apt-get update && sudo apt-get install -y ninja-build | |
- if: matrix.os == 'macos-12' | |
name: Install Ninja | |
run: brew install ninja | |
- name: Build | |
run: cmake --workflow --preset ${{matrix.workflow}} | |
- if: matrix.os != 'windows-2022' | |
name: Prepare assets | |
run: | | |
mkdir -p ${{ github.workspace }}/artifacts/bin | |
mv ${{ github.workspace }}/build/${{ matrix.workflow }}/install/bin/tcp_tunnel_device ${{ github.workspace }}/artifacts/bin/tcp_tunnel_device_${{matrix.friendly_name}} | |
mv ${{ github.workspace }}/build/${{matrix.workflow}}/install/bin/thermostat_device ${{ github.workspace }}/artifacts/bin/thermostat_device_${{matrix.friendly_name}} | |
- if: matrix.os == 'windows-2022' | |
name: Prepare assets windows | |
run: | | |
mkdir -p ${{ github.workspace }}/release-tunnel | |
mkdir -p ${{ github.workspace }}/artifacts/bin | |
mv ${{ github.workspace }}/build/${{ matrix.workflow }}/install/bin/tcp_tunnel_device.exe ${{ github.workspace }}/release-tunnel/tcp_tunnel_device_windows.exe | |
cp ${{ github.workspace }}/build/${{ matrix.workflow }}/install/bin/*.dll ${{ github.workspace }}/release-tunnel/ | |
Compress-Archive -Path ${{ github.workspace }}/release-tunnel/* -Destination ${{ github.workspace }}/artifacts/bin/tcp_tunnel_device_windows.zip | |
mkdir -p ${{ github.workspace }}/release-thermostat | |
mv ${{ github.workspace }}/build/${{ matrix.workflow }}/install/bin/thermostat_device.exe ${{ github.workspace }}/release-thermostat/thermostat_device_${{matrix.friendly_name}}.exe | |
cp ${{ github.workspace }}/build/${{ matrix.workflow }}/install/bin/*.dll ${{ github.workspace }}/release-thermostat/ | |
Compress-Archive -Path ${{ github.workspace }}/release-thermostat/* -Destination ${{ github.workspace }}/artifacts/bin/thermostat_device_windows.zip | |
- name: Upload artifacts to github actions workspace artifacts | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
# omit name and upload to defaults artifacts archive called artifact. | |
path: | | |
${{ github.workspace }}/artifacts/bin/tcp_tunnel_device_${{matrix.friendly_name}}${{ matrix.exe_postfix }} | |
${{ github.workspace }}/artifacts/bin/thermostat_device_${{matrix.friendly_name}}${{ matrix.exe_postfix }} | |
if-no-files-found: error | |
build-linux-arm: | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
arch: [armv6, armhf, aarch64] | |
include: | |
- arch: armv6 | |
compiler: arm-linux-gnueabihf | |
toolchain: https://nabto-build-assets.s3.eu-west-1.amazonaws.com/toolchains/cross-gcc-9.4.0-pi_0-1.tar.gz | |
- arch: armhf | |
compiler: arm-linux-gnueabihf | |
toolchain: https://nabto-build-assets.s3.eu-west-1.amazonaws.com/toolchains/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz | |
- arch: aarch64 | |
compiler: aarch64-linux-gnu | |
toolchain: https://nabto-build-assets.s3.eu-west-1.amazonaws.com/toolchains/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Get required packages | |
run: sudo apt install libarchive-tools | |
- name: Create directory | |
run: mkdir toolchain | |
- name: Get toolchain | |
working-directory: toolchain | |
run: curl -sSL ${{ matrix.toolchain }} | bsdtar -xf - --strip-components=1 | |
- name: Configure CMake | |
env: | |
CC: ${{github.workspace}}/toolchain/bin/${{ matrix.compiler }}-gcc | |
CXX: ${{github.workspace}}/toolchain/bin/${{ matrix.compiler }}-g++ | |
run: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/artifacts -B ${{github.workspace}}/build | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --parallel | |
- name: Install | |
run: cmake --build ${{github.workspace}}/build --target install | |
- name: Print architecture | |
run: file ${{ github.workspace }}/artifacts/bin/tcp_tunnel_device | |
- name: Prepate assets | |
run: | | |
mv ${{ github.workspace }}/artifacts/bin/tcp_tunnel_device ${{ github.workspace }}/artifacts/bin/tcp_tunnel_device_linux_${{matrix.arch}} | |
mv ${{ github.workspace }}/artifacts/bin/thermostat_device ${{ github.workspace }}/artifacts/bin/thermostat_device_linux_${{matrix.arch}} | |
- name: Upload artifacts | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
path: | | |
${{ github.workspace }}/artifacts/bin/tcp_tunnel_device_linux_${{matrix.arch}} | |
${{ github.workspace }}/artifacts/bin/thermostat_device_linux_${{matrix.arch}} | |
if-no-files-found: error | |
upload-artifacts: | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
binary: [tcp_tunnel_device, thermostat_device] | |
suffix: [linux_x86_64, linux_armv6, linux_armhf, linux_aarch64, windows.zip, macos] | |
name: Release Assets | |
needs: [ build, build-linux-arm ] | |
runs-on: ubuntu-22.04 | |
permissions: | |
# give access to upload an artifacts to gh releases | |
contents: write | |
if: github.event_name == 'release' | |
steps: | |
- name: download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./ | |
- name: list files | |
run: ls -R | |
- name: Upload Source Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./artifact/${{matrix.binary}}_${{matrix.suffix}} | |
asset_name: ${{matrix.binary}}_${{matrix.suffix}} | |
asset_content_type: application/octet-stream |