|
| 1 | +name: Compile Firmware |
| 2 | + |
| 3 | +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows |
| 4 | +on: |
| 5 | + push: |
| 6 | + paths: |
| 7 | + - "**" |
| 8 | + pull_request: |
| 9 | + paths: |
| 10 | + - "**" |
| 11 | + schedule: |
| 12 | + # Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms). |
| 13 | + - cron: "0 8 * * TUE" |
| 14 | + workflow_dispatch: |
| 15 | + repository_dispatch: |
| 16 | + |
| 17 | +env: |
| 18 | + BINARY_FILENAME: firmware.ino.bin |
| 19 | + BINARY_ARTIFACT_NAME: firmware |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + name: Build firmware |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + |
| 29 | + matrix: |
| 30 | + board: |
| 31 | + - fqbn: STMicroelectronics:stm32:GenF4:pnum=GENERIC_F411RCTX,usb=CDCgen |
| 32 | + platforms: | |
| 33 | + # Install STM32duino via Boards Manager for the toolchain |
| 34 | + - name: STMicroelectronics:stm32 |
| 35 | + source-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json |
| 36 | +
|
| 37 | + steps: |
| 38 | + - name: Set environment variables |
| 39 | + run: | |
| 40 | + # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable |
| 41 | + echo "BINARY_OUTPUT_PATH=${{ runner.temp }}/output" >> "$GITHUB_ENV" |
| 42 | + echo "SKETCHES_REPORTS_PATH=${{ runner.temp }}/sketches-reports" >> "$GITHUB_ENV" |
| 43 | +
|
| 44 | + - name: Checkout repository |
| 45 | + uses: actions/checkout@v2 |
| 46 | + |
| 47 | + - name: Compile firmware |
| 48 | + uses: arduino/compile-sketches@v1 |
| 49 | + with: |
| 50 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + fqbn: ${{ matrix.board.fqbn }} |
| 52 | + platforms: ${{ matrix.board.platforms }} |
| 53 | + libraries: | |
| 54 | + - source-path: ./ |
| 55 | + - source-url: https://github.com/arduino-libraries/Arduino_MAX17332.git |
| 56 | + - source-url: https://github.com/gbr1/ucPack.git |
| 57 | + - name: STM32duino MotionFX |
| 58 | + - name: STM32duino VL53L7CX |
| 59 | + - name: AT42QT |
| 60 | + - name: Arduino_APDS9960 |
| 61 | + - name: STM32duino LSM6DSO |
| 62 | + - name: Servo |
| 63 | + sketch-paths: | |
| 64 | + - examples/firmware |
| 65 | + cli-compile-flags: | |
| 66 | + - --output-dir=${{ env.BINARY_OUTPUT_PATH }} |
| 67 | + enable-deltas-report: true |
| 68 | + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} |
| 69 | + |
| 70 | + - name: Git describe |
| 71 | + id: ghd |
| 72 | + uses: proudust/gh-describe@v2 |
| 73 | + |
| 74 | + - name: Save firmware binary as workflow artifact |
| 75 | + uses: actions/upload-artifact@v2 |
| 76 | + with: |
| 77 | + if-no-files-found: error |
| 78 | + path: ${{ env.BINARY_OUTPUT_PATH }}/${{ env.BINARY_FILENAME }} |
| 79 | + name: ${{ env.BINARY_ARTIFACT_NAME }}_${{ steps.ghd.outputs.describe }}.bin |
| 80 | + |
| 81 | + - name: Save sketches report as workflow artifact |
| 82 | + uses: actions/upload-artifact@v2 |
| 83 | + with: |
| 84 | + if-no-files-found: error |
| 85 | + path: ${{ env.SKETCHES_REPORTS_PATH }} |
| 86 | + name: sketches-reports |
0 commit comments