Skip to content

Commit

Permalink
wip: unify test app job, merge and publish junit results
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Sep 20, 2024
1 parent 45f1b7b commit 6eeb78c
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 32 deletions.
91 changes: 60 additions & 31 deletions .github/workflows/build_and_run_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,36 @@ jobs:
strategy:
fail-fast: false
matrix:
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "latest"]
idf_ver:
# - "release-v5.0"
# - "release-v5.1"
# - "release-v5.2"
# - "release-v5.3"
- "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
runs-on: ubuntu-22.04
container: espressif/idf:${{ matrix.idf_ver }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Build Apps
- name: Install dependencies
shell: bash
run: |
. ${IDF_PATH}/export.sh
pip install idf-component-manager idf-build-apps --upgrade
- name: Find Apps
shell: bash
run: |
. ${IDF_PATH}/export.sh
idf-build-apps find
- name: Build Apps
shell: bash
run: |
. ${IDF_PATH}/export.sh
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
idf-build-apps build --parallel-index ${{ matrix.parallel_index }}
- uses: actions/upload-artifact@v4
with:
Expand All @@ -52,9 +65,23 @@ jobs:
strategy:
fail-fast: false
matrix:
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "latest"]
idf_target: ["esp32"]
runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}"]
idf_ver:
# - "release-v5.0"
# - "release-v5.1"
# - "release-v5.2"
# - "release-v5.3"
- "latest"
runner:
- runs-on: "esp32"
marker: "generic"
target: "esp32"
# - runs-on: "ESP32-ETHERNET-KIT"
# marker: "ethernet"
# target: "esp32"
env:
TEST_RESULT_NAME: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}
TEST_RESULT_FILE: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}.xml
runs-on: [self-hosted, linux, docker, "${{ matrix.runner.runs-on }}"]
container:
image: python:3.11-bookworm
options: --privileged # Privileged mode has access to serial ports
Expand All @@ -69,30 +96,32 @@ jobs:
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/"
run: pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf
- name: Run apps
run: pytest --target=${{ matrix.idf_target }} -m generic --build-dir=build_${{ matrix.idf_target }} --ignore=test_app
run: pytest --junit-xml=${{ env.TEST_RESULT_FILE }} --target=${{ matrix.runner.target }} -m ${{ matrix.runner.marker }} --build-dir=build_${{ matrix.runner.target }} --ignore=test_app
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.TEST_RESULT_NAME }}
path: ${{ env.TEST_RESULT_FILE }}

run-ethernet-based-apps:
name: Run apps on ethernet runners
if: ${{ github.repository_owner == 'espressif' }}
needs: build
strategy:
fail-fast: false
matrix:
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "latest"]
idf_target: ["esp32"]
runs-on: [self-hosted, ESP32-ETHERNET-KIT]
container:
image: python:3.11-bookworm
options: --privileged # Privileged mode has access to serial ports
publish-results:
name: Publish Test results
needs:
- run-target
if: ${{ always() && github.repository_owner == 'espressif' }} # Run even if the previous step failed
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Download Test results
uses: actions/download-artifact@v4
with:
pattern: app_binaries_${{ matrix.idf_ver }}_*
merge-multiple: true
- 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 apps
run: pytest --target=${{ matrix.idf_target }} -m ethernet --build-dir=build_${{ matrix.idf_target }} --ignore=test_app
pattern: test_results_*
path: test_results
- name: List xml files
run: |
ls -l
ls -l test_results
ls -l test_results/test_results_*.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: test_results/**/*.xml
2 changes: 1 addition & 1 deletion .idf_build_apps.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target = "all"
target = "esp32" # TEMPORARY
paths = "."
recursive = true
exclude = [
Expand Down

0 comments on commit 6eeb78c

Please sign in to comment.