Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run compile jobs with platformio environment settings #278

Merged
merged 8 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 76 additions & 124 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: unittest
on:
release:
types: [created, prereleased, published]
workflow_dispatch: null
pull_request: null
pull_request:
push:
tags:
- '**'
jobs:
unittest:
runs-on: ubuntu-latest
Expand All @@ -19,6 +20,12 @@ jobs:
- name: prepare directory
working-directory: ./tests
run: mkdir -p build

- uses: actions/cache@v3
with:
path: |
./tests/build/_deps/
key: cmake-deps

- name: cmake prepareBuild
working-directory: ./tests/build
Expand All @@ -33,151 +40,96 @@ jobs:
run: ctest -V


deploy:
build:
needs: unittest
strategy:
fail-fast: false
matrix:
include:
- BOARD: nano
RECEIVER: cc1101
arduino-platform: 'arduino:avr'
fqbn: 'arduino:avr:nano:cpu=atmega328'
compilerflag: '\"-DOTHER_BOARD_WITH_CC1101=1\"'
- BOARD: nano328
RECEIVER: ""
arduino-platform: 'arduino:avr'
fqbn: 'arduino:avr:nano:cpu=atmega328'
- BOARD: radino
RECEIVER: cc1101
arduino-platform: 'arduino:avr In-Circuit:avr'
fqbn: 'In-Circuit:avr:radinoCC1101'
boardurl: '--additional-urls=http://library.radino.cc/Arduino_1_8/package_radino_radino32_index.json'
compilerflag: \"-DARDUINO_RADINOCC1101=1\"
build_param1: "compiler.path={runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path}/bin/"
- BOARD: minicul
RECEIVER: cc1101
arduino-platform: 'arduino:avr'
fqbn: 'arduino:avr:pro:cpu=8MHzatmega328'
compilerflag: \"-DARDUINO_ATMEGA328P_MINICUL=1\"
- BOARD: promini
RECEIVER: ""
arduino-platform: 'arduino:avr'
fqbn: 'arduino:avr:pro:cpu=8MHzatmega328'
- BOARD: ESP32
RECEIVER: cc1101
arduino-platform: 'esp32:esp32@2.0.7'
fqbn: 'esp32:esp32:esp32:FlashMode=qio,FlashFreq=80'
compilerflag: \"-DOTHER_BOARD_WITH_CC1101=1\"
boardurl: '--additional-urls=https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json'
- BOARD: ESP32
RECEIVER: ""
arduino-platform: 'esp32:esp32@2.0.7'
fqbn: 'esp32:esp32:esp32:FlashMode=qio,FlashFreq=80'
boardurl: '--additional-urls=https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json'
- BOARD: ESP8266
RECEIVER: cc1101
arduino-platform: 'esp8266:esp8266@3.1.2'
fqbn: 'esp8266:esp8266:generic:xtal=80,eesz=1M64,FlashMode=qio,FlashFreq=40'
compilerflag: \"-DOTHER_BOARD_WITH_CC1101=1\"
boardurl: '--additional-urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json'
- BOARD: ESP8266
RECEIVER: ""
arduino-platform: 'esp8266:esp8266@3.1.2'
fqbn: 'esp8266:esp8266:generic:xtal=80,eesz=1M64,FlashMode=qio,FlashFreq=40'
boardurl: '--additional-urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json'
- BOARD: MAPLEMINI_F103CB
RECEIVER: cc1101
arduino-platform: 'STM32:stm32'
fqbn: 'STM32:stm32:GenF1:pnum=MAPLEMINI_F103CB'
compilerflag: \"-DOTHER_BOARD_WITH_CC1101=1\"
boardurl: '--additional-urls=https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json'
- BOARD: MAPLEMINI_F103CB
RECEIVER: ""
arduino-platform: 'STM32:stm32'
fqbn: 'STM32:stm32:GenF1:pnum=MAPLEMINI_F103CB'
boardurl: '--additional-urls=https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json'
- envName: nano328s
- envName: nanoCC1101
- envName: radinoCC1101
- envName: miniculCC1101
- envName: promini16s
- envName: promini16CC1101
- envName: promini8s
- envName: promini8CC1101
- envName: esp32s
- envName: esp32CC1101
- envName: esp8266s
- envName: esp8266CC1101
- envName: MAPLEMINI_F103CBcc1101
- envName: MAPLEMINI_F103CBs

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Install Arduino CLI
uses: arduino/setup-arduino-cli@v1.1.1
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ matrix.envName }}-pio

