Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/actions/build-app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build app
description: Build ESP-IDF applications

inputs:
idf_version:
required: true
description: ESP-IDF version to use
target:
required: true
description: Target platform
app_name:
required: true
description: Application name
app_path:
required: true
description: Path to the application
build_dir:
required: false
description: Directory for build artifacts
default: build_@t_

outputs:
artifacts_path:
description: "App path"
value: ${{ steps.set-path.outputs.artifacts_path }}

runs:
using: "composite"
steps:
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ inputs.idf_version }}-${{ inputs.target }}
- name: Install dependencies
shell: bash
run: |
. ${IDF_PATH}/export.sh
python -m pip install idf-build-apps
- name: Build ${{ inputs.app_name }} with IDF-${{ inputs.idf_version }}
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}"
rm -rf $IDF_PATH/components/mqtt/esp-mqtt
cp -r . $IDF_PATH/components/mqtt/esp-mqtt
IDF_CCACHE_ENABLE=1 idf-build-apps build --config-rules "sdkconfig.ci.*=" "=default" --collect-app-info build_info_${{ inputs.idf_version }}.json --build-dir ${{ inputs.build_dir }} -p ${{ inputs.app_path }} -t ${{ inputs.target }}
- name: Set app artifact path
id: set-path
shell: bash
run: |
artifacts_path=$(eval echo "${{ inputs.app_path }}")
echo "artifacts_path=$artifacts_path" >> "$GITHUB_OUTPUT"
52 changes: 52 additions & 0 deletions .github/actions/target-pytest/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Target Pytest run
description: Run pytest test cases

inputs:
target:
required: true
description: Target platform
app_name:
required: true
description: Application name
app_path:
required: true
description: Path to the application
build_dir:
required: false
description: Directory for build artifacts

runs:
using: "composite"
steps:
- name: Install Python packages
shell: bash
env:
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/"
run: pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pytest-custom_exit_code
- name: Run apps
shell: bash
run: |
pytest ${{inputs.app_path}} --ignore-glob '*/managed_components/*' --ignore=.github --target=${{ inputs.target }} --embedded-services esp,idf --build-dir build_esp32_default
# - name: Upload test results
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: ${{ env.TEST_RESULT_NAME }}
# path: ${{ env.TEST_RESULT_FILE }}

# publish-results:
# name: Publish Test results
# needs:
# - run-target
# if: github.repository_owner == 'espressif' && always() && github.event_name == 'pull_request' && needs.prepare.outputs.build_only == '0'
# runs-on: ubuntu-22.04
# steps:
# - name: Download Test results
# uses: actions/download-artifact@v4
# with:
# pattern: test_results_*
# path: test_results
# - name: Publish Test Results
# uses: EnricoMi/publish-unit-test-result-action@v2
# with:
# files: test_results/**/*.xml path: build/*.xml
26 changes: 12 additions & 14 deletions .github/workflows/build-and-target-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,20 @@ on:
type: string
required: true


jobs:
build-app:
uses: "./.github/workflows/build-app.yml"
with:
idf_version: ${{inputs.idf_version}}
target: ${{inputs.target}}
app_name: ${{inputs.app_name}}
app_path: ${{inputs.app_path}}

# run-on-target:
# needs: build-app
# uses: "./.github/workflows/run-on-target.yml"
# with:
# idf_version: ${{inputs.idf_version}}
# target: ${{inputs.target}}
# app_name: ${{inputs.app_name}}
# app_path: ${{inputs.app_path}}
idf_version: ${{inputs.idf_version}}
target: ${{inputs.target}}
app_name: ${{inputs.app_name}}
app_path: ${{inputs.app_path}}

