-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
164 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
name: Linux build | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
push: | ||
release: | ||
types: [published, edited] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
using_cmake: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
toolchain: | ||
- compiler: "armhf" | ||
usr_dir: "arm-linux-gnueabihf" | ||
- compiler: "arm64" | ||
usr_dir: "aarch64-linux-gnu" | ||
# - compiler: "x86_64" | ||
# usr_dir: "x86_64-linux-gnux32" | ||
# - compiler: "i686" | ||
# usr_dir: "i686-linux-gnu" | ||
- compiler: "default" # github runner is hosted on a "amd64" | ||
usr_dir: "local" | ||
|
||
steps: | ||
- name: install rpmbuild | ||
run: sudo apt-get install rpm | ||
|
||
# - name: provide toolchain (for x86_64) | ||
# if: ${{ matrix.toolchain.compiler == 'x86_64' }} | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install gcc-x86-64-linux-gnux32 g++-x86-64-linux-gnux32 | ||
|
||
# - name: provide toolchain (for i686) | ||
# if: ${{ matrix.toolchain.compiler == 'i686' }} | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install gcc-i686-linux-gnu g++-i686-linux-gnu | ||
|
||
- name: provide toolchain (for arm64) | ||
if: ${{ matrix.toolchain.compiler == 'arm64' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
- name: provide toolchain (for armhf) | ||
if: ${{ matrix.toolchain.compiler == 'armhf' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf | ||
- name: checkout RF24 | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: nRF24/RF24 | ||
ref: rp2xxx | ||
|
||
- name: build & install RF24 | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D RF24_DRIVER=SPIDEV \ | ||
-D CMAKE_INSTALL_PREFIX=/usr/${{ matrix.toolchain.usr_dir }} \ | ||
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/${{ matrix.toolchain.compiler }}.cmake | ||
sudo make install | ||
- name: checkout RF24Network | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: nRF24/RF24Network | ||
ref: CMake-4-Linux | ||
|
||
- name: build & install RF24Network | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. -D CMAKE_BUILD_TYPE=$BUILD_TYPE \ | ||
-D CMAKE_INSTALL_PREFIX=/usr/${{ matrix.toolchain.usr_dir }} \ | ||
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/${{ matrix.toolchain.compiler }}.cmake | ||
sudo make install | ||
- name: checkout RF24Mesh | ||
uses: actions/checkout@v2 | ||
|
||
- name: build & install RF24Mesh | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. -D CMAKE_BUILD_TYPE=$BUILD_TYPE \ | ||
-D CMAKE_INSTALL_PREFIX=/usr/${{ matrix.toolchain.usr_dir }} \ | ||
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/${{ matrix.toolchain.compiler }}.cmake | ||
sudo make install | ||
- name: checkout RF24Gateway | ||
uses: actions/checkout@v2 | ||
|
||
- name: create CMake build environment | ||
run: cmake -E make_directory ${{ github.workspace }}/build | ||
|
||
- name: configure lib | ||
if: ${{ matrix.toolchain.compiler == 'default' }} | ||
working-directory: ${{ github.workspace }}/build | ||
run: cmake .. -D CMAKE_BUILD_TYPE=$BUILD_TYPE | ||
|
||
- name: configure lib (with toolchain compilers) | ||
if: ${{ matrix.toolchain.compiler != 'default' }} | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cmake .. -D CMAKE_BUILD_TYPE=$BUILD_TYPE \ | ||
-D CMAKE_INSTALL_PREFIX=/usr/${{ matrix.toolchain.usr_dir }} \ | ||
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchains/${{ matrix.toolchain.compiler }}.cmake | ||
- name: build lib | ||
working-directory: ${{ github.workspace }}/build | ||
run: cmake --build . | ||
|
||
- name: install lib | ||
working-directory: ${{ github.workspace }}/build | ||
run: sudo cmake --install . | ||
|
||
- name: package lib | ||
working-directory: ${{ github.workspace }}/build | ||
run: sudo cpack | ||
|
||
- name: Save artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: "pkg_RF24Mesh" | ||
path: | | ||
${{ github.workspace }}/build/pkgs/*.deb | ||
${{ github.workspace }}/build/pkgs/*.rpm | ||
- name: Upload Release assets | ||
if: github.event_name == 'release' && (matrix.toolchain.compiler == 'armhf' || matrix.toolchain.compiler == 'arm64') | ||
uses: csexton/release-asset-action@master | ||
with: | ||
pattern: "${{ github.workspace }}/build/pkgs/librf24*" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: clean build environment | ||
working-directory: ${{ github.workspace }}/build | ||
run: sudo rm -r ./* | ||
|
||
- name: configure examples | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cmake ../examples \ | ||
-D CMAKE_TOOLCHAIN_FILE=../cmake/toolchains/${{ matrix.toolchain.compiler }}.cmake | ||
- name: build examples (none that use ncurses) | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cmake --build . --target RF24GatewayNode --target Sniffer --target RF24GatewayNodeInt | ||
file ./RF24GatewayNode |