-
Notifications
You must be signed in to change notification settings - Fork 1.5k
176 lines (140 loc) · 6.36 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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
WIN_CMAKE_TOOLCHAIN: -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
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@v4
- 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 $env:WIN_CMAKE_TOOLCHAIN
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 $env:WIN_CMAKE_TOOLCHAIN
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" $env:WIN_CMAKE_TOOLCHAIN
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'
# Publish the contents of install/bin (which should be the combination libhackrf and host-tools) for Windows
- name: Publish Artifacts (Windows)
uses: actions/upload-artifact@v4
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@v4
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