Skip to content

[CI] Add External Libraries test #7966

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

Closed
wants to merge 11 commits into from
Closed
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
37 changes: 37 additions & 0 deletions .github/workflows/lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"library": "Adafruit NeoPixel",
"exclude_targets": null,
"sketches": [
{"name": "strandtest", "path": "~/Arduino/libraries/Adafruit_NeoPixel/examples/strandtest/strandtest.ino"}
]
},
{
"library": "FastLED",
"exclude_targets": null,
"sketches": [
{"name": "Blink", "path": "~/Arduino/libraries/FastLED/examples/Blink/Blink.ino"}
]
},
{
"library": "IRremote",
"exclude_targets": null,
"sketches": [
{"name": "SendDemo", "path": "~/Arduino/libraries/IRremote/examples/SendDemo/SendDemo.ino"}
]
},
{
"library": "ESP32Servo",
"exclude_targets": null,
"sketches": [
{"name": "Knob", "path": "~/Arduino/libraries/ESP32Servo/examples/Knob/Knob.ino"}
]
},
{
"library": "ArduinoBLE",
"exclude_targets": ["esp32s2"],
"sketches": [
{"name": "Scan", "path": "~/Arduino/libraries/ArduinoBLE/examples/Central/Scan/Scan.ino"}
]
}
]
165 changes: 165 additions & 0 deletions .github/workflows/lib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: External Libraries Test

# The workflow will run on schedule and labeled pull requests
on:
pull_request:
types: [opened, reopened, synchronize, labeled]

# Schedule weekly builds on every Sunday at 4 am
schedule:
- cron: '0 4 * * SUN'

env:
# It's convenient to set variables for values used multiple times in the workflow
SKETCHES_REPORTS_PATH: libraries-report
SKETCHES_REPORTS_ARTIFACT_NAME: libraries-report
RESULT_LIBRARY_TEST_FILE: LIBRARIES_TEST.md
jobs:
compile-sketch:
if: |
contains(github.event.pull_request.labels.*.name, 'lib_test') ||
(github.event_name == 'schedule' && github.repository == 'espressif/arduino-esp32')

runs-on: ubuntu-latest

env:
# Libraries list to be installed
UNIVERSAL_LIBRARIES: |
- source-path: ./
- name: Adafruit NeoPixel
- name: FastLED
- name: IRremote
- name: ESP32Servo

# Libs with no compilable example found
# - name: Blynk

# List of sketches to build (1 for each library)
UNIVERSAL_SKETCHES:
~/Arduino/libraries/Adafruit_NeoPixel/examples/strandtest/strandtest.ino
~/Arduino/libraries/FastLED/examples/Blink/Blink.ino
~/Arduino/libraries/IRremote/examples/SendDemo/SendDemo.ino
~/Arduino/libraries/ESP32Servo/examples/Knob/Knob.ino

strategy:
matrix:
fqbn:
- espressif:esp32:esp32
- espressif:esp32:esp32s2
- espressif:esp32:esp32c3
- espressif:esp32:esp32s3

# compile only the libraries/examples compatible with specific chip
# use when some chip dont have the peripheral which is used in library (e.g. ESP32-S2 dont have BLE, so it is not tested)
include:
- fqbn: espressif:esp32:esp32
additional-libraries: |
- name: ArduinoBLE
additional-sketches: |
~/Arduino/libraries/ArduinoBLE/examples/Central/Scan/Scan.ino
- fqbn: espressif:esp32:esp32s2
additional-libraries:
additional-sketches:
- fqbn: espressif:esp32:esp32c3
additional-libraries: |
- name: ArduinoBLE
additional-sketches: |
~/Arduino/libraries/ArduinoBLE/examples/Central/Scan/Scan.ino
- fqbn: espressif:esp32:esp32s3
additional-libraries: |
- name: ArduinoBLE
additional-sketches: |
~/Arduino/libraries/ArduinoBLE/examples/Central/Scan/Scan.ino

steps:
# This step makes the contents of the repository available to the workflow
- name: Checkout repository
uses: actions/checkout@v3

# Install Arduino ESP32 core, because compile-sketch wont call get.py
- name: Install Arduino ESP32 core
run: |
bash .github/scripts/install-arduino-core-esp32.sh

# For more information: https://github.com/arduino/compile-sketches#readme
- name: Compile sketch
uses: P-R-O-C-H-Y/compile-sketches@main
with:
platforms: |
- source-path: '.'
name: "espressif:esp32"
fqbn: ${{ matrix.fqbn }}
libraries: |
${{ env.UNIVERSAL_LIBRARIES }}
${{ matrix.additional-libraries }}
sketch-paths: |
${{ env.UNIVERSAL_SKETCHES }}
${{ matrix.additional-sketches }}
enable-deltas-report: true
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
enable-warnings-report: true
#verbose: true
cli-compile-flags: |
- --warnings="all"

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
path: ${{ env.SKETCHES_REPORTS_PATH }}

report-comment:
needs: compile-sketch # Wait for the compile job to finish to get the data for the report
if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request
runs-on: ubuntu-latest
steps:
# This step is needed to get the size data produced by the compile jobs
- name: Download sketches reports artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Report results
uses: P-R-O-C-H-Y/report-size-deltas@main
with:
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}

report-to-file:
needs: compile-sketch # Wait for the compile job to finish to get the data for the report
if: github.event_name == 'schedule' # Only run the job when the workflow is triggered by a schedule
runs-on: ubuntu-latest
steps:
# Check out repository
- name: Checkout repository
uses: actions/checkout@v3

# This step is needed to get the size data produced by the compile jobs
- name: Download sketches reports artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Report results
uses: P-R-O-C-H-Y/report-size-deltas@main
with:
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
destination-file: ${{ env.RESULT_LIBRARY_TEST_FILE }}

- name: Append file with action URL
uses: DamianReeves/write-file-action@master
with:
path: ${{ env.RESULT_LIBRARY_TEST_FILE }}
contents: |
/ [GitHub Action Link](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})
write-mode: append

- name: Push to github repo
run: |
git config user.name github-actions
git config user.email [email protected]
git add ${{ env.RESULT_LIBRARY_TEST_FILE }}
git commit -m "Generated External Libraries Test Results"
git push

Loading