-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from shadow578/update/ci
update CI workflows
- Loading branch information
Showing
19 changed files
with
139 additions
and
83 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: CI - Build examples | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
# generate the build matrix | ||
gen_matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
examples_matrix: ${{ steps.gen_matrix.outputs.matrix }} | ||
steps: | ||
# checkout the repository | ||
- uses: actions/checkout@v4 | ||
|
||
# generate the build matrix, containing all subdirectories in the 'examples' directory | ||
# that contain a 'platformio.ini' file | ||
- name: Generate build matrix | ||
id: gen_matrix | ||
run: | | ||
# Get all subdirectories containing platformio.ini in the ./example directory | ||
subdirectories=$(find ./examples -type f -name "platformio.ini" -exec dirname {} \; | sort -u) | ||
# Convert subdirectories to JSON array | ||
json_array="[" | ||
for subdir in $subdirectories; do | ||
json_array+="\"$subdir\", " | ||
done | ||
json_array="${json_array%, }]" | ||
echo "$json_array" | ||
echo "matrix=$json_array" >> $GITHUB_OUTPUT | ||
# build the CI environment in all examples | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: gen_matrix | ||
|
||
# run all examples in a matrix | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
example: ${{ fromJson(needs.gen_matrix.outputs.examples_matrix) }} | ||
|
||
steps: | ||
# checkout the repository | ||
- uses: actions/checkout@v4 | ||
|
||
# enable caching of pip and platformio | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/pip | ||
~/.platformio/.cache | ||
key: ${{ runner.os }}-pio | ||
|
||
# install python | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
# install platformio | ||
- name: Install PlatformIO core | ||
run: pip install --upgrade platformio | ||
|
||
# print the platformio.ini file path | ||
- name: Print matrix value for 'example' | ||
run: echo ${{ matrix.example }} | ||
|
||
# build the 'CI' environment | ||
- name: Build 'ci' environment | ||
run: pio run --project-dir ${{ matrix.example }} --environment ci |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.pio | ||
.vscode |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[env] | ||
platform = https://github.com/shadow578/platform-hc32f46x/archive/1.0.0.zip | ||
framework = arduino | ||
board = generic_hc32f460 | ||
|
||
[env:default] | ||
|
||
# required only for CI | ||
[env:ci] | ||
# override theframework-arduino-hc32f46x package with the local one | ||
board_build.arduino_package_dir = ../../ | ||
extra_scripts = | ||
pre:../../tools/ci/patch_get_package_dir.py |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.pio | ||
.vscode |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# | ||
# framework-arduino-hc32f46x unit test environment | ||
# | ||
# use the 'test_native' or 'test_win32' environments to run unit tests | ||
# | ||
[env] | ||
test_framework = googletest | ||
test_ignore = # run all tests | ||
build_flags = | ||
-I../cores/arduino # add arduino core to include path | ||
-Itest/stubs # add stubs to include path | ||
|
||
# override the framework-arduino-hc32f46x package with the local one | ||
board_build.arduino_package_dir = ../ | ||
extra_scripts = | ||
pre:../tools/ci/patch_get_package_dir.py | ||
|
||
# run tests on the native platform and toolchain | ||
[env:native] | ||
extends = testenv | ||
platform = native | ||
|
||
# run tests on windows, without having to manually install the toolchain | ||
[env:win32] | ||
extends = testenv | ||
platform = windows_x86 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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