Skip to content

Run Mosquitto service for tests #874

Run Mosquitto service for tests

Run Mosquitto service for tests #874

Workflow file for this run

name: CI Build
on:
push:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- environment: mk4-release
ud_gen: MK4
ud_debug: 0
target: esp32s2
- environment: mk5-release
ud_gen: MK5
ud_debug: 0
target: esp32s3
- environment: mk6-release
ud_gen: MK6
ud_debug: 0
target: esp32s3
- environment: mk7-release
ud_gen: MK7
ud_debug: 0
target: esp32s3
- environment: mk7-debug
ud_gen: MK7
ud_debug: 1
target: esp32s3
- environment: mk8-release
ud_gen: MK8
ud_debug: 0
target: esp32c6
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: "recursive"
- name: esp-idf build
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.4
target: ${{ matrix.target }}
command: idf.py build -DUD_GEN=${{ matrix.ud_gen }} -DUD_DEBUG=${{ matrix.ud_debug }}
- name: Rename firmware artifact
run: |
cp build/ugly-duckling.bin ugly-duckling-${{ matrix.environment }}.bin
- name: Create debug artifact
run: |
zip debug-${{ matrix.environment }}.zip \
build/project_description.json \
build/*.bin \
build/*.elf \
build/*.map \
build/config/sdkconfig.h
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ugly-duckling-${{ matrix.environment }}
path: |
ugly-duckling-${{ matrix.environment }}.bin
debug-${{ matrix.environment }}.zip
if-no-files-found: error
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: esp-idf build
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.4
target: esp32s3
command: idf.py build
path: test/unit-tests
- name: esp-idf test
run: |
docker run -v .:/project -w /project/test/unit-tests -e HOME=/tmp -e WOKWI_CLI_TOKEN=${{ secrets.WOKWI_CLI_TOKEN }} lptr/pytest-embedded:latest pytest --embedded-services idf,wokwi ./pytest_unit-tests.py
integ-test:
runs-on: ubuntu-latest
services:
mqtt:
image: eclipse-mosquitto:latest
ports:
- 1883:1883
options: >-
--health-cmd "timeout 5 mosquitto_pub -t test -m hello || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: esp-idf build
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.4
target: esp32s3
command: idf.py -DUD_GEN=MK6 -DUD_DEBUG=1 -DFSUPLOAD=1 -DWOKWI=1 build
path: test/integ-tests
- name: Run a Wokwi CI server
uses: wokwi/wokwi-ci-server-action@v1
- name: Test with Wokwi
uses: wokwi/wokwi-ci-action@v1
with:
token: ${{ secrets.WOKWI_CLI_TOKEN }}
path: test/integ-tests
timeout: 30000
expect_text: 'Device ready'
serial_log_file: 'log-hello-world.txt'
# - name: esp-idf test
# run: |
# docker run -v .:/project -w /project/test/integ-tests -e HOME=/tmp -e WOKWI_CLI_TOKEN=${{ secrets.WOKWI_CLI_TOKEN }} lptr/pytest-embedded:latest pytest --embedded-services idf,wokwi ./pytest_integ-tests.py
release:
needs:
- build
- unit-test
- integ-test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Release
uses: AButler/[email protected]
with:
files: ugly-duckling-*/*
repo-token: ${{ secrets.GITHUB_TOKEN }}