RadioLibSmol/.github/workflows/main.yml
2020-08-22 13:27:53 +02:00

104 lines
3.5 KiB
YAML

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
Build:
strategy:
matrix:
board:
- arduino:avr:uno
- arduino:avr:mega:cpu=atmega2560
- arduino:avr:leonardo
- esp8266:esp8266:generic:xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K
- arduino:samd:arduino_zero_native
runs-on: ubuntu-latest
name: ${{ matrix.board }}
env:
run-build: ${{ (matrix.board == 'arduino:avr:uno') || contains(github.event.head_commit.message, 'CI_FORCE_BUILD') || contains(github.event.head_commit.message, 'Bump version to') }}
steps:
- name: Install arduino-cli
if: ${{ env.run-build == 'true' }}
run: |
mkdir -p ~/.local/bin
echo "::add-path::~/.local/bin"
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=~/.local/bin sh
- name: Get platform name
uses: jungwinter/split@v1
id: split
with:
msg: ${{ matrix.board }}
seperator: ':'
- name: Prepare platform-specific settings
id: prep
env:
warnings: 'all'
run: |
if [[ "${{ contains(matrix.board, 'esp8266') }}" == "true" ]]; then
echo "::set-output name=skip-path::'HTTP|MQTT).*ino'"
echo "::set-output name=index-url::'--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json'"
else
echo "::set-output name=skip-path::''"
echo "::set-output name=index-url::''"
fi
- name: Install platform
if: ${{ env.run-build == 'true' }}
run: |
arduino-cli core update-index ${{ format('{0}', steps.prep.outputs.index-url) }}
arduino-cli core install ${{ format('{0}:{1}', steps.split.outputs._0, steps.split.outputs._1) }}
- name: Checkout repository
if: ${{ env.run-build == 'true' }}
uses: actions/checkout@v2
- name: Build examples
if: ${{ env.run-build == 'true' }}
run: |
for example in $(find $PWD/examples -name '*.ino' | sort); do
# check whether to skip this sketch
if [ ! -z "${{ steps.prep.outputs.skip-path }}" ] && [[ ${example} =~ "${{ steps.prep.outputs.skip-path }}" ]]; then
# skip sketch
echo -e "\n\033[1;33mSkipped ${example##*/} (matched with ${{ steps.prep.outputs.skip-path }})\033[0m";
else
# build sketch
echo -e "\n\033[1;33mBuilding ${example##*/} ... \033[0m";
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn ${{ matrix.board }} $example --warnings=${{ steps.prep.env.warnings }}
if [ $? -ne 0 ]; then
echo -e "\033[1;31m${example##*/} build FAILED\033[0m\n";
exit 1;
else
echo -e "\033[1;32m${example##*/} build PASSED\033[0m\n";
fi
fi
done
Doxygen:
runs-on: ubuntu-latest
steps:
- name: Install Doxygen
run: |
sudo apt-get update;
sudo apt-get install -y doxygen;
- uses: actions/checkout@v2
- name: Generate docs
run: doxygen Doxyfile
- uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/html