Skip to content

testing dynamic matrix for esp-idf versions #660

testing dynamic matrix for esp-idf versions

testing dynamic matrix for esp-idf versions #660

Workflow file for this run

name: IDFBuild
env:
REPO_URL: https://github.com/espressif/esp-idf
PROJECT_DIR: examples/Test/build_test
on:
push:
paths:
- '**.ino'
- '**.cpp'
- '**.hpp'
- '**.h'
- '**.c'
- '**IDFBuild.yml'
- 'CMakeLists.txt'
- 'esp-idf-versions.php'
pull_request:
jobs:
set_matrix:
name: Version planner ⊹
runs-on: ubuntu-latest
env:
max-versions: 3 # maximum core versions to test, starting at latest
outputs:
matrix: ${{steps.set-matrix.outputs.matrix}}
project_dir: ${{steps.set-matrix.outputs.project_dir}}
repo_url: ${{steps.set-matrix.outputs.repo_url}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup matrix
id: set-matrix
run: |
matrix=`php .github/scripts/esp-idf-versions.php`
echo $matrix | jq # debug
matrix="${matrix//'%'/'%25'}" # escape percent entities
matrix="${matrix//$'\n'/''}" # remove lf
matrix="${matrix//$'\r'/''}" # remove cr
echo "matrix=${matrix}" >> $GITHUB_OUTPUT
echo "project_dir=${{env.PROJECT_DIR}}" >> $GITHUB_OUTPUT
echo "repo_url=${{env.REPO_URL}}" >> $GITHUB_OUTPUT
build:
name: idf ${{ matrix.esp-idf-fqbn }}
needs: set_matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJSON(needs.set_matrix.outputs.matrix)}}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Cache pip for ${{ matrix.esp-idf-fqbn }}
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.idf-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache espressif tools for ${{ matrix.esp-idf-fqbn }}
uses: actions/cache@v3
id: espressif
with:
path: |
~/.espressif
key: ${{ runner.os }}-espressif-${{ matrix.idf-version }}-${{ hashFiles('**/lockfiles') }}
- name: Cache esp-idf for ${{ matrix.esp-idf-fqbn }}
id: cache-idf
uses: actions/cache@v3
with:
path: ~/esp/esp-idf
key: ${{ runner.os }}-idf-${{ matrix.idf-version }}-${{ hashFiles('**/lockfiles') }}
- name: Get/Check IDF ${{ matrix.esp-idf-fqbn }}
run: |
mkdir -p ~/esp
cd ~/esp
idf_fqbn="${{ matrix.esp-idf-fqbn }}"
idf_version=${idf_fqbn#*@}
if [ ! -d "./esp-idf/" ]; then git clone -b v$idf_version --recursive ${{ needs.set_matrix.outputs.repo_url }} esp-idf; fi
cd ~/esp/esp-idf
if [ ! -d "~/.espressif" ]; then ./install.sh; fi
- name: Build example for ${{ matrix.esp-idf-fqbn }}
run: |
source ~/esp/esp-idf/export.sh
idf_fqbn="${{ matrix.esp-idf-fqbn }}"
idf_board=${idf_fqbn%%@*}
cd ${{ needs.set_matrix.outputs.project_dir }}
idf.py set-target $idf_board
idf.py build