External Libraries Test #548
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
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' | |
concurrency: | |
group: libs-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
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 | |
JSON_LIBRARY_LIST_FILE: .github/workflows/lib.json | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
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: | |
REPOSITORY: | | |
- source-path: '.' | |
name: "espressif:esp32" | |
strategy: | |
matrix: | |
target: | |
- esp32 | |
- esp32s2 | |
- esp32c3 | |
- esp32s3 | |
- esp32c6 | |
- esp32h2 | |
include: | |
- target: esp32 | |
fqbn: espressif:esp32:esp32 | |
- target: esp32s2 | |
fqbn: espressif:esp32:esp32s2 | |
- target: esp32c3 | |
fqbn: espressif:esp32:esp32c3 | |
- target: esp32s3 | |
fqbn: espressif:esp32:esp32s3 | |
- target: esp32c6 | |
fqbn: espressif:esp32:esp32c6 | |
- target: esp32h2 | |
fqbn: espressif:esp32:esp32h2 | |
steps: | |
# This step makes the contents of the repository available to the workflow | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Compile sketch | |
uses: P-R-O-C-H-Y/compile-sketches@main | |
with: | |
platforms: | | |
${{ env.REPOSITORY }} | |
target: ${{ matrix.target }} | |
fqbn: ${{ matrix.fqbn }} | |
use-json-file: true | |
json-path: ${{ env.JSON_LIBRARY_LIST_FILE }} | |
enable-deltas-report: true | |
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} | |
enable-warnings-report: true | |
cli-compile-flags: | | |
- --warnings="all" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-${{ matrix.target }} | |
path: ${{ 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@v4 | |
with: | |
token: ${{ env.GITHUB_TOKEN }} | |
fetch-depth: '0' | |
- name: Switch branch | |
run: | |
git checkout remotes/origin/gh-pages | |
# This step is needed to get the size data produced by the compile jobs | |
- name: Download sketches reports artifact | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}-* | |
merge-multiple: true | |
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 | |
run: | |
echo "/ [GitHub Action Link](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})" >> ${{ env.RESULT_LIBRARY_TEST_FILE }} | |
- name: Push to github repo | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add ${{ env.RESULT_LIBRARY_TEST_FILE }} | |
git commit -m "Generated External Libraries Test Results" | |
git push origin HEAD:gh-pages | |
#Upload PR number as artifact | |
upload-pr-number: | |
name: Upload PR number | |
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'lib_test')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Save the PR number in an artifact | |
shell: bash | |
env: | |
PR_NUM: ${{ github.event.number }} | |
run: echo $PR_NUM > pr_num.txt | |
- name: Upload PR number | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr_number | |
path: ./pr_num.txt | |
overwrite: true |