Skip to content

Commit

Permalink
fix deploy job errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sidey79 committed Apr 23, 2023
1 parent 292aa5e commit a4c6494
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 165 deletions.
94 changes: 45 additions & 49 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ on:
release:
types: [created, prereleased, published]
workflow_dispatch: null
pull_request: null
push: null

jobs:
unittest:
runs-on: ubuntu-latest
Expand All @@ -20,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 @@ -34,10 +40,8 @@ jobs:
run: ctest -V


deploy:
build:
needs: unittest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -66,7 +70,13 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Extract branch name
shell: bash
run: echo "gh_branch_name=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
id: extract_branch

- uses: actions/cache@v3
with:
path: |
Expand All @@ -85,61 +95,47 @@ jobs:
run: |
export COMPILE_OUTPUT=$(pio run -e ${{ matrix.envName }} )
echo "$COMPILE_OUTPUT"
echo "fileext=$(test -f .pio/build/${{ matrix.envName }}/SIGNALDuino*.bin && echo "bin" || echo "hex")" >> $GITHUB_OUTPUT
FILEEXT=$(find .pio/build/${{ matrix.envName }} -maxdepth 1 \( -name 'SIGNALduino*.bin' -o -name 'SIGNALduino*.hex' \) | while read file; do echo "${file##*.}"; done)
echo "Extension: $FILEEXT"
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: Get flash and ram usage
id: compile_sizes
- name: Create Job Summary
run: |
echo ${{ steps.compile_sketch.outputs.SKETCHSIZE }}
echo ${{ steps.compile_sketch.outputs.GLOBALRAMUSAGE }}
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: SIGNALduino_${{ matrix.envName }}.${{ steps.compile_sketch.outputs.FILEEXT }}
path: |
.pio/build/${{ matrix.envName }}/SIGNALduino*.${{ steps.compile_sketch.outputs.FILEEXT }}
if-no-files-found: warn
release:
needs: build
permissions:
contents: write
runs-on: ubuntu-latest

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

- name: 'Echo download path'
run: ls -R ${{steps.download.outputs.download-path}}

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

- 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.envName }} | ${{ steps.compile_sketch.outputs.SKETCHSIZE }} bytes | ${{ steps.compile_sketch.outputs.GLOBALRAMUSAGE }} |
- name: Upload Release Asset
id: upload-release-asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
draft: true
files: |
.pio/build/${{ matrix.envName }}/SIGNALduino*.bin
.pio/build/${{ matrix.envName }}/SIGNALduino*.hex

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: SIGNALDuino_${{ matrix.envName }}
path: |
.pio/build/${{ matrix.envName }}/SIGNALduino*.bin
.pio/build/${{ matrix.envName }}/SIGNALduino*.hex
if-no-files-found: warn
${{steps.download.outputs.download-path}}/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"
]
}
}
11 changes: 8 additions & 3 deletions extra_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,22 @@
# Build versions with a point are difficult to process
# System uses dot for file extension


reftype = os.environ.get('GITHUB_REF_TYPE','local')
basetag = (
subprocess.check_output(["git", "describe", "--tags", "--first-parent", "--abbrev=1"])
.strip()
.decode("utf-8")
)

build_version = os.environ.get('GITHUB_REF_NAME',basetag+"+"+date)
if (reftype == 'branch') :
build_version = basetag+os.environ.get('GITHUB_REF_NAME')+"+"+date
elif (reftype == 'tag') :
build_version = os.environ.get('GITHUB_REF_NAME',basetag+"+"+date)
else:
build_version = basetag+"+"+date

# write project hex, bin, elf like SIGANALduino_esp32_CC1101_3.5.0-11-gcc56+230423.bin
env.Replace(PROGNAME="SIGANALduino_{0}_{1}".format(build_name,build_version))
env.Replace(PROGNAME="SIGNALduino_{0}_{1}".format(build_name,build_version))

env.Append(CPPDEFINES=[
("PROGVERS",env.StringifyMacro(build_version)),
Expand Down
17 changes: 16 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test_dir = tests/
build_src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<arduino-ide/SIGNALDuino/> -<_micro-api/libraries/ArduinoJson/test/> -<_micro-api/libraries/ArduinoJson/third-party/> -<_micro-api/libraries/fastdelegate/examples/>-<test/> -<tests/> -<_micro-api/libraries/ArduinoJson/fuzzing/>
lib_extra_dirs = src/_micro-api/libraries/
#debug_port = COM6
#monitor_port = COM6
#monitor_port = COM6f
#upload_port = COM6
upload_speed = 921600

Expand Down Expand Up @@ -302,6 +302,7 @@ monitor_port = ${env.monitor_port}
upload_port = ${env.upload_port}
build_flags=-D OTHER_BOARD_WITH_CC1101=1


[env:nano_bootl_new@debug]
; Arduino Nano ATmega328 - bootloader Optiboot
; RAM: [===== ] 51.3% (used 1050 bytes from 2048 bytes)
Expand All @@ -315,6 +316,20 @@ upload_port = ${env.upload_port}
build_flags = -D DEBUG
build_src_filter = -cc1101.h -cc1101.cpp +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<arduino-ide/SIGNALDuino/> -<_micro-api/libraries/ArduinoJson/test/> -<_micro-api/libraries/ArduinoJson/third-party/> -<_micro-api/libraries/fastdelegate/examples/>-<test/> -<tests/> -<_micro-api/libraries/ArduinoJson/fuzzing/>


[env:nano_bootl_new]
; Arduino Nano ATmega328 - bootloader Optiboot
; RAM: [==== ] 42.1% (used 862 bytes from 2048 bytes)
; Flash: [======= ] 69.8% (used 21452 bytes from 30720 bytes)
platform = atmelavr
board = nanoatmega328new
monitor_speed = 57600
framework = arduino
monitor_port = ${env.monitor_port}
upload_port = ${env.upload_port}
build_flags=


[env:io]
; Arduino Nano ATmega328 - bootloader Optiboot
; RAM: [==== ] 42.1% (used 862 bytes from 2048 bytes)
Expand Down

0 comments on commit a4c6494

Please sign in to comment.