パラメータ設定 #112
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: Arduino CI | |
on: | |
pull_request: | |
jobs: | |
check-formatting: | |
runs-on: ubuntu-latest | |
env: | |
# See: https://github.com/arduino/arduino-ide/blob/main/arduino-ide-extension/package.json | |
CLANG_FORMAT_VERSION: 14.0.0 | |
steps: | |
- name: Set environment variables | |
run: | | |
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable | |
echo "CLANG_FORMAT_INSTALL_PATH=${{ runner.temp }}/clang-format" >> "$GITHUB_ENV" | |
echo "REVIEWDOG_INSTALL_PATH=${{ runner.temp }}/reviewdog" >> "$GITHUB_ENV" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download ClangFormat | |
id: download | |
uses: MrOctopus/download-asset-action@1.0 | |
with: | |
repository: arduino/clang-static-binaries | |
tag: ${{ env.CLANG_FORMAT_VERSION }} | |
asset: clang-format_${{ env.CLANG_FORMAT_VERSION }}_Linux_64bit.tar.bz2 | |
target: ${{ env.CLANG_FORMAT_INSTALL_PATH }} | |
- name: Install ClangFormat | |
run: | | |
cd "${{ env.CLANG_FORMAT_INSTALL_PATH }}" | |
tar --extract --file="${{ steps.download.outputs.name }}" | |
# Add installation to PATH: | |
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path | |
echo "${{ env.CLANG_FORMAT_INSTALL_PATH }}/clang_Linux_64bit" >> "$GITHUB_PATH" | |
- name: Format examples | |
run: | | |
find \ | |
\( \ | |
-name '*.c' -or \ | |
-name '*.cpp' -or \ | |
-name '*.h' -or \ | |
-name '*.ino' -or \ | |
-name '*.ipp' -or \ | |
-name '*.tpp' \ | |
\) \ | |
-type f \ | |
-exec \ | |
clang-format \ | |
--assume-filename=foo.cpp \ | |
-i \ | |
--style=file \ | |
{} \; | |
- name: Install Reviewdog | |
run: | | |
wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b ${{ env.REVIEWDOG_INSTALL_PATH }} | |
echo "${{ env.REVIEWDOG_INSTALL_PATH }}" >> "$GITHUB_PATH" | |
- name: Check formatting | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
if ! git diff --color --exit-code; then | |
git diff | reviewdog -f=diff -name="format-check" -reporter=github-pr-review | |
echo "Please do an Auto Format on the sketches:" | |
echo "Arduino IDE: Tools > Auto Format" | |
echo "Arduino Web Editor: Ctrl + B" | |
exit 1 | |
fi | |
cpplint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: reviewdog/action-cpplint@master | |
with: | |
github_token: ${{ secrets.github_token }} | |
reporter: github-pr-review | |
flags: --extensions=h,hpp,c,cpp,cc,cu,hh,ipp,ino --exclude=./test/Nose/,./Main/utility/,./Main/Adafruit_BNO055.cpp,/Main/Adafruit_BNO055.h | |
filter: "-readability/braces\ | |
,-whitespace/braces\ | |
,-whitespace/comments\ | |
,-whitespace/indent\ | |
,-whitespace/newline\ | |
,-whitespace/operators\ | |
,-whitespace/parens\ | |
,-whitespace/tab\ | |
,-whitespace/line_length\ | |
,-build/header_guard\ | |
" # Optional | |
build: | |
name: ${{ matrix.code.sketch-paths }} | |
runs-on: ubuntu-latest | |
env: | |
UNIVERSAL_LIBRARIES: | | |
- name: Servo | |
version: latest | |
- name: Adafruit BusIO | |
version: latest | |
- name: Adafruit Unified Sensor | |
version: latest | |
- name: Adafruit BME280 Library | |
version: latest | |
- name: TinyGPSPlus | |
version: latest | |
- name: Adafruit LPS35HW | |
version: latest | |
- source-url: https://github.com/uChip/MCP342X.git | |
- source-url: https://github.com/core-rocket/CCP.git | |
- source-url: https://github.com/core-rocket/Opener.git | |
- source-url: https://github.com/coryjfowler/MCP_CAN_lib.git | |
- source-url: https://github.com/771-8bit/W25Q512.git | |
- source-url: https://github.com/sdesalas/Arduino-Queue.h.git | |
strategy: | |
fail-fast: false | |
matrix: | |
code: | |
- sketch-paths: Main | |
libraries: | | |
- | |
board: | |
vendor: rp2040 | |
arch: rp2040 | |
name: rpipico | |
- sketch-paths: Valve | |
libraries: | | |
- | |
board: | |
vendor: rp2040 | |
arch: rp2040 | |
name: seeed_xiao_rp2040 | |
- sketch-paths: Nose | |
libraries: | | |
- | |
board: | |
vendor: rp2040 | |
arch: rp2040 | |
name: seeed_xiao_rp2040 | |
- sketch-paths: Pressure | |
libraries: | | |
- | |
board: | |
vendor: rp2040 | |
arch: rp2040 | |
name: seeed_xiao_rp2040 | |
- sketch-paths: MissionInterface | |
libraries: | | |
- | |
board: | |
vendor: rp2040 | |
arch: rp2040 | |
name: seeed_xiao_rp2040 | |
include: | |
- code: | |
board: | |
vendor: rp2040 | |
arch: rp2040 | |
version: latest | |
index: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Compile examples | |
uses: arduino/compile-sketches@v1 | |
with: | |
cli-version: latest | |
fqbn: ${{matrix.code.board.vendor}}:${{matrix.code.board.arch}}:${{matrix.code.board.name}} | |
platforms: | | |
- name: ${{matrix.code.board.vendor}}:${{matrix.code.board.arch}} | |
version: ${{matrix.version}} | |
source-url: ${{matrix.index}} | |
libraries: | | |
${{ env.UNIVERSAL_LIBRARIES }} | |
${{ matrix.code.libraries }} | |
sketch-paths: | | |
${{ matrix.code.sketch-paths }} |