mirror of
https://github.com/espressif/esp-mqtt.git
synced 2026-06-05 21:04:46 +00:00
feature: added host tests
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
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-8 g++-8 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
|
||||
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/CodeCoverageSummary@v1.3.0
|
||||
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/github-pages-deploy-action@v4.4.1
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr
|
||||
Reference in New Issue
Block a user