- name: Setup arduino-cli
uses: ./.github/actions/arduino-cli
- uses: actions/setup-python@v4
with:
boardurl: ${{ matrix.boardurl }}
plattform: ${{ matrix.arduino-platform }}
python-version: '3.10'
- name: Install PlatformIO Core
run: pip install --upgrade platformio==6.1.6

- name: Compile sketch
- name: Run PlatformIO and compile sketch
id: compile_sketch
run: |
export COMPILE_OUTPUT=$(arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-property="compiler.cpp.extra_flags=${{ matrix.compilerflag }}" ${{ matrix.boardurl }} --build-property="${{ matrix.build_param1 }}" --output-dir=$GITHUB_WORKSPACE $GITHUB_WORKSPACE/src/arduino-ide/SIGNALDuino/SIGNALDuino.ino)
export COMPILE_OUTPUT=$(pio run -e ${{ matrix.envName }} )
echo "$COMPILE_OUTPUT"
echo "fileext=$(test -f $GITHUB_WORKSPACE/SIGNALDuino.ino.bin && echo "bin" || echo "hex")" >> $GITHUB_OUTPUT
echo "skechsize=$(echo "$COMPILE_OUTPUT" | grep -Po "(?<=^Sketch uses )\d+")" >> $GITHUB_OUTPUT
echo "globalramusage=$(echo "$COMPILE_OUTPUT" | grep -Po "(?<=^Global variables use )\d+")" >> $GITHUB_OUTPUT

- name: Get flash and ram usage
id: compile_sizes
FILEEXT=$(find .pio/build/${{ matrix.envName }} -maxdepth 1 \( -name 'SIGNALduino*.bin' -o -name 'SIGNALduino*.hex' \) | while read file; do echo "${file##*.}"; done)
FILENAME=$(find .pio/build/${{ matrix.envName }}/ -maxdepth 1 \( -name 'SIGNALduino*.bin' -o -name 'SIGNALduino*.hex' \) -printf "%f" )
echo "Extension: $FILEEXT"
echo "FILENAME=$(echo $FILENAME | tr -d '\n')" >> $GITHUB_OUTPUT
echo "FILEEXT=$(echo $FILEEXT | tr -d '\n')" >> $GITHUB_OUTPUT
echo "SKETCHSIZE=$(echo "$COMPILE_OUTPUT" | grep -Po "(^Flash: ).*")" >> $GITHUB_OUTPUT
echo "GLOBALRAMUSAGE=$(echo "$COMPILE_OUTPUT" | grep -Po "(^RAM: ).*")" >> $GITHUB_OUTPUT

- name: Create Job Summary
run: |
echo Flash usage: ${{ steps.compile_sketch.outputs.skechsize }} bytes
echo Ram usage: ${{ steps.compile_sketch.outputs.globalramusage }} bytes
echo "### Size report for commit: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo "| ENV | Flash | Ram |" >> $GITHUB_STEP_SUMMARY
echo "|-------|-------|-----|" >> $GITHUB_STEP_SUMMARY
echo "| ${{ matrix.envName }} | ${{ steps.compile_sketch.outputs.SKETCHSIZE }} | ${{ steps.compile_sketch.outputs.GLOBALRAMUSAGE }} |" >> $GITHUB_STEP_SUMMARY

- name: Find Comment
if: ${{ github.event.pull_request.number > 0 }}
uses: peter-evans/find-comment@v2
id: fc
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: ${{ github.sha }}

