|
| 1 | +name: Build and Run USB Test Application |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * *' # Every day at midnight |
| 6 | + pull_request: |
| 7 | + types: [opened, reopened, synchronize] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build USB TestApps |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + # idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "latest"] |
| 16 | + idf_ver: ["latest"] |
| 17 | + runs-on: ubuntu-20.04 |
| 18 | + container: espressif/idf:${{ matrix.idf_ver }} |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + submodules: 'true' |
| 23 | + - name: Clone esp-usb repository |
| 24 | + run: | |
| 25 | + git clone https://github.com/espressif/esp-usb.git |
| 26 | + - name: Build USB Test Application |
| 27 | + shell: bash |
| 28 | + run: | |
| 29 | + . ${IDF_PATH}/export.sh |
| 30 | + pip install idf-build-apps==2.4.3 --upgrade |
| 31 | + export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" |
| 32 | + export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" |
| 33 | + export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" |
| 34 | + idf-build-apps find |
| 35 | + idf-build-apps build |
| 36 | + - uses: actions/upload-artifact@v4 |
| 37 | + with: |
| 38 | + name: usb_test_app_bin_${{ matrix.idf_ver }} |
| 39 | + path: | |
| 40 | + **/test_app*/**/build_esp*/bootloader/bootloader.bin |
| 41 | + **/test_app*/**/build_esp*/partition_table/partition-table.bin |
| 42 | + **/test_app*/**/build_esp*/test_app_*.bin |
| 43 | + **/test_app*/**/build_esp*/flasher_args.json |
| 44 | + **/test_app*/**/build_esp*/config/sdkconfig.json |
| 45 | + if-no-files-found: error |
| 46 | + |
| 47 | + run-target: |
| 48 | + name: Run USB Device TestApps on target |
| 49 | + if: ${{ github.repository_owner == 'espressif' }} |
| 50 | + needs: build |
| 51 | + strategy: |
| 52 | + fail-fast: false |
| 53 | + matrix: |
| 54 | + idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "latest"] |
| 55 | + idf_target: ["esp32s2", "esp32p4"] |
| 56 | + runner_tag: ["usb_host", "usb_device"] |
| 57 | + exclude: |
| 58 | + # Exclude esp32p4 for releases before IDF 5.3 for all runner tags (esp32p4 support starts in IDF 5.3) |
| 59 | + - idf_ver: "release-v5.0" |
| 60 | + idf_target: "esp32p4" |
| 61 | + - idf_ver: "release-v5.1" |
| 62 | + idf_target: "esp32p4" |
| 63 | + - idf_ver: "release-v5.2" |
| 64 | + idf_target: "esp32p4" |
| 65 | + - idf_ver: "release-v5.3" # TODO: enable IDF 5.3 once the docker image is updated |
| 66 | + idf_target: "esp32p4" |
| 67 | + |
| 68 | + runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}", "${{ matrix.runner_tag }}"] |
| 69 | + container: |
| 70 | + image: python:3.11-bookworm |
| 71 | + options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw" |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v4 |
| 74 | + - name: Clone esp-usb repository |
| 75 | + run: | |
| 76 | + git clone https://github.com/espressif/esp-usb.git |
| 77 | + - name: Install Python packages |
| 78 | + env: |
| 79 | + PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" |
| 80 | + run: pip install --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pyserial pyusb |
| 81 | + - uses: actions/download-artifact@v4 |
| 82 | + with: |
| 83 | + name: usb_test_app_bin_${{ matrix.idf_ver }} |
| 84 | + path: esp_usb |
| 85 | + - name: Run USB Test App on target |
| 86 | + run: pytest --embedded-services esp,idf --target=${{ matrix.idf_target }} -m ${{ matrix.runner_tag }} --build-dir=build_${{ matrix.idf_target }} |
0 commit comments