feature: added host tests #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "esp-mqtt: build/host-tests" | |
permissions: | |
contents: write | |
on: | |
push: | |
# branches: | |
# - master | |
pull_request: | |
types: [opened, synchronize, reopened, labeled] | |
jobs: | |
host_test_esp_modem: | |
name: Host Tests | |
runs-on: ubuntu-22.04 | |
container: espressif/idf:latest | |
steps: | |
- name: Checkout esp-mqtt | |
uses: actions/checkout@master | |
with: | |
path: esp-protocols | |
- name: Build and Test | |
shell: bash | |
run: | | |
apt-get update && apt-get install -y gcc-8 g++-8 python3-pip | |
${IDF_PATH}/install.sh | |
. ${IDF_PATH}/export.sh | |
echo "IDF_PATH=${IDF_PATH}" >> $GITHUB_ENV | |
rm -rf $IDF_PATH/components/mqtt/esp-mqtt | |
cp -r . $IDF_PATH/components/mqtt/esp-mqtt | |
cd $IDF_PATH/components/mqtt/esp-mqtt/host_test | |
idf.py build | |
./build/host_mqtt_client_test.elf -r junit -o junit.xml | |
host_test_gcov_esp_mqtt: | |
# if: github.event_name == 'push' | |
name: Run gcovr on esp mqtt host test | |
runs-on: ubuntu-22.04 | |
container: espressif/idf:latest | |
steps: | |
- name: Checkout esp-mqtt | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Build and Test | |
shell: bash | |
run: | | |
apt-get update && apt-get install -y ruby libbsd-dev rsync | |
cat sdkconfig.ci.coverage >> sdkconfig.defaults | |
rm -rf build | |
idf.py build | |
./build/host_mqtt_client_test.elf | |
- name: Run gcovr | |
shell: bash | |
run: | | |
python -m pip install gcovr | |
cd $IDF_PATH/components/mqtt/esp-mqtt | |
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 }}/components/mqtt/esp-mqtt/docs_gcovr | |
if-no-files-found: error | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: docs_gcovr | |
path: ${{ env.IDF_PATH }}/components/mqtt/esp-mqtt/docs_gcovr | |
- name: Deploy generated docs | |
uses: JamesIves/github-pages-deploy-action@v4.4.1 | |
with: | |
branch: gh-pages | |
folder: ${{ env.IDF_PATH }}/components/mqtt/esp-mqtt/docs_gcovr |