Adding QEmu to esp-idf CI tests #15
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: IDFBuild | |
| env: | |
| REPO_URL: https://github.com/espressif/esp-idf | |
| PROJECT_DIR: examples/esp-idf-psramvfs | |
| on: | |
| push: | |
| paths: | |
| - '**.ino' | |
| - '**.cpp' | |
| - '**.hpp' | |
| - '**.h' | |
| - '**.c' | |
| - '**IDFBuild.yml' | |
| - 'CMakeLists.txt' | |
| - 'esp-idf-versions.php' | |
| pull_request: | |
| workflow_dispatch: | |
| 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@v4 | |
| 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@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - 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 }} | |
| id: idfbuild | |
| run: | | |
| source ~/esp/esp-idf/export.sh | |
| idf_fqbn="${{ matrix.esp-idf-fqbn }}" | |
| idf_board=${idf_fqbn%%@*} | |
| merge_bin=`idf.py --help | grep merge | grep bin | xargs` | |
| cd ${{ needs.set_matrix.outputs.project_dir }} | |
| idf.py set-target $idf_board | |
| idf.py build $merge_bin | |
| ls build/ -la | |
| [[ -f "build/merged-binary.bin" ]] || idf_board=none | |
| echo "idf_board=$idf_board" >> $GITHUB_OUTPUT | |
| if [[ "$idf_board" =~ ^esp32(c3|s3)?$ ]]; then echo "qemu=true" >> $GITHUB_OUTPUT; else echo "qemu=false" >> $GITHUB_OUTPUT; fi | |
| - name: Run ESP32 project in QEmu | |
| if: steps.idfbuild.outputs.qemu == 'true' | |
| uses: tobozo/esp32-qemu-sim@main | |
| with: | |
| debug: true | |
| chip: ${{ steps.idfbuild.outputs.idf_board}} | |
| psram: 2M | |
| flash-image: ${{ needs.set_matrix.outputs.project_dir }}/build/merged-binary.bin | |
| # build-folder: test/build | |
| # partitions-csv: partitions.csv | |
| # firmware-bin: test.ino.bin | |
| # bootloader-bin: test.ino.bootloader.bin | |
| # partitions-bin: test.ino.partitions.bin | |
| # spiffs-bin: test.ino.spiffs.bin | |
| timeout-interrupt-regex: "Test Complete" | |