run-on-target:
needs: build-app
uses: "./.github/workflows/run-on-target.yml"
with:
idf_version: ${{inputs.idf_version}}
target: ${{inputs.target}}
app_name: ${{inputs.app_name}}
app_path: ${{inputs.app_path}}
66 changes: 33 additions & 33 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,38 @@ on:
jobs:
build:
name: Build App
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
container: espressif/idf:${{inputs.idf_version}}
steps:
- if: ${{ env.ACT }}
name: Add node for local tests
run: |
curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs
- name: Checkout esp-mqtt
uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{inputs.idf_version}}-${{inputs.target}}
- name: Build ${{ inputs.app_name }} with IDF-${{ inputs.idf_version }}
shell: bash
run: |
${IDF_PATH}/install.sh --enable-pytest
. ${IDF_PATH}/export.sh
python -m pip install idf-build-apps
rm -rf $IDF_PATH/components/mqtt/esp-mqtt
cp -r . $IDF_PATH/components/mqtt/esp-mqtt
IDF_CCACHE_ENABLE=1 idf-build-apps build --config-file ci/idf_build_apps.toml -p ${{inputs.app_path}} -t ${{inputs.target}}
- name: Upload files to artifacts for run-target job
uses: actions/upload-artifact@v4
if: ${{inputs.upload_artifacts}}
with:
name: mqtt_bin_${{inputs.target}}_${{ inputs.idf_version }}_${{ inputs.app_name }}
path: |
build_${{inputs.target}}_${{inputs.app_name}}/bootloader/bootloader.bin
build_${{inputs.target}}_${{inputs.app_name}}/partition_table/partition-table.bin
build_${{inputs.target}}_${{inputs.app_name}}/*.bin
build_${{inputs.target}}_${{inputs.app_name}}/*.elf
build_${{inputs.target}}_${{inputs.app_name}}/flasher_args.json
if-no-files-found: error
- if: ${{ env.ACT }}
name: Add node for local tests
run: |
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs
- name: Checkout esp-mqtt
uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{inputs.idf_version}}-${{inputs.target}}
- name: Build ${{ inputs.app_name }} with IDF-${{ inputs.idf_version }}
shell: bash
run: |
${IDF_PATH}/install.sh
. ${IDF_PATH}/export.sh
python -m pip install idf-build-apps
rm -rf $IDF_PATH/components/mqtt/esp-mqtt
cp -r . $IDF_PATH/components/mqtt/esp-mqtt
IDF_CCACHE_ENABLE=1 idf-build-apps build --config-file ci/idf_build_apps.toml -p ${{inputs.app_path}} -t ${{inputs.target}}
- name: Upload files to artifacts for run-target job
uses: actions/upload-artifact@v4
if: ${{inputs.upload_artifacts}}
with:
name: mqtt_bin_${{inputs.target}}_${{ inputs.idf_version }}_${{ inputs.app_name }}
path: |
build_${{inputs.target}}_${{inputs.app_name}}/bootloader/bootloader.bin
build_${{inputs.target}}_${{inputs.app_name}}/partition_table/partition-table.bin
build_${{inputs.target}}_${{inputs.app_name}}/*.bin
build_${{inputs.target}}_${{inputs.app_name}}/*.elf
build_${{inputs.target}}_${{inputs.app_name}}/flasher_args.json
if-no-files-found: error
150 changes: 75 additions & 75 deletions .github/workflows/mqtt__host-tests.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
name: "esp-mqtt: host-tests"

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, labeled]
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, labeled]

jobs:
host_test_esp_mqtt:
name: Host Tests
runs-on: ubuntu-22.04
permissions:
contents: write
container: espressif/idf:latest
env:
COMP_DIR: components/mqtt/esp-mqtt
steps:
- name: Checkout esp-mqtt
uses: actions/checkout@v4
- name: Build and Test
shell: bash
run: |
apt-get update && apt-get install -y gcc g++ python3-pip rsync
${IDF_PATH}/install.sh
. ${IDF_PATH}/export.sh
echo "IDF_PATH=${IDF_PATH}" >> $GITHUB_ENV
rm -rf $IDF_PATH/${{ env.COMP_DIR }}
cp -r . $IDF_PATH/${{ env.COMP_DIR }}
cd $IDF_PATH/${{ env.COMP_DIR }}/host_test
idf.py build
./build/host_mqtt_client_test.elf -r junit -o junit.xml
- name: Build with Coverage Enabled
shell: bash
run: |
. ${IDF_PATH}/export.sh
cd $IDF_PATH/${{ env.COMP_DIR }}/host_test
cat sdkconfig.ci.coverage >> sdkconfig.defaults
rm -rf build sdkconfig
idf.py build
./build/host_mqtt_client_test.elf
- name: Run gcovr
shell: bash
run: |
python -m pip install gcovr --break-system-packages
cd $IDF_PATH/${{ env.COMP_DIR }}
gcov -b host_test/main/mqtt_client.c. -o `find . -name "mqtt_client*gcda" -exec dirname {} \;`
gcovr --gcov-ignore-parse-errors -g -k -r . --html index.html -x esp_mqtt_coverage.xml
mkdir docs_gcovr
mv index.html docs_gcovr
touch docs_gcovr/.nojekyll
cp -r docs_gcovr esp_mqtt_coverage.xml $GITHUB_WORKSPACE
- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: ${{ env.GITHUB_WORKSPACE }}/**/esp_mqtt_coverage.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: '60 80'
- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: docs_gcovr
path: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr
if-no-files-found: error
- name: Deploy coverage summary
if: github.ref == 'refs/heads/master'
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr
host_test_esp_mqtt:
name: Host Tests
runs-on: ubuntu-24.04
permissions:
contents: write
container: espressif/idf:latest
env:
COMP_DIR: components/mqtt/esp-mqtt
steps:
- name: Checkout esp-mqtt
uses: actions/checkout@v4
- name: Build and Test
shell: bash
run: |
apt-get update && apt-get install -y gcc g++ python3-pip rsync
${IDF_PATH}/install.sh
. ${IDF_PATH}/export.sh
echo "IDF_PATH=${IDF_PATH}" >> $GITHUB_ENV
rm -rf $IDF_PATH/${{ env.COMP_DIR }}
cp -r . $IDF_PATH/${{ env.COMP_DIR }}
cd $IDF_PATH/${{ env.COMP_DIR }}/host_test
idf.py build
./build/host_mqtt_client_test.elf -r junit -o junit.xml
- name: Build with Coverage Enabled
shell: bash
run: |
. ${IDF_PATH}/export.sh
cd $IDF_PATH/${{ env.COMP_DIR }}/host_test
cat sdkconfig.ci.coverage >> sdkconfig.defaults
rm -rf build sdkconfig
idf.py build
./build/host_mqtt_client_test.elf
- name: Run gcovr
shell: bash
run: |
python -m pip install gcovr --break-system-packages
cd $IDF_PATH/${{ env.COMP_DIR }}
gcov -b host_test/main/mqtt_client.c. -o `find . -name "mqtt_client*gcda" -exec dirname {} \;`
gcovr --gcov-ignore-parse-errors -g -k -r . --html index.html -x esp_mqtt_coverage.xml
mkdir docs_gcovr
mv index.html docs_gcovr
touch docs_gcovr/.nojekyll
cp -r docs_gcovr esp_mqtt_coverage.xml $GITHUB_WORKSPACE
- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: ${{ env.GITHUB_WORKSPACE }}/**/esp_mqtt_coverage.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: "60 80"
- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: docs_gcovr
path: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr
if-no-files-found: error
- name: Deploy coverage summary
if: github.ref == 'refs/heads/master'
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr
Loading
Loading