Skip to content

Enqueued qos0 dispatch MQTT_EVENT_PUBLISHED (IDFGH-12511) #99

Enqueued qos0 dispatch MQTT_EVENT_PUBLISHED (IDFGH-12511)

Enqueued qos0 dispatch MQTT_EVENT_PUBLISHED (IDFGH-12511) #99

name: "esp-mqtt: host-tests"
on:
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@v3
- 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@v3
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