Skip to content

Commit 42f5cfc

Browse files
Adds publish connect to gh
Placeholder commit for testing
1 parent 6af4446 commit 42f5cfc

File tree

8 files changed

+523
-198
lines changed

8 files changed

+523
-198
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build app
2+
description: Build ESP-IDF applications
3+
4+
inputs:
5+
idf_version:
6+
required: true
7+
description: ESP-IDF version to use
8+
target:
9+
required: true
10+
description: Target platform
11+
app_name:
12+
required: true
13+
description: Application name
14+
app_path:
15+
required: true
16+
description: Path to the application
17+
build_dir:
18+
required: false
19+
description: Directory for build artifacts
20+
default: build_@t_
21+
22+
outputs:
23+
artifacts_path:
24+
description: "App path"
25+
value: ${{ steps.set-path.outputs.artifacts_path }}
26+
27+
runs:
28+
using: "composite"
29+
steps:
30+
- name: ccache
31+
uses: hendrikmuhs/[email protected]
32+
with:
33+
key: ${{ inputs.idf_version }}-${{ inputs.target }}
34+
- name: Install dependencies
35+
shell: bash
36+
run: |
37+
. ${IDF_PATH}/export.sh
38+
python -m pip install idf-build-apps
39+
- name: Build ${{ inputs.app_name }} with IDF-${{ inputs.idf_version }}
40+
shell: bash
41+
run: |
42+
. ${IDF_PATH}/export.sh
43+
export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
44+
export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes"
45+
export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}"
46+
rm -rf $IDF_PATH/components/mqtt/esp-mqtt
47+
cp -r . $IDF_PATH/components/mqtt/esp-mqtt
48+
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 }}
49+
- name: Set app artifact path
50+
id: set-path
51+
shell: bash
52+
run: |
53+
artifacts_path=$(eval echo "${{ inputs.app_path }}")
54+
echo "artifacts_path=$artifacts_path" >> "$GITHUB_OUTPUT"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Target Pytest run
2+
description: Run pytest test cases
3+
4+
inputs:
5+
target:
6+
required: true
7+
description: Target platform
8+
app_name:
9+
required: true
10+
description: Application name
11+
app_path:
12+
required: true
13+
description: Path to the application
14+
build_dir:
15+
required: false
16+
description: Directory for build artifacts
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: Install Python packages
22+
shell: bash
23+
env:
24+
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/"
25+
run: pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pytest-custom_exit_code
26+
- name: Run apps
27+
shell: bash
28+
run: |
29+
pytest ${{inputs.app_path}} --ignore-glob '*/managed_components/*' --ignore=.github --target=${{ inputs.target }} --embedded-services esp,idf --build-dir build_esp32_default
30+
# - name: Upload test results
31+
# uses: actions/upload-artifact@v4
32+
# if: always()
33+
# with:
34+
# name: ${{ env.TEST_RESULT_NAME }}
35+
# path: ${{ env.TEST_RESULT_FILE }}
36+
37+
# publish-results:
38+
# name: Publish Test results
39+
# needs:
40+
# - run-target
41+
# if: github.repository_owner == 'espressif' && always() && github.event_name == 'pull_request' && needs.prepare.outputs.build_only == '0'
42+
# runs-on: ubuntu-22.04
43+
# steps:
44+
# - name: Download Test results
45+
# uses: actions/download-artifact@v4
46+
# with:
47+
# pattern: test_results_*
48+
# path: test_results
49+
# - name: Publish Test Results
50+
# uses: EnricoMi/publish-unit-test-result-action@v2
51+
# with:
52+
# files: test_results/**/*.xml path: build/*.xml

.github/workflows/build-and-target-test.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,20 @@ on:
1616
type: string
1717
required: true
1818

19-
2019
jobs:
2120
build-app:
2221
uses: "./.github/workflows/build-app.yml"
2322
with:
24-
idf_version: ${{inputs.idf_version}}
25-
target: ${{inputs.target}}
26-
app_name: ${{inputs.app_name}}
27-
app_path: ${{inputs.app_path}}
28-
29-
# run-on-target:
30-
# needs: build-app
31-
# uses: "./.github/workflows/run-on-target.yml"
32-
# with:
33-
# idf_version: ${{inputs.idf_version}}
34-
# target: ${{inputs.target}}
35-
# app_name: ${{inputs.app_name}}
36-
# app_path: ${{inputs.app_path}}
23+
idf_version: ${{inputs.idf_version}}
24+
target: ${{inputs.target}}
25+
app_name: ${{inputs.app_name}}
26+
app_path: ${{inputs.app_path}}
3727

28+
run-on-target:
29+
needs: build-app
30+
uses: "./.github/workflows/run-on-target.yml"
31+
with:
32+
idf_version: ${{inputs.idf_version}}
33+
target: ${{inputs.target}}
34+
app_name: ${{inputs.app_name}}
35+
app_path: ${{inputs.app_path}}

