Auto-package windows binaries on build (and fix a few bugs and warnings) #755
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: Build | |
on: | |
push: | |
pull_request: | |
# Run automatically every monday | |
schedule: | |
- cron: 1 12 * * 1 | |
env: | |
WIN_LIBUSB_INC: -DLIBUSB_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include/libusb-1.0 | |
WIN_LIBUSB_LIB: -DLIBUSB_LIBRARIES=C:/vcpkg/installed/x64-windows/lib/libusb-1.0.lib | |
WIN_FFTW_INC: -DFFTW_INCLUDES=C:/vcpkg/installed/x64-windows/include | |
WIN_FFTW_LIB: -DFFTW_LIBRARIES=C:/vcpkg/installed/x64-windows/lib/fftw3f.lib | |
WIN_PTHREAD_INC: -DTHREADS_PTHREADS_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include | |
WIN_PTHREAD_LIB: -DTHREADS_PTHREADS_WIN32_LIBRARY=C:/vcpkg/installed/x64-windows/lib/pthreadvc3.lib | |
jobs: | |
host: | |
strategy: | |
matrix: | |
os: ['macos-latest', 'ubuntu-latest', 'windows-latest'] | |
# Don't cancel all builds when one fails | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies (macOS) | |
run: brew install fftw | |
if: matrix.os == 'macos-latest' | |
- name: Install dependencies (Ubuntu) | |
run: | | |
sudo apt update | |
sudo apt install libfftw3-dev libusb-1.0-0-dev | |
if: matrix.os == 'ubuntu-latest' | |
- name: Install dependencies (Windows) | |
run: vcpkg install --triplet=x64-windows libusb fftw3 pthreads | |
if: matrix.os == 'windows-latest' | |
# Build libhackrf and hackrf-tools together | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/host/build | |
- name: Configure CMake | |
working-directory: ${{github.workspace}}/host/build | |
run: cmake $GITHUB_WORKSPACE/host/ -DCMAKE_BUILD_TYPE=Release | |
if: matrix.os != 'windows-latest' | |
- name: Configure CMake (Windows) | |
working-directory: ${{github.workspace}}/host/build | |
run: cmake $env:GITHUB_WORKSPACE/host/ $env:WIN_LIBUSB_INC $env:WIN_LIBUSB_LIB $env:WIN_FFTW_INC $env:WIN_FFTW_LIB $env:WIN_PTHREAD_INC $env:WIN_PTHREAD_LIB | |
if: matrix.os == 'windows-latest' | |
- name: Build | |
working-directory: ${{github.workspace}}/host/build | |
run: cmake --build . --config Release | |
# Build libhackrf ONLY | |
- name: Create Build Environment (libhackrf) | |
run: cmake -E make_directory ${{github.workspace}}/host/libhackrf/build | |
- name: Configure CMake (libhackrf) | |
working-directory: ${{github.workspace}}/host/libhackrf/build | |
run: cmake $GITHUB_WORKSPACE/host/libhackrf/ -DCMAKE_BUILD_TYPE=Release | |
if: matrix.os != 'windows-latest' | |
- name: Configure CMake (libhackrf, Windows) | |
working-directory: ${{github.workspace}}/host/libhackrf/build | |
run: cmake $env:GITHUB_WORKSPACE/host/libhackrf/ $env:WIN_LIBUSB_INC $env:WIN_LIBUSB_LIB $env:WIN_PTHREAD_INC $env:WIN_PTHREAD_LIB | |
if: matrix.os == 'windows-latest' | |
- name: Build (libhackrf) | |
working-directory: ${{github.workspace}}/host/libhackrf/build | |
run: cmake --build . --config Release | |
- name: Install (libhackrf) | |
working-directory: ${{github.workspace}}/host/libhackrf/build | |
run: | | |
sudo cmake --install . --config Release | |
if: matrix.os != 'windows-latest' | |
- name: Install (libhackrf, Windows) | |
working-directory: ${{github.workspace}}/host/libhackrf/build | |
run: | | |
cmake --install . --config Release --prefix=$env:GITHUB_WORKSPACE/install | |
if: matrix.os == 'windows-latest' | |
# Build hackrf-tools ONLY | |
- name: Create Build Environment (hackrf-tools) | |
run: cmake -E make_directory ${{github.workspace}}/host/hackrf-tools/build | |
- name: Configure CMake (hackrf-tools) | |
working-directory: ${{github.workspace}}/host/hackrf-tools/build | |
run: cmake $GITHUB_WORKSPACE/host/hackrf-tools/ -DCMAKE_BUILD_TYPE=Release | |
if: matrix.os != 'windows-latest' | |
- name: Configure CMake (hackrf-tools, Windows) | |
working-directory: ${{github.workspace}}/host/hackrf-tools/build | |
run: | | |
cmake $env:GITHUB_WORKSPACE/host/hackrf-tools/ $env:WIN_FFTW_INC $env:WIN_FFTW_LIB -DLIBHACKRF_INCLUDE_DIR="$env:GITHUB_WORKSPACE/install/include/libhackrf" -DLIBHACKRF_LIBRARIES="$env:GITHUB_WORKSPACE/install/bin/hackrf.lib" | |
if: matrix.os == 'windows-latest' | |
- name: Build (hackrf-tools) | |
working-directory: ${{github.workspace}}/host/hackrf-tools/build | |
run: cmake --build . --config Release | |
- name: Install (hackrf-tools) | |
working-directory: ${{github.workspace}}/host/hackrf-tools/build | |
run: sudo cmake --install . --config Release | |
if: matrix.os != 'windows-latest' | |
- name: Install (hackrf-tools, Windows) | |
working-directory: ${{github.workspace}}/host/hackrf-tools/build | |
run: cmake --install . --config Release --prefix=$env:GITHUB_WORKSPACE/install | |
if: matrix.os == 'windows-latest' | |
- name: Publish Artifacts (Windows) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: hackrf-tools-windows | |
path: ${{github.workspace}}/install/bin | |
if: matrix.os == 'windows-latest' | |
firmware: | |
strategy: | |
matrix: | |
os: ['macos-latest', 'ubuntu-latest'] | |
board: ['HACKRF_ONE', 'JAWBREAKER', 'RAD1O'] | |
# Don't cancel all builds when one fails | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install dependencies (macOS) | |
run: | | |
brew install --cask gcc-arm-embedded | |
brew install dfu-util | |
pip3 install PyYAML | |
if: matrix.os == 'macos-latest' | |
- name: Install dependencies (Ubuntu) | |
run: | | |
sudo apt install dfu-util gcc-arm-none-eabi | |
if: matrix.os == 'ubuntu-latest' | |
- name: Build libopencm3 | |
shell: bash | |
working-directory: ${{github.workspace}}/firmware/libopencm3/ | |
run: make | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/firmware/build | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{github.workspace}}/firmware/build | |
run: cmake $GITHUB_WORKSPACE/firmware/ -DCMAKE_BUILD_TYPE=Release -DBOARD=${{ matrix.board }} | |
- name: Build | |
working-directory: ${{github.workspace}}/firmware/build | |
shell: bash | |
run: cmake --build . --config Release | |