-
-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #484 from benlye/github-actions
Configure GitHub Actions
- Loading branch information
Showing
10 changed files
with
302 additions
and
25 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,160 @@ | ||
# Workflow for testing MULTI-Module firmware builds | ||
|
||
name: CI | ||
|
||
on: | ||
# Trigger the workflow on pushes, except those that are tagged (avoids double-testing releases) | ||
push: | ||
branches: | ||
- '**' | ||
tags-ignore: | ||
- '**' | ||
|
||
# Trigger the workflow on pull requests to the master branch | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
# Triggers the workflow on release creation | ||
release: | ||
types: | ||
- created | ||
|
||
# Allows the workflow to be triggered manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
# Configure the board matrix | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
board: [ | ||
"multi4in1:avr:multiatmega328p:bootloader=none", | ||
"multi4in1:avr:multiatmega328p:bootloader=optiboot", | ||
"multi4in1:avr:multixmega32d4", | ||
"multi4in1:STM32F1:multi5in1t18int", | ||
"multi4in1:STM32F1:multistm32f103cb:debug_option=none", | ||
"multi4in1:STM32F1:multistm32f103cb:debug_option=native", | ||
"multi4in1:STM32F1:multistm32f103cb:debug_option=ftdi", | ||
"multi4in1:STM32F1:multistm32f103c8:debug_option=none" | ||
] | ||
|
||
# Set the environment variables | ||
env: | ||
BOARD: ${{ matrix.board }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Arduino CLI | ||
uses: arduino/[email protected] | ||
|
||
- name: Prepare build environment | ||
run: | | ||
echo "Github Ref: $GITHUB_REF" | ||
echo "Event name: ${{ github.event_name }}" | ||
echo "Event action: ${{ github.event.action }}" | ||
echo "Tag name: ${{ github.event.release.tag_name }}" | ||
arduino-cli config init --additional-urls https://raw.githubusercontent.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/master/package_multi_4in1_board_index.json | ||
arduino-cli core update-index | ||
if [[ "$BOARD" =~ "multi4in1:avr:" ]]; then | ||
arduino-cli core install arduino:avr; | ||
arduino-cli core install multi4in1:avr | ||
fi | ||
if [[ "$BOARD" =~ "multi4in1:STM32F1:" ]]; then | ||
arduino-cli core install multi4in1:STM32F1 | ||
fi | ||
chmod +x ${GITHUB_WORKSPACE}/buildroot/bin/* | ||
echo "${GITHUB_WORKSPACE}/buildroot/bin" >> $GITHUB_PATH | ||
mkdir ./build | ||
mkdir ./binaries | ||
- name: Configure MULTI-Module firmware options | ||
run: | | ||
# Load the build functions | ||
source ./buildroot/bin/buildFunctions; | ||
# Get all the protocols for this board | ||
getAllProtocols | ||
# Disable CHECK_FOR_BOOTLOADER when not needed | ||
if [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=none" ]]; then | ||
opt_disable CHECK_FOR_BOOTLOADER; | ||
fi | ||
# Trim the build down for the Atmega328p board | ||
if [[ "$BOARD" =~ "multi4in1:avr:multiatmega328p:" ]]; then | ||
opt_disable $ALL_PROTOCOLS | ||
opt_enable FRSKYX_CC2500_INO AFHDS2A_A7105_INO MJXQ_NRF24L01_INO DSM_CYRF6936_INO; | ||
fi | ||
# Trim the enabled protocols down for the STM32F103CB board with debugging or the STM32F103C8 board in general | ||
if [[ "$BOARD" == "multi4in1:STM32F1:multistm32f103cb:debug_option=ftdi" ]] || [[ "$BOARD" == "multi4in1:STM32F1:multistm32f103cb:debug_option=native" ]] || [[ "$BOARD" =~ "multi4in1:STM32F1:multistm32f103c8" ]]; then | ||
opt_disable $ALL_PROTOCOLS; | ||
opt_enable FRSKYX_CC2500_INO AFHDS2A_A7105_INO MJXQ_NRF24L01_INO DSM_CYRF6936_INO; | ||
fi | ||
- name: Save default firmware configuration | ||
run: | | ||
cat Multiprotocol/_Config.h | ||
cp Multiprotocol/_Config.h ./_Config.h.bak | ||
- name: Build default configuration | ||
run: | | ||
source ./buildroot/bin/buildFunctions; | ||
buildMulti | ||
- name: Build serial only | ||
run: | | ||
source ./buildroot/bin/buildFunctions; | ||
cp ./_Config.h.bak Multiprotocol/_Config.h | ||
opt_disable ENABLE_PPM; | ||
buildMulti; | ||
- name: Build PPM only | ||
run: | | ||
source ./buildroot/bin/buildFunctions; | ||
cp ./_Config.h.bak Multiprotocol/_Config.h | ||
opt_disable ENABLE_SERIAL; | ||
buildMulti; | ||
- name: Build each RF module individually | ||
run: | | ||
source ./buildroot/bin/buildFunctions; | ||
cp ./_Config.h.bak Multiprotocol/_Config.h; | ||
buildEachRFModule; | ||
- name: Build each protocol individually | ||
run: | | ||
source ./buildroot/bin/buildFunctions; | ||
cp ./_Config.h.bak Multiprotocol/_Config.h; | ||
buildEachProtocol; | ||
- name: Build release files | ||
run: | | ||
source ./buildroot/bin/buildFunctions; | ||
cp ./_Config.h.bak Multiprotocol/_Config.h; | ||
buildReleaseFiles; | ||
ls -al ./binaries; | ||
NUM_FILES=$(ls -l ./binaries | grep ^- | wc -l); | ||
if [ $NUM_FILES -gt 0 ]; then | ||
echo "HAVE_FILES=true" >> $GITHUB_ENV | ||
else | ||
echo "HAVE_FILES=false" >> $GITHUB_ENV | ||
fi | ||
- name: Deploy files to release | ||
if: github.event_name == 'release' && github.event.action == 'created' && env.HAVE_FILES == 'true' | ||
uses: AButler/[email protected] | ||
with: | ||
files: './binaries/*' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
File renamed without changes.
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,105 @@ | ||
#!/usr/bin/env bash | ||
|
||
getMultiVersion() { | ||
MAJOR_VERSION=$(grep "VERSION_MAJOR" "Multiprotocol/Multiprotocol.h" | awk -v N=3 '{gsub(/\r/,""); print $N}') | ||
MINOR_VERSION=$(grep "VERSION_MINOR" "Multiprotocol/Multiprotocol.h" | awk -v N=3 '{gsub(/\r/,""); print $N}') | ||
REVISION_VERSION=$(grep "VERSION_REVISION" "Multiprotocol//Multiprotocol.h" | awk -v N=3 '{gsub(/\r/,""); print $N}') | ||
PATCH_VERSION=$(grep "VERSION_PATCH" "Multiprotocol//Multiprotocol.h" | awk -v N=3 '{gsub(/\r/,""); print $N}') | ||
MULTI_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$REVISION_VERSION.$PATCH_VERSION | ||
} | ||
|
||
getAllRFModules() { | ||
if [[ "$BOARD" =~ "multi4in1:avr:multixmega32d4" ]]; then | ||
ALL_RFMODULES=$(echo CYRF6936_INSTALLED); | ||
elif [[ "$BOARD" =~ "multi4in1:avr:multiatmega328p:" ]]; then | ||
ALL_RFMODULES=$(echo A7105_INSTALLED CYRF6936_INSTALLED CC2500_INSTALLED NRF24L01_INSTALLED); | ||
elif [[ "$BOARD" =~ "multi4in1:STM32F1:" ]]; then | ||
ALL_RFMODULES=$(echo A7105_INSTALLED CYRF6936_INSTALLED CC2500_INSTALLED NRF24L01_INSTALLED SX1276_INSTALLED); | ||
fi | ||
} | ||
|
||
getAllProtocols() { | ||
A7105_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_A7105_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h) | ||
CC2500_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_CC2500_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h) | ||
CYRF6936_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_CYRF6936_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h) | ||
NRF24L01_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_NRF24L01_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h) | ||
SX1276_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_SX1276_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h) | ||
|
||
if [[ "$BOARD" =~ "multi4in1:avr:multixmega32d4" ]]; then | ||
ALL_PROTOCOLS=$(echo $CYRF6936_PROTOCOLS); | ||
elif [[ "$BOARD" =~ "multi4in1:avr:multiatmega328p:" ]]; then | ||
ALL_PROTOCOLS=$(echo $A7105_PROTOCOLS $CC2500_PROTOCOLS $CYRF6936_PROTOCOLS $NRF24L01_PROTOCOLS); | ||
elif [[ "$BOARD" =~ "multi4in1:STM32F1:" ]]; then | ||
ALL_PROTOCOLS=$(echo $A7105_PROTOCOLS $CC2500_PROTOCOLS $CYRF6936_PROTOCOLS $NRF24L01_PROTOCOLS $SX1276_PROTOCOLS); | ||
fi | ||
} | ||
|
||
buildMulti() { | ||
echo ::group::_Config.h | ||
git diff Multiprotocol/_Config.h | ||
echo ::endgroup:: | ||
BUILDCMD="arduino-cli compile -b $BOARD ${GITHUB_WORKSPACE}/Multiprotocol/Multiprotocol.ino --build-path ${GITHUB_WORKSPACE}/build/"; | ||
echo $BUILDCMD; | ||
$BUILDCMD | ||
return $? | ||
} | ||
|
||
buildProtocol() { | ||
exitcode=0; | ||
opt_disable $ALL_PROTOCOLS; | ||
opt_enable $1; | ||
buildMulti; | ||
if [ $? -ne 0 ]; then exitcode=1; fi; | ||
return $exitcode; | ||
} | ||
|
||
buildEachProtocol() { | ||
getAllProtocols; | ||
exitcodesum=0; | ||
for PROTOCOL in $ALL_PROTOCOLS ; do | ||
printf "\e[33;1mBuilding $PROTOCOL\e[0m\n"; | ||
buildProtocol $PROTOCOL; | ||
if [ $? -ne 0 ]; then exitcodesum=$((exitcodesum + 1)); fi; | ||
done; | ||
return $exitcodesum; | ||
} | ||
|
||
buildRFModule() { | ||
exitcode=0; | ||
opt_disable $ALL_RFMODULES; | ||
opt_enable $1; | ||
buildMulti; | ||
if [ $? -ne 0 ]; then exitcode=1; fi; | ||
return $exitcode; | ||
} | ||
|
||
buildEachRFModule() { | ||
getAllRFModules; | ||
exitcodesum=0; | ||
for RFMODULE in $ALL_RFMODULES; do | ||
printf "\e[33;1mBuilding $RFMODULE\e[0m\n"; | ||
buildRFModule $RFMODULE; | ||
if [ $? -ne 0 ]; then exitcodesum=$((exitcodesum + 1)); fi; | ||
done; | ||
return $exitcodesum; | ||
} | ||
|
||
buildReleaseFiles(){ | ||
if [[ "$BOARD" == "multi4in1:avr:multixmega32d4" ]]; then | ||
build_release_orx; | ||
elif [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=none" ]]; then | ||
build_release_avr_noboot; | ||
elif [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=optiboot" ]]; then | ||
build_release_avr_optiboot; | ||
elif [[ "$BOARD" == "multi4in1:STM32F1:multistm32f103cb:debug_option=none" ]]; then | ||
build_release_stm32f1_no_debug; | ||
elif [[ "$BOARD" == "multi4in1:STM32F1:multistm32f103cb:debug_option=native" ]]; then | ||
build_release_stm32f1_native_debug; | ||
elif [[ "$BOARD" == "multi4in1:STM32F1:multistm32f103cb:debug_option=ftdi" ]]; then | ||
build_release_stm32f1_serial_debug; | ||
elif [[ "$BOARD" == "multi4in1:STM32F1:multi5in1t18int" ]]; then | ||
build_release_stm32f1_t18int; | ||
else | ||
printf "No release files for this board."; | ||
fi | ||
} |
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
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
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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
source ./buildroot/bin/buildFunctions; | ||
getMultiVersion; | ||
exitcode=0; | ||
|
||
printf "\n\e[33;1mBuilding multi-orangerx-aetr-green-inv-v$MULTI_VERSION.bin\e[0m"; | ||
printf "\e[33;1mBuilding multi-orangerx-aetr-green-inv-v$MULTI_VERSION.bin\e[0m\n"; | ||
opt_enable $ALL_PROTOCOLS; | ||
opt_disable ORANGE_TX_BLUE; | ||
buildMulti; | ||
exitcode=$((exitcode+$?)); | ||
mv build/Multiprotocol.ino.bin ./binaries/multi-orangerx-aetr-green-inv-v$MULTI_VERSION.bin; | ||
|
||
printf "\n\e[33;1mBuilding multi-orangerx-aetr-blue-inv-v$MULTI_VERSION.bin\e[0m"; | ||
printf "\e[33;1mBuilding multi-orangerx-aetr-blue-inv-v$MULTI_VERSION.bin\e[0m\n"; | ||
opt_enable ORANGE_TX_BLUE; | ||
buildMulti; | ||
exitcode=$((exitcode+$?)); | ||
mv build/Multiprotocol.ino.bin ./binaries/multi-orangerx-aetr-blue-inv-v$MULTI_VERSION.bin; | ||
|
||
printf "\n\e[33;1mPackaging ancilliary files for v$MULTI_VERSION\e[0m\n"; | ||
printf "\e[33;1mPackaging ancilliary files for v$MULTI_VERSION\e[0m\n"; | ||
cp Multiprotocol/Multi.txt ./binaries/Multi.txt; | ||
mkdir -p SCRIPTS/TOOLS; | ||
cp Lua_scripts/*.lua SCRIPTS/TOOLS/; | ||
cp Lua_scripts/*.txt SCRIPTS/TOOLS/; | ||
zip -q ./binaries/MultiLuaScripts.zip SCRIPTS/TOOLS/*; | ||
|
||
printf "\n"; | ||
|
||
exit $exitcode; |
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
Oops, something went wrong.