ci: Update github actions configuration

This commit is contained in:
Euripedes Rocha Filho
2026-04-16 15:04:58 +02:00
committed by Euripedes Rocha
parent 3c20fc05d3
commit 69a15c9b55
8 changed files with 80 additions and 357 deletions
@@ -1,36 +0,0 @@
name: Build app an run on target
on:
workflow_call:
inputs:
idf_version:
required: true
type: string
target:
required: true
type: string
app_name:
type: string
required: true
app_path:
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}}
-59
View File
@@ -1,59 +0,0 @@
name: Build app
on:
workflow_call:
inputs:
idf_version:
required: true
type: string
target:
required: true
type: string
app_name:
type: string
required: true
app_path:
type: string
required: true
upload_artifacts:
type: boolean
default: true
jobs:
build:
name: Build App
runs-on: ubuntu-20.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/ccache-action@v1.2
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
+79
View File
@@ -0,0 +1,79 @@
name: CI
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
pre-commit:
name: Pre-commit checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: pre-commit/action@v3.0.1
build:
name: Build (${{ matrix.idf_version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
idf_version:
- release-v6.0
- latest
container: espressif/idf:${{ matrix.idf_version }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
path: mqtt
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.idf_version }}-esp32c6
max-size: 500M
- name: Build apps
shell: bash
working-directory: mqtt
env:
IDF_CCACHE_ENABLE: "1"
run: |
. ${IDF_PATH}/export.sh
pip install -U 'idf-ci>=1,<2'
idf-ci build run --only-non-test-related -t esp32c6
host-tests:
name: Host tests
runs-on: ubuntu-latest
container: espressif/idf:latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
path: mqtt
- name: Build and run host tests
shell: bash
working-directory: mqtt
run: |
. ${IDF_PATH}/export.sh
pip install -U 'idf-ci>=1,<2'
idf-ci build run -t linux -p test/host
cd test/host
./build_linux_coverage/host_mqtt_client_test.elf -r junit -o junit.xml
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: host-test-results
path: mqtt/test/host/junit.xml
if-no-files-found: warn
-80
View File
@@ -1,80 +0,0 @@
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@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/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@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/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
folder: ${{ env.IDF_PATH }}/${{ env.COMP_DIR }}/docs_gcovr
+1 -2
View File
@@ -36,8 +36,7 @@ jobs:
- name: Upload component to the component registry (dry run)
uses: espressif/upload-components-ci-action@v2
with:
components: |
.
components: "mqtt: ."
namespace: "espressif"
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}
dry_run: true
-64
View File
@@ -1,64 +0,0 @@
name: Run on target
on:
workflow_call:
inputs:
idf_version:
required: true
type: string
target:
required: true
type: string
app_name:
type: string
required: true
app_path:
type: string
required: true
jobs:
target-test:
if: github.repository == 'espressif/esp-mqtt'
name: Run App on target
env:
IDF_PATH: idf
runs-on: [self-hosted, ESP32-ETHERNET-KIT]
steps:
- name: Select idf ref
id: detect_version
run: |
if echo "${{inputs.idf_version}}" | grep "latest" -> /dev/null ; then
echo ref="master" >> "$GITHUB_OUTPUT"
else
echo ref="`echo ${{matrix.idf_version}} | sed -s "s/-/\//"`" >> "$GITHUB_OUTPUT"
fi
- name: IP discovery
id: detect_ip
run: |
apt-get update && apt-get install -y iproute2
ip route
echo runner_ip ="`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'`" >> "$GITHUB_OUTPUT"
- name: Checkout IDF ${{inputs.idf_version}}
uses: actions/checkout@v4
with:
repository: espressif/esp-idf
path: ${{env.IDF_PATH}}
ref: ${{steps.detect_version.outputs.ref}}
- name: Install Python packages
env:
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/"
run: |
pip install --only-binary cryptography -r ${{env.IDF_PATH}}/tools/requirements/requirements.pytest.txt
- uses: actions/download-artifact@v4
with:
name: mqtt_bin_${{inputs.target}}_${{ inputs.idf_version }}_${{ inputs.app_name }}
path: build
- name: Run ${{inputs.app_name}} application on ${{inputs.target}}
run: |
python -m pytest ${{inputs.app_path}} --log-cli-level DEBUG --app-path . --junit-xml=./results_${{inputs.app_name}}_${{inputs.idf_version}}.xml --target=${{inputs.target}}
- uses: actions/upload-artifact@v4
if: always()
with:
name: results_${{inputs.app_name}}_${{inputs.idf_version}}.xml
path: build/*.xml
-51
View File
@@ -1,51 +0,0 @@
name: "Build example apps"
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, labeled]
jobs:
cpp-compatibility:
name: Cpp compatibility
strategy:
matrix:
idf_version: ["release-v5.0", "release-v5.1", "latest"]
target: ["esp32"]
example: [{name: cpp_compatibility, path: "build_test"}]
uses: "./.github/workflows/build-app.yml"
with:
idf_version: ${{matrix.idf_version}}
target: ${{matrix.target}}
app_name: ${{matrix.example.name}}
app_path: $IDF_PATH/tools/test_apps/protocols/mqtt/${{matrix.example.path}}
upload_artifacts: false
build-only-example:
name: Build Only Apps
strategy:
matrix:
idf_version: ["release-v5.0", "release-v5.1", "latest"]
target: ["esp32s2", "esp32c3", "esp32s3"]
example: [{name: ssl_psk, path: "mqtt/ssl_psk"}, {name: ssl_ds, path: "mqtt/ssl_ds"}]
uses: "./.github/workflows/build-app.yml"
with:
idf_version: ${{matrix.idf_version}}
target: ${{matrix.target}}
app_name: ${{matrix.example.name}}
app_path: $IDF_PATH/examples/protocols/${{matrix.example.path}}
build-examples:
name: Build and Run on target
strategy:
matrix:
idf_version: ["release-v5.0", "release-v5.1", "latest"]
target: ["esp32"]
example: [{name: tcp, path: "mqtt/tcp"}, {name: ssl, path: "mqtt/ssl"},{name: ssl_mutual_auth, path: "mqtt/ssl_mutual_auth"},{name: ws, path: "mqtt/ws"},{name: wss, path: "mqtt/wss"}]
uses: "./.github/workflows/build-and-target-test.yml"
with:
idf_version: ${{matrix.idf_version}}
target: ${{matrix.target}}
app_name: ${{matrix.example.name}}
app_path: $IDF_PATH/examples/protocols/${{matrix.example.path}}
-65
View File
@@ -1,65 +0,0 @@
sudo: false
language: bash
os:
- linux
addons:
apt:
packages:
- gperf
- python
- python-serial
before_install:
# Save path to the git respository
- PROJECT_PATH=$(pwd)
# Have to checkout a temp branch for later in tree reference
- git checkout -b temporary_ref_branch
- CI_COMMIT_SHA=$(git rev-parse HEAD)
# Test building with latest (stable == v3.3 for now) IDF
- LTS_IDF=release/v3.3
install:
# Install ESP32 toochain following steps as desribed
# in http://esp-idf.readthedocs.io/en/latest/linux-setup.html
#
# Get required packages - already done above, see addons: apt: packages:
# - sudo apt-get install git wget make libncurses-dev flex bison gperf python python-serial
# Prepare directory for the toolchain
- mkdir -p ~/esp
- cd ~/esp
# Download binary toolchain for the ESP32
- wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
- tar -xzf xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
# Get ESP-IDF from github (non-recursive to save time, later we update submodules for different versions)
- git clone https://github.com/espressif/esp-idf.git
# Set the path to ESP-IDF directory
- export IDF_PATH=~/esp/esp-idf
- python -m pip install --user -r $IDF_PATH/requirements.txt
# Setup build tool: xtensa-esp32-elf and idf.py
- export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin:$IDF_PATH/tools
script:
# Legacy build with IDF < 3.2
- cd $IDF_PATH
- git checkout v3.1 && git submodule update --init --recursive
- cd $PROJECT_PATH
- ./ci/modify_for_legacy_idf.sh ${LTS_IDF} || true
- cd $PROJECT_PATH/examples/tcp
- make defconfig
- make -j4
# Build with v3.3 (LTS) IDF
- cd $IDF_PATH
- git checkout ${LTS_IDF} && git submodule update --init --recursive
- cd $IDF_PATH/components/mqtt/esp-mqtt
- git remote add local $PROJECT_PATH/.git
- git fetch local
- git reset --hard $CI_COMMIT_SHA
- cd $IDF_PATH/examples/protocols/mqtt/tcp
- idf.py build
- cd $IDF_PATH/examples/protocols/mqtt/ssl
- idf.py build
- cd $IDF_PATH/examples/protocols/mqtt/ws
- idf.py build
- cd $IDF_PATH/examples/protocols/mqtt/wss
- idf.py build