bumped patch version #13
This file contains hidden or 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: Compile Arduino Examples | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| compile-examples: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| board: | |
| - fqbn: "esp32:esp32:lolin_s2_mini" | |
| platform: "esp32:esp32" | |
| name: "ESP32-S2-Mini" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Arduino CLI | |
| uses: arduino/setup-arduino-cli@v1 | |
| - name: Cache Arduino platforms | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.arduino15/packages | |
| ~/.arduino15/staging | |
| key: arduino-platform-${{ matrix.board.platform }}-${{ hashFiles('**/package_esp32_index.json') }} | |
| restore-keys: | | |
| arduino-platform-${{ matrix.board.platform }}- | |
| - name: Install platform | |
| run: | | |
| arduino-cli config init | |
| arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json | |
| arduino-cli core update-index | |
| # Retry logic for platform installation | |
| max_attempts=3 | |
| attempt=1 | |
| while [ $attempt -le $max_attempts ]; do | |
| echo "Attempt $attempt of $max_attempts..." | |
| if arduino-cli core install ${{ matrix.board.platform }}; then | |
| echo "Platform installed successfully!" | |
| exit 0 | |
| else | |
| echo "Installation failed. Waiting before retry..." | |
| sleep 10 | |
| attempt=$((attempt + 1)) | |
| fi | |
| done | |
| echo "Failed to install platform after $max_attempts attempts" | |
| exit 1 | |
| - name: Install library dependencies | |
| run: | | |
| # Create Arduino libraries directory | |
| mkdir -p ~/Arduino/libraries | |
| # Link this library to Arduino's library directory | |
| ln -s ${{ github.workspace }} ~/Arduino/libraries/$(basename ${{ github.workspace }}) | |
| # Install any external dependencies your library needs | |
| # arduino-cli lib install "SomeLibrary" | |
| # arduino-cli lib install "https://github.com/ESP32Async/AsyncTCP.git" | |
| # arduino-cli lib install "https://github.com/ESP32Async/ESPAsyncWebServer.git" | |
| cd ~/Arduino/libraries | |
| git clone https://github.com/ESP32Async/AsyncTCP.git | |
| git clone https://github.com/ESP32Async/ESPAsyncWebServer.git | |
| git clone https://github.com/adafruit/Adafruit_NeoPixel.git | |
| git clone https://github.com/bblanchon/ArduinoJson.git | |
| echo "Library linked successfully" | |
| - name: Install library dependencies | |
| run: | | |
| # Install any dependencies your library needs | |
| # arduino-cli lib install "SomeLibrary" | |
| echo "Install dependencies here if needed" | |
| - name: Find and compile examples | |
| run: | | |
| mkdir -p compiled_binaries | |
| # Find all .ino files in examples directory | |
| find examples -name "*.ino" | while read sketch; do | |
| example_dir=$(dirname "$sketch") | |
| example_name=$(basename "$example_dir") | |
| echo "Compiling $example_name..." | |
| # Compile the sketch | |
| arduino-cli compile \ | |
| --fqbn ${{ matrix.board.fqbn }} \ | |
| --output-dir "compiled_binaries/${example_name}_${{ matrix.board.name }}" \ | |
| "$example_dir" | |
| # Find and rename the .bin file | |
| find "compiled_binaries/${example_name}_${{ matrix.board.name }}" -name "*.bin" -exec cp {} "compiled_binaries/${example_name}_${{ matrix.board.name }}.bin" \; | |
| done | |
| - name: Upload compiled binaries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: compiled-examples-${{ matrix.board.name }} | |
| path: compiled_binaries/*.bin | |
| retention-days: 30 | |
| - name: Upload to release (on tag) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: compiled_binaries/*.bin | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |