-
Notifications
You must be signed in to change notification settings - Fork 35
148 lines (127 loc) · 4.51 KB
/
unittest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: unittest
on:
workflow_dispatch: null
pull_request:
push:
tags:
- '**'
jobs:
unittest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: lukka/[email protected]
with:
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
- name: prepare directory
working-directory: ./tests
run: mkdir -p build
- uses: actions/cache@v4
with:
path: |
./tests/build/_deps/
key: cmake-deps
- name: cmake prepareBuild
working-directory: ./tests/build
run: cmake -DCMAKE_BUILD_TYPE=Release ..
- name: cmake build (compile) project
working-directory: ./tests/build
run: cmake --build .
- name: run ctest
working-directory: ./tests/build
run: ctest -V
build:
needs: unittest
strategy:
fail-fast: false
matrix:
include:
- 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@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ matrix.envName }}-pio
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: cpp
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Run PlatformIO and compile sketch
id: compile_sketch
run: |
export COMPILE_OUTPUT=$(pio run -e ${{ matrix.envName }} )
echo "$COMPILE_OUTPUT"
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 "### 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: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/board:${{matrix.envName}}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.compile_sketch.outputs.FILENAME }}
path: |
.pio/build/${{ matrix.envName }}/${{ steps.compile_sketch.outputs.FILENAME }}
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@v4
- name: 'Echo download path'
run: ls -R ${{steps.download.outputs.download-path}}
- name: Upload Release Asset
id: upload-release-asset
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
draft: true
files: |
${{steps.download.outputs.download-path}}/SIGNALDuino*/SIGNALDuino*