- name: Create comment
if: ${{ github.event.pull_request.number > 0 && steps.fc.outputs.comment-id == 0 && github.event.pull_request.head.repo.fork == false }}
name: ${{ steps.compile_sketch.outputs.FILENAME }}
path: |
.pio/build/${{ matrix.envName }}/${{ steps.compile_sketch.outputs.FILENAME }}
if-no-files-found: warn

uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
### Size report for commit: ${{ github.sha }}
| Board | Flash | Ram |
|-------|-------|-----|
| ${{ matrix.BOARD }}${{ matrix.RECEIVER }} | ${{ steps.compile_sketch.outputs.skechsize }} bytes | ${{ steps.compile_sketch.outputs.globalramusage }} bytes |

- name: Update comment
if: ${{ github.event.pull_request.number > 0 && steps.fc.outputs.comment-id != 0 && github.event.pull_request.head.repo.fork == false }}
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
| ${{ matrix.BOARD }}${{ matrix.RECEIVER }} | ${{ steps.compile_sketch.outputs.skechsize }} bytes | ${{ steps.compile_sketch.outputs.globalramusage }} bytes |
release:
needs: build
permissions:
contents: write
runs-on: ubuntu-latest

steps:
- name: Download artifact
id: download
uses: actions/download-artifact@v3

- name: Get release
id: get_release
if: ${{ github.event_name == 'release'}}
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: 'Echo download path'
run: ls -R ${{steps.download.outputs.download-path}}

- name: Upload Release Asset
id: upload-release-asset
if: ${{ github.event_name == 'release' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
upload_url: ${{ steps.get_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./SIGNALDuino.ino.${{ steps.compile_sketch.outputs.fileext }}
asset_name: SIGNALDuino_${{ matrix.BOARD }}${{ matrix.RECEIVER }}_${{ github.event.release.tag_name }}.hex
asset_content_type: application/octet-stream

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: SIGNALDuino_${{ matrix.BOARD }}${{ matrix.RECEIVER }}.hex
path: ./SIGNALDuino.ino.${{ steps.compile_sketch.outputs.fileext }}
if-no-files-found: warn
generate_release_notes: true
draft: true
files: |
${{steps.download.outputs.download-path}}/SIGNALduino*/SIGNALduino*
147 changes: 35 additions & 112 deletions SIGNALDuino.code-workspace
Original file line number Diff line number Diff line change
@@ -1,114 +1,37 @@
{
"settings": {
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "googletest.failed",
"settings": {
"foreground": "#f00"
}
},
{
"scope": "googletest.passed",
"settings": {
"foreground": "#0f0"
}
},
{
"scope": "googletest.run",
"settings": {
"foreground": "#0f0"
}
}
]
},
"files.associations": {
"xstring": "cpp",
"bitset": "cpp",
"sstream": "cpp",
"limits": "cpp",
"istream": "cpp",
"*.tcc": "cpp",
"iosfwd": "cpp",
"xlocale": "cpp",
"string_view": "cpp",
"array": "cpp",
"deque": "cpp",
"initializer_list": "cpp",
"list": "cpp",
"queue": "cpp",
"random": "cpp",
"type_traits": "cpp",
"vector": "cpp",
"xhash": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"utility": "cpp",
"ostream": "cpp",
"algorithm": "cpp",
"atomic": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"exception": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iostream": "cpp",
"iterator": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ratio": "cpp",
"set": "cpp",
"shared_mutex": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"xfacet": "cpp",
"xiosbase": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xmemory0": "cpp",
"xstddef": "cpp",
"xtr1common": "cpp",
"cinttypes": "cpp"
}
},
"folders": [
{
"path": "."
},
{
"path": "tests"
}
]
"folders": [
{
"path": "."
},
{
"path": "tests"
}
],
"settings": {
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "googletest.failed",
"settings": {
"foreground": "#f00"
}
},
{
"scope": "googletest.passed",
"settings": {
"foreground": "#0f0"
}
},
{
"scope": "googletest.run",
"settings": {
"foreground": "#0f0"
}
}
]
},
"gtest-adapter.debugConfig": [
"PIO Debug"
]
}
}
Loading