|
| 1 | +name: External Libraries Test |
| 2 | + |
| 3 | +# The workflow will run on schedule and labeled pull requests |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + types: [opened, reopened, synchronize, labeled] |
| 7 | + |
| 8 | + # Schedule weekly builds on every Sunday at 4 am |
| 9 | + schedule: |
| 10 | + - cron: '0 4 * * SUN' |
| 11 | + |
| 12 | +env: |
| 13 | + # It's convenient to set variables for values used multiple times in the workflow |
| 14 | + SKETCHES_REPORTS_PATH: libraries-report |
| 15 | + SKETCHES_REPORTS_ARTIFACT_NAME: libraries-report |
| 16 | + RESULT_LIBRARY_TEST_FILE: LIBRARIES_TEST.md |
| 17 | + JSON_LIBRARY_LIST_FILE: .github/workflows/lib.json |
| 18 | +jobs: |
| 19 | + compile-sketch: |
| 20 | + if: | |
| 21 | + contains(github.event.pull_request.labels.*.name, 'lib_test') || |
| 22 | + (github.event_name == 'schedule' && github.repository == 'espressif/arduino-esp32') |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + env: |
| 26 | + REPOSITORY: | |
| 27 | + - source-path: '.' |
| 28 | + name: "espressif:esp32" |
| 29 | +
|
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + target: |
| 33 | + - esp32 |
| 34 | + - esp32s2 |
| 35 | + - esp32c3 |
| 36 | + - esp32s3 |
| 37 | + |
| 38 | + include: |
| 39 | + - target: esp32 |
| 40 | + fqbn: espressif:esp32:esp32 |
| 41 | + - target: esp32s2 |
| 42 | + fqbn: espressif:esp32:esp32s2 |
| 43 | + - target: esp32c3 |
| 44 | + fqbn: espressif:esp32:esp32c3 |
| 45 | + - target: esp32s3 |
| 46 | + fqbn: espressif:esp32:esp32s3 |
| 47 | + |
| 48 | + |
| 49 | + steps: |
| 50 | + # This step makes the contents of the repository available to the workflow |
| 51 | + - name: Checkout repository |
| 52 | + uses: actions/checkout@v3 |
| 53 | + |
| 54 | + - name: Compile sketch |
| 55 | + uses: P-R-O-C-H-Y/compile-sketches@main |
| 56 | + with: |
| 57 | + platforms: | |
| 58 | + ${{ env.REPOSITORY }} |
| 59 | + target: ${{ matrix.target }} |
| 60 | + fqbn: ${{ matrix.fqbn }} |
| 61 | + use-json-file: true |
| 62 | + json-path: ${{ env.JSON_LIBRARY_LIST_FILE }} |
| 63 | + enable-deltas-report: true |
| 64 | + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} |
| 65 | + enable-warnings-report: true |
| 66 | + cli-compile-flags: | |
| 67 | + - --warnings="all" |
| 68 | +
|
| 69 | + - name: Upload artifact |
| 70 | + uses: actions/upload-artifact@v3 |
| 71 | + with: |
| 72 | + name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }} |
| 73 | + path: ${{ env.SKETCHES_REPORTS_PATH }} |
| 74 | + |
| 75 | + report-comment: |
| 76 | + needs: compile-sketch # Wait for the compile job to finish to get the data for the report |
| 77 | + if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request |
| 78 | + runs-on: ubuntu-latest |
| 79 | + steps: |
| 80 | + # This step is needed to get the size data produced by the compile jobs |
| 81 | + - name: Download sketches reports artifact |
| 82 | + uses: actions/download-artifact@v3 |
| 83 | + with: |
| 84 | + name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }} |
| 85 | + path: ${{ env.SKETCHES_REPORTS_PATH }} |
| 86 | + |
| 87 | + - name: Report results |
| 88 | + uses: P-R-O-C-H-Y/report-size-deltas@main |
| 89 | + with: |
| 90 | + sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} |
| 91 | + |
| 92 | + report-to-file: |
| 93 | + needs: compile-sketch # Wait for the compile job to finish to get the data for the report |
| 94 | + if: github.event_name == 'schedule' # Only run the job when the workflow is triggered by a schedule |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + # Check out repository |
| 98 | + - name: Checkout repository |
| 99 | + uses: actions/checkout@v3 |
| 100 | + |
| 101 | + # This step is needed to get the size data produced by the compile jobs |
| 102 | + - name: Download sketches reports artifact |
| 103 | + uses: actions/download-artifact@v3 |
| 104 | + with: |
| 105 | + name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }} |
| 106 | + path: ${{ env.SKETCHES_REPORTS_PATH }} |
| 107 | + |
| 108 | + - name: Report results |
| 109 | + uses: P-R-O-C-H-Y/report-size-deltas@main |
| 110 | + with: |
| 111 | + sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} |
| 112 | + destination-file: ${{ env.RESULT_LIBRARY_TEST_FILE }} |
| 113 | + |
| 114 | + - name: Append file with action URL |
| 115 | + uses: DamianReeves/write-file-action@master |
| 116 | + with: |
| 117 | + path: ${{ env.RESULT_LIBRARY_TEST_FILE }} |
| 118 | + contents: | |
| 119 | + / [GitHub Action Link](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) |
| 120 | + write-mode: append |
| 121 | + |
| 122 | + - name: Push to github repo |
| 123 | + run: | |
| 124 | + git config user.name github-actions |
| 125 | + git config user.email [email protected] |
| 126 | + git add ${{ env.RESULT_LIBRARY_TEST_FILE }} |
| 127 | + git commit -m "Generated External Libraries Test Results" |
| 128 | + git push |
0 commit comments