mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-29 18:28:24 +02:00
feat: Adds github action
- Initial support for github actions
This commit is contained in:
37
.github/workflows/build-and-target-test.yml
vendored
Normal file
37
.github/workflows/build-and-target-test.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
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
.github/workflows/build-app.yml
vendored
Normal file
59
.github/workflows/build-app.yml
vendored
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
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@v3
|
||||||
|
- 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@v3
|
||||||
|
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
|
64
.github/workflows/run-on-target.yml
vendored
Normal file
64
.github/workflows/run-on-target.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
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@v3
|
||||||
|
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@v3
|
||||||
|
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@v3
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: results_${{inputs.app_name}}_${{inputs.idf_version}}.xml
|
||||||
|
path: build/*.xml
|
66
.github/workflows/test-examples.yml
vendored
Normal file
66
.github/workflows/test-examples.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
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"}]
|
||||||
|
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-only-ds-example:
|
||||||
|
name: Build Only Apps
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
idf_version: ["release-v5.0", "release-v5.1", "latest"]
|
||||||
|
target: ["esp32s2", "esp32c3", "esp32s3"]
|
||||||
|
example: [{name: ssl_ds, path: "mqtt/ssl_ds"}, {name: ssl_psk, path: "mqtt/ssl_psk"}]
|
||||||
|
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}}
|
||||||
|
|
11
ci/build-test-rules.yml
Normal file
11
ci/build-test-rules.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||||
|
|
||||||
|
examples/protocols:
|
||||||
|
enable:
|
||||||
|
- if: IDF_TARGET in ["esp32"]
|
||||||
|
|
||||||
|
examples/protocols/mqtt/ssl_ds:
|
||||||
|
disable:
|
||||||
|
- if: SOC_DIG_SIGN_SUPPORTED != 1
|
||||||
|
temporary: false
|
||||||
|
reason: DS not present
|
2
ci/idf_build_apps.toml
Normal file
2
ci/idf_build_apps.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
build_dir = "$GITHUB_WORKSPACE/build_@t_@n"
|
||||||
|
config="sdkconfig.ci"
|
Reference in New Issue
Block a user