.. #151
This file contains 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
# | |
# Copyright 2024 Davide Bettio <[email protected]> | |
# | |
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later | |
# | |
name: ESP32 Sim test | |
on: | |
push: | |
paths: | |
- ".github/workflows/esp32-simtest.yaml" | |
- "CMakeLists.txt" | |
- "libs/**" | |
- "src/platforms/esp32/**" | |
- "src/platforms/esp32/**/**" | |
- "src/libAtomVM/**" | |
- "tools/packbeam/**" | |
pull_request: | |
paths: | |
- ".github/workflows/esp32-simtest.yaml" | |
- "src/platforms/esp32/**" | |
- "src/platforms/esp32/**/**" | |
- "src/libAtomVM/**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
cli_token: | |
name: WOKWI_CLI_TOKEN presence | |
runs-on: ubuntu-latest | |
outputs: | |
token_check: ${{ steps.token_check.outputs.should-run }} | |
steps: | |
- name: Mark esp-sim-test job as 'to be run' | |
id: token_check | |
env: | |
wokwi_secret: ${{ secrets.WOKWI_CLI_TOKEN }} | |
run: | | |
if [${{ env.wokwi_secret }} == '']; | |
then | |
echo "WOKWI_CLI_TOKEN not found" | |
else | |
echo "WOKWI_CLI_TOKEN found continuing" | |
echo "should-run=true" >> $GITHUB_OUTPUT | |
fi | |
esp-sim-test: | |
needs: cli_token | |
runs-on: ubuntu-latest | |
if: needs.cli_token.outputs.token_check == 'true' | |
container: espressif/idf:${{ matrix.idf-version }} | |
strategy: | |
fail-fast: false | |
# focus on device diversity. | |
matrix: | |
esp-idf-target: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c6"] | |
idf-version: ${{ ((contains(github.event.head_commit.message, 'full_sim_test')||contains(github.event.pull_request.title, 'full_sim_test')) && fromJSON('["v5.1.4", "v5.2.3", "v5.3.1"]')) || fromJSON('["v5.3.1"]') }} | |
include: | |
- esp-idf-target: "esp32p4" | |
idf-version: "v5.3.1" | |
- esp-idf-target: "esp32h2" | |
idf-version: "v5.3.1" | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install dependencies to build host AtomVM | |
run: | | |
set -eu | |
apt update | |
DEBIAN_FRONTEND=noninteractive apt install -y -q \ | |
doxygen erlang-base erlang-dialyzer \ | |
libglib2.0-0 libpixman-1-0 \ | |
gcc g++ zlib1g-dev libsdl2-2.0-0 libslirp0 libmbedtls-dev | |
- name: Install the Wokwi CLI | |
run: curl -L https://wokwi.com/ci/install.sh | sh | |
- name: Install pytest and pytest-embedded plugins | |
run: | | |
set -e | |
. $IDF_PATH/export.sh | |
pip install pytest==8.3.3 \ | |
pytest-embedded==1.11.5 \ | |
pytest-embedded-idf==1.11.5 \ | |
pytest-embedded-qemu==1.11.5 \ | |
pytest-embedded-wokwi==1.11.5 | |
# - name: "On Esp32 use board with sd card" | |
# if: matrix.esp-idf-target == 'esp32' | |
# shell: bash | |
# working-directory: ./src/platforms/esp32/test/ | |
# run: | | |
# cp diagram.esp32.json diagram.json | |
- name: Set SDKCONFIG_DEFAULTS and Build ESP32-sim tests using idf.py | |
working-directory: ./src/platforms/esp32/test/ | |
run: | | |
set -e | |
. $IDF_PATH/export.sh | |
idf.py -DSDKCONFIG_DEFAULTS='sdkconfig.ci.wokwi' set-target ${{matrix.esp-idf-target}} | |
idf.py build | |
- name: Run ESP32-sim tests using Wokwi CI | |
working-directory: ./src/platforms/esp32/test/ | |
env: | |
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }} | |
timeout-minutes: 10 | |
run: | | |
set -e | |
. $IDF_PATH/export.sh | |
pytest -k 'test_atomvm_sim' --embedded-services=idf,wokwi --wokwi-timeout=240000 --target=${{ matrix.esp-idf-target }} --wokwi-diagram=sim_boards/diagram.${{ matrix.esp-idf-target }}.json -s |