From 77042fabeab7a51fea6a2e0440a68ea59ccacdb7 Mon Sep 17 00:00:00 2001 From: Mathieu Carbou Date: Fri, 14 Jun 2024 11:30:07 +0200 Subject: [PATCH] Use pio file for CI --- .github/workflows/ci.yml | 79 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0bcf0f..544e8f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,58 +64,57 @@ jobs: - name: Build Filters run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/Filters/Filters.ino" + pio_envs: + name: Get PlatformIO Envs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + key: pip + path: ~/.cache/pip + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install PlatformIO + run: | + python -m pip install --upgrade pip + pip install --upgrade platformio + - name: Get Envs + id: envs + run: | + echo "pio_default_envs=$(pio project config --json-output | jq -cr '[ .[][0] | select(startswith("env:") and (endswith("-debug")|not)) | .[4:] ]')" >> $GITHUB_OUTPUT + + outputs: + pio_default_envs: ${{ steps.envs.outputs.pio_default_envs }} + platformio: - name: pio ${{ matrix.name }} + name: "pio:${{ matrix.environment }}" + needs: [pio_envs] runs-on: ubuntu-latest strategy: fail-fast: false matrix: - include: - - name: esp32dev|arduino - board: esp32dev - platform: espressif32 - opts: - - name: esp32dev|arduino-2 - board: esp32dev - platform: espressif32@6.7.0 - opts: - - name: esp32dev|arduino-3 - board: esp32dev - platform: espressif32 - opts: "--project-option 'platform_packages=platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1, platform_packages=platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip'" - - name: esp32-s3-devkitc-1|arduino - board: esp32-s3-devkitc-1 - platform: espressif32 - opts: - - name: esp32-s3-devkitc-1|arduino-2 - board: esp32-s3-devkitc-1 - platform: espressif32@6.7.0 - opts: - - name: esp32-s3-devkitc-1|arduino-3 - board: esp32-s3-devkitc-1 - platform: espressif32 - opts: "--project-option 'platform_packages=platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1, platform_packages=platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip'" - - name: huzzah|espressif8266 - board: huzzah - platform: espressif8266 - opts: + environment: ${{ fromJSON(needs.pio_envs.outputs.pio_default_envs) }} + steps: - uses: actions/checkout@v4 - - name: Set up cache - uses: actions/cache@v4 + - uses: actions/cache@v4 with: path: | ~/.platformio ~/.cache/pip - key: ${{ matrix.name }} + key: pio - uses: actions/setup-python@v5 with: python-version: "3.x" - run: pip install platformio - - run: platformio platform install ${{ matrix.platform }} - - name: Build CaptivePortal - run: platformio ci "examples/CaptivePortal/CaptivePortal.ino" -l '.' -b ${{ matrix.board }} ${{ matrix.opts }} - - name: Build SimpleServer - run: platformio ci "examples/SimpleServer/SimpleServer.ino" -l '.' -b ${{ matrix.board }} ${{ matrix.opts }} - - name: Build Filters - run: platformio ci "examples/Filters/Filters.ino" -l '.' -b ${{ matrix.board }} ${{ matrix.opts }} + + - name: Install platformio + run: | + python -m pip install --upgrade pip + pip install --upgrade platformio + + - run: PLATFORMIO_SRC_DIR=examples/CaptivePortal pio run -e ${{ matrix.environment }} + - run: PLATFORMIO_SRC_DIR=examples/SimpleServer pio run -e ${{ matrix.environment }} + - run: PLATFORMIO_SRC_DIR=examples/Filters pio run -e ${{ matrix.environment }}