Skip to content

Rename pytest file to test file #3

Rename pytest file to test file

Rename pytest file to test file #3

name: Build and Test Application
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
env:
IDF_PATH: /opt/esp/idf
test_dirs: .
defaults:
run:
shell: bash
jobs:
build-test-app:
name: Build Test App
strategy:
fail-fast: false
matrix:
idf-branch:
- release-v5.0
- release-v5.1
target:
- esp32s3
runs-on: ubuntu-22.04
container:
image: espressif/idf:${{ matrix.idf-branch }}
steps:
- uses: actions/checkout@v3
- name: Install Python Dependencies
run: |
. $IDF_PATH/export.sh
python -m pip install idf-build-apps
- name: Build Test Application with ESP-IDF
run: |
. $IDF_PATH/export.sh
idf-build-apps build \
-p ${{ env.test_dirs }} \
--target ${{ matrix.target }} \
--recursive \
--build-dir build_${{ matrix.target }}_${{ matrix.idf-branch }}
- name: Upload files to artifacts for run-target job
uses: actions/upload-artifact@v3
with:
name: built_binaries_${{ matrix.target }}_${{ matrix.idf-branch }}
path: |
**/build**/bootloader/bootloader.bin
**/build**/partition_table/partition-table.bin
**/build**/*.bin
**/build**/*.elf
**/build**/flasher_args.json
if-no-files-found: error
simulate-test:
name: Simulate Test on WokWi
needs: build-test-app
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
idf-branch:
- release-v5.0
- release-v5.1
target:
- esp32s3
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # Ensure this matches the Python version needed for your testing
- name: Download built binaries from build job
uses: actions/download-artifact@v2
with:
name: built_binaries_${{ matrix.target }}_${{ matrix.idf-branch }}
- name: Install Python packages for PyTest
run: |
pip install \
pytest-embedded \
pytest-embedded-serial-esp \
pytest-embedded-idf
- name: Run Test App in WokWi Simulator
run: |
pytest ${{ env.test_dirs }} \
--embedded-services idf,wokwi \
--tb short \
--junit-xml test_wokwi_${{ matrix.target }}_${{ matrix.idf-branch }}.xml
- uses: actions/upload-artifact@v2
with:
name: test_wokwi_${{ matrix.target }}_${{ matrix.idf-branch }}_junit
path: test_wokwi_${{ matrix.target }}_${{ matrix.idf-branch }}.xml
publish-results:
name: Publish Test App results
needs: simulate-test
runs-on: ubuntu-20.04
steps:
- name: Download Test results
uses: actions/download-artifact@v3
with:
path: test_results
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: test_results/**/*.xml