.github/workflows/build-app.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,38 @@ on:
2222
jobs:
2323
build:
2424
name: Build App
25-
runs-on: ubuntu-20.04
25+
runs-on: ubuntu-24.04
2626
container: espressif/idf:${{inputs.idf_version}}
2727
steps:
28-
- if: ${{ env.ACT }}
29-
name: Add node for local tests
30-
run: |
31-
curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
32-
apt-get install -y nodejs
33-
- name: Checkout esp-mqtt
34-
uses: actions/checkout@v4
35-
- name: ccache
36-
uses: hendrikmuhs/[email protected]
37-
with:
38-
key: ${{inputs.idf_version}}-${{inputs.target}}
39-
- name: Build ${{ inputs.app_name }} with IDF-${{ inputs.idf_version }}
40-
shell: bash
41-
run: |
42-
${IDF_PATH}/install.sh --enable-pytest
43-
. ${IDF_PATH}/export.sh
44-
python -m pip install idf-build-apps
45-
rm -rf $IDF_PATH/components/mqtt/esp-mqtt
46-
cp -r . $IDF_PATH/components/mqtt/esp-mqtt
47-
IDF_CCACHE_ENABLE=1 idf-build-apps build --config-file ci/idf_build_apps.toml -p ${{inputs.app_path}} -t ${{inputs.target}}
48-
- name: Upload files to artifacts for run-target job
49-
uses: actions/upload-artifact@v4
50-
if: ${{inputs.upload_artifacts}}
51-
with:
52-
name: mqtt_bin_${{inputs.target}}_${{ inputs.idf_version }}_${{ inputs.app_name }}
53-
path: |
54-
build_${{inputs.target}}_${{inputs.app_name}}/bootloader/bootloader.bin
55-
build_${{inputs.target}}_${{inputs.app_name}}/partition_table/partition-table.bin
56-
build_${{inputs.target}}_${{inputs.app_name}}/*.bin
57-
build_${{inputs.target}}_${{inputs.app_name}}/*.elf
58-
build_${{inputs.target}}_${{inputs.app_name}}/flasher_args.json
59-
if-no-files-found: error
28+
- if: ${{ env.ACT }}
29+
name: Add node for local tests
30+
run: |
31+
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
32+
apt-get install -y nodejs
33+
- name: Checkout esp-mqtt
34+
uses: actions/checkout@v4
35+
- name: ccache
36+
uses: hendrikmuhs/[email protected]
37+
with:
38+
key: ${{inputs.idf_version}}-${{inputs.target}}
39+
- name: Build ${{ inputs.app_name }} with IDF-${{ inputs.idf_version }}
40+
shell: bash
41+
run: |
42+
${IDF_PATH}/install.sh
43+
. ${IDF_PATH}/export.sh
44+
python -m pip install idf-build-apps
45+
rm -rf $IDF_PATH/components/mqtt/esp-mqtt
46+
cp -r . $IDF_PATH/components/mqtt/esp-mqtt
47+
IDF_CCACHE_ENABLE=1 idf-build-apps build --config-file ci/idf_build_apps.toml -p ${{inputs.app_path}} -t ${{inputs.target}}
48+
- name: Upload files to artifacts for run-target job
49+
uses: actions/upload-artifact@v4
50+
if: ${{inputs.upload_artifacts}}
51+
with:
52+
name: mqtt_bin_${{inputs.target}}_${{ inputs.idf_version }}_${{ inputs.app_name }}
53+
path: |
54+
build_${{inputs.target}}_${{inputs.app_name}}/bootloader/bootloader.bin
55+
build_${{inputs.target}}_${{inputs.app_name}}/partition_table/partition-table.bin
56+
build_${{inputs.target}}_${{inputs.app_name}}/*.bin
57+
build_${{inputs.target}}_${{inputs.app_name}}/*.elf
58+
build_${{inputs.target}}_${{inputs.app_name}}/flasher_args.json
59+
if-no-files-found: error
Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,80 @@
11
name: "esp-mqtt: host-tests"
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
pull_request:
8-
types: [opened, synchronize, reopened, labeled]
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened, labeled]
99

1010
jobs:
11-
host_test_esp_mqtt:
12-
name: Host Tests
13-
runs-on: ubuntu-22.04
14-
permissions:
15-
contents: write
16-
container: espressif/idf:latest
17-
env:
18-
COMP_DIR: components/mqtt/esp-mqtt
19-
steps:
20-
- name: Checkout esp-mqtt
21-
uses: actions/checkout@v4
22-
- name: Build and Test
23-
shell: bash
24-
run: |
25-
apt-get update && apt-get install -y gcc g++ python3-pip rsync
26-
${IDF_PATH}/install.sh
27-
. ${IDF_PATH}/export.sh
28-
echo "IDF_PATH=${IDF_PATH}" >> $GITHUB_ENV
29-
rm -rf $IDF_PATH/${{ env.COMP_DIR }}
30-
cp -r . $IDF_PATH/${{ env.COMP_DIR }}
31-
cd $IDF_PATH/${{ env.COMP_DIR }}/host_test
32-
idf.py build
33-
./build/host_mqtt_client_test.elf -r junit -o junit.xml
34-
- name: Build with Coverage Enabled
35-
shell: bash
36-
run: |
37-
. ${IDF_PATH}/export.sh
38-
cd $IDF_PATH/${{ env.COMP_DIR }}/host_test
39-
cat sdkconfig.ci.coverage >> sdkconfig.defaults
40-
rm -rf build sdkconfig
41-
idf.py build
42-
./build/host_mqtt_client_test.elf
43-
- name: Run gcovr
44-
shell: bash
45-
run: |
46-
python -m pip install gcovr --break-system-packages
47-
cd $IDF_PATH/${{ env.COMP_DIR }}
48-
gcov -b host_test/main/mqtt_client.c. -o `find . -name "mqtt_client*gcda" -exec dirname {} \;`
49-
gcovr --gcov-ignore-parse-errors -g -k -r . --html index.html -x esp_mqtt_coverage.xml
50-
mkdir docs_gcovr
51-
mv index.html docs_gcovr
52-
touch docs_gcovr/.nojekyll
53-
cp -r docs_gcovr esp_mqtt_coverage.xml $GITHUB_WORKSPACE
54-
- name: Code Coverage Summary Report
55-
uses: irongut/[email protected]
56-
with:
57-
filename: ${{ env.GITHUB_WORKSPACE }}/**/esp_mqtt_coverage.xml
58-
badge: true
59-
fail_below_min: false
60-
format: markdown
61-
hide_branch_rate: false
62-
hide_complexity: false
63-
indicators: true
64-
output: both
65-
thresholds: '60 80'
66-
- name: Write to Job Summary
67-
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
68-
- name: Upload artifacts
69-
uses: actions/upload-artifact@v4
70-
if: always()
71-
with:
72-
name: docs_gcovr
73-
path: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr
74-
if-no-files-found: error
75-
- name: Deploy coverage summary
76-
if: github.ref == 'refs/heads/master'
77-
uses: JamesIves/[email protected]
78-
with:
79-
branch: gh-pages
80-
folder: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr
11+
host_test_esp_mqtt:
12+
name: Host Tests
13+
runs-on: ubuntu-24.04
14+
permissions:
15+
contents: write
16+
container: espressif/idf:latest
17+
env:
18+
COMP_DIR: components/mqtt/esp-mqtt
19+
steps:
20+
- name: Checkout esp-mqtt
21+
uses: actions/checkout@v4
22+
- name: Build and Test
23+
shell: bash
24+
run: |
25+
apt-get update && apt-get install -y gcc g++ python3-pip rsync
26+
${IDF_PATH}/install.sh
27+
. ${IDF_PATH}/export.sh
28+
echo "IDF_PATH=${IDF_PATH}" >> $GITHUB_ENV
29+
rm -rf $IDF_PATH/${{ env.COMP_DIR }}
30+
cp -r . $IDF_PATH/${{ env.COMP_DIR }}
31+
cd $IDF_PATH/${{ env.COMP_DIR }}/host_test
32+
idf.py build
33+
./build/host_mqtt_client_test.elf -r junit -o junit.xml
34+
- name: Build with Coverage Enabled
35+
shell: bash
36+
run: |
37+
. ${IDF_PATH}/export.sh
38+
cd $IDF_PATH/${{ env.COMP_DIR }}/host_test
39+
cat sdkconfig.ci.coverage >> sdkconfig.defaults
40+
rm -rf build sdkconfig
41+
idf.py build
42+
./build/host_mqtt_client_test.elf
43+
- name: Run gcovr
44+
shell: bash
45+
run: |
46+
python -m pip install gcovr --break-system-packages
47+
cd $IDF_PATH/${{ env.COMP_DIR }}
48+
gcov -b host_test/main/mqtt_client.c. -o `find . -name "mqtt_client*gcda" -exec dirname {} \;`
49+
gcovr --gcov-ignore-parse-errors -g -k -r . --html index.html -x esp_mqtt_coverage.xml
50+
mkdir docs_gcovr
51+
mv index.html docs_gcovr
52+
touch docs_gcovr/.nojekyll
53+
cp -r docs_gcovr esp_mqtt_coverage.xml $GITHUB_WORKSPACE
54+
- name: Code Coverage Summary Report
55+
uses: irongut/[email protected]
56+
with:
57+
filename: ${{ env.GITHUB_WORKSPACE }}/**/esp_mqtt_coverage.xml
58+
badge: true
59+
fail_below_min: false
60+
format: markdown
61+
hide_branch_rate: false
62+
hide_complexity: false
63+
indicators: true
64+
output: both
65+
thresholds: "60 80"
66+
- name: Write to Job Summary
67+
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
68+
- name: Upload artifacts
69+
uses: actions/upload-artifact@v4
70+
if: always()
71+
with:
72+
name: docs_gcovr
73+
path: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr
74+
if-no-files-found: error
75+
- name: Deploy coverage summary
76+
if: github.ref == 'refs/heads/master'
77+
uses: JamesIves/[email protected]
78+
with:
79+
branch: gh-pages
80+
folder: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr

0 commit comments

Comments
 (0)