|
| 1 | +# This is the name of the workflow, visible on GitHub UI. |
| 2 | +name: Tests |
| 3 | + |
| 4 | +# Here we tell GitHub to run the workflow when a commit |
| 5 | +# is pushed or a Pull Request is opened. |
| 6 | +on: [push, pull_request] |
| 7 | + |
| 8 | +# This is the list of jobs that will be run concurrently. |
| 9 | +# Since we use a build matrix, the actual number of jobs |
| 10 | +# started depends on how many configurations the matrix |
| 11 | +# will produce. |
| 12 | +jobs: |
| 13 | + # This is the name of the job - can be whatever. |
| 14 | + test-matrix: |
| 15 | + |
| 16 | + # Here we tell GitHub that the jobs must be determined |
| 17 | + # dynamically depending on a matrix configuration. |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + # The matrix will produce one job for each configuration |
| 21 | + # parameter of type `arduino-platform`, in this case a |
| 22 | + # total of 2. |
| 23 | + arduino-platform: ["arduino:avr", "esp32:esp32"] |
| 24 | + # This is usually optional but we need to statically define the |
| 25 | + # FQBN of the boards we want to test for each platform. In the |
| 26 | + # future the CLI might automatically detect and download the core |
| 27 | + # needed to compile against a certain FQBN, at that point the |
| 28 | + # following `include` section will be useless. |
| 29 | + include: |
| 30 | + # This works like this: when the platform is "arduino:avr", the |
| 31 | + # variable `fqbn` is set to "arduino:avr:uno". |
| 32 | + - arduino-platform: "arduino:avr" |
| 33 | + fqbn: "arduino:avr:uno" |
| 34 | + board_manager_url: "" |
| 35 | + additional_options: "" |
| 36 | + - arduino-platform: "esp32:esp32" |
| 37 | + fqbn: "esp32:esp32:esp32s3" |
| 38 | + board_manager_url: "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 39 | + additional_options: "--additional-urls" |
| 40 | + |
| 41 | + # This is the platform GitHub will use to run our workflow |
| 42 | + runs-on: ubuntu-latest |
| 43 | + |
| 44 | + env: |
| 45 | + # Location of the repository relative to the runner workspace |
| 46 | + REPO_PATH: libraries/SmartCC1101 |
| 47 | + |
| 48 | + # This is the list of steps this job will run. |
| 49 | + steps: |
| 50 | + # First of all, we clone the repo using the `checkout` action. |
| 51 | + - name: Checkout |
| 52 | + uses: actions/checkout@v3 |
| 53 | + with: |
| 54 | + path: ${{ env.REPO_PATH }} |
| 55 | + |
| 56 | + # We use the `arduino/setup-arduino-cli` action to install and |
| 57 | + # configure the Arduino CLI on the system. |
| 58 | + - name: Setup Arduino CLI |
| 59 | + uses: arduino/setup-arduino-cli@v1 |
| 60 | + |
| 61 | + # We then install the platform, which one will be determined |
| 62 | + # dynamically by the build matrix. |
| 63 | + - name: Install platform |
| 64 | + run: | |
| 65 | + arduino-cli core update-index ${{ matrix.additional_options }} ${{ matrix.board_manager_url }} |
| 66 | + arduino-cli core install ${{ matrix.arduino-platform }} ${{ matrix.additional_options }} ${{ matrix.board_manager_url }} |
| 67 | +
|
| 68 | + # Finally, we compile the sketch, using the FQBN that was set |
| 69 | + # in the build matrix. |
| 70 | + - name: Compile Sketch |
| 71 | + env: |
| 72 | + # Configure Arduino CLI so this repository checked out under the libraries subfolder will be recognized |
| 73 | + ARDUINO_DIRECTORIES_USER: ${{ github.workspace }} |
| 74 | + run: | |
| 75 | + arduino-cli compile --fqbn ${{ matrix.fqbn }} ${{ matrix.additional_options }} ${{ matrix.board_manager_url }} ${{ env.REPO_PATH }}/examples/Sender |
| 76 | + arduino-cli compile --fqbn ${{ matrix.fqbn }} ${{ matrix.additional_options }} ${{ matrix.board_manager_url }} ${{ env.REPO_PATH }}/examples/Receiver |
0 commit comments