Build and Run Examples #204
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
name: Build and Run Examples | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Once per day at midnight | |
pull_request: | |
types: [opened, reopened, synchronize] | |
jobs: | |
build: | |
name: Build Examples | |
strategy: | |
fail-fast: false | |
matrix: | |
idf_ver: ["release-v4.4", "release-v5.0", "release-v5.1", "latest"] | |
parallel_index: [1,2,3,4,5] # This must from 1 to 'parallel_count' defined in .idf_build_apps.toml | |
runs-on: ubuntu-20.04 | |
container: espressif/idf:${{ matrix.idf_ver }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Build Examples | |
shell: bash | |
run: | | |
. ${IDF_PATH}/export.sh | |
pip install idf-component-manager idf-build-apps --upgrade | |
export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" | |
export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" | |
export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" | |
idf-build-apps find --config sdkconfig.ci | |
idf-build-apps build --config sdkconfig.ci --parallel-index ${{ matrix.parallel_index }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: example_binaries_${{ matrix.idf_ver }} | |
path: | | |
*/examples/*/build_esp*/bootloader/bootloader.bin | |
*/examples/*/build_esp*/partition_table/partition-table.bin | |
*/examples/*/build_esp*/*.bin | |
*/examples/*/build_esp*/flasher_args.json | |
*/examples/*/build_esp*/config/sdkconfig.json | |
run-target: | |
name: Run examples on target | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
idf_ver: ["release-v4.4", "release-v5.0", "release-v5.1", "latest"] | |
idf_target: ["esp32"] | |
runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}"] | |
container: | |
image: python:3.7-buster | |
options: --privileged # Privileged mode has access to serial ports | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: example_binaries_${{ matrix.idf_ver }} | |
- name: Install Python packages | |
env: | |
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" | |
run: pip install --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf | |
- name: Run examples | |
run: pytest --target=${{ matrix.idf_target }} -m generic --build-dir=build_${{ matrix.idf_target }} --ignore=usb --ignore=test_app | |
run-ethernet-based-examples: | |
name: Run examples on ethernet runners | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
idf_ver: ["release-v4.4", "release-v5.0", "release-v5.1", "latest"] | |
idf_target: ["esp32"] | |
runs-on: [self-hosted, ESP32-ETHERNET-KIT] | |
container: | |
image: python:3.7-buster | |
options: --privileged # Privileged mode has access to serial ports | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: example_binaries_${{ matrix.idf_ver }} | |
- name: Install Python packages | |
env: | |
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" | |
run: pip install --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf | |
- name: Run examples | |
run: pytest --target=${{ matrix.idf_target }} -m ethernet --build-dir=build_${{ matrix.idf_target }} --ignore=usb --ignore=test_app |