Skip to content

ci: parameterize backend environment target for HIL tests #8

ci: parameterize backend environment target for HIL tests

ci: parameterize backend environment target for HIL tests #8

name: ESP-IDF Hardware-in-the-Loop Tests
on:
workflow_call:
inputs:
hil_board:
required: true
type: string
idf_target:
required: true
type: string
api-url:
required: true
type: string
api-key-id:
required: true
type: string
coap-gateway-url:
required: false
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository and Submodules
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: 'x64'
- name: Prep for build
id: build_prep
run: |
if [[ ! -z $INPUT_COAP_GATEWAY_URL ]];

Check failure on line 38 in .github/workflows/hil_test_esp-idf.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/hil_test_esp-idf.yml

Invalid workflow file

You have an error in your yaml syntax on line 38
then
echo CONFIG_GOLIOTH_COAP_HOST_URI="${{ inputs.coap-gateway-url }}" >> tests/hil/platform/esp-idf/sdkconfig.defaults
fi
- name: Build Test Firmware
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.1.1
target: ${{ inputs.idf_target }}
path: 'tests/hil/platform/esp-idf'
command: 'idf.py -DGOLIOTH_HIL_TEST=connection build'
- name: Save Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.hil_board }}-connection-esp-idf
path: tests/hil/platform/esp-idf/build/merged.bin
test:
needs: build
runs-on: [ is_active, "has_${{ inputs.hil_board }}" ]
container:
image: golioth/golioth-hil-base:af8e4f5
volumes:
- /dev:/dev
- /home/golioth/credentials:/opt/credentials
options: --privileged
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python dependencies
run: |
pip install pytest pytest-timeout
pip install tests/hil/scripts/pytest-hil
pip install git+https://github.com/golioth/python-golioth-tools@f6bd62aaf239409c57b2a0ccbb65c2df0833564f
- name: Power Cycle USB Hub
run: /opt/golioth-scripts/power-cycle-usb-hub.sh
- name: Download build
uses: actions/download-artifact@v4
with:
name: ${{ inputs.hil_board }}-connection-esp-idf
path: .
- name: Run test
shell: bash
env:
hil_board: ${{ inputs.hil_board }}
run: |
source /opt/credentials/runner_env.sh
PORT_VAR=CI_${hil_board^^}_PORT
pytest --rootdir . tests/hil/tests/connection \
--board esp-idf \
--port ${!PORT_VAR} \
--fw-image merged.bin \
--api-url ${{ inputs.api-url }} \
--api-key ${{ secrets[inputs.api-key-id] }} \
--wifi-ssid ${{ secrets[format('{0}_WIFI_SSID', runner.name)] }} \
--wifi-psk ${{ secrets[format('{0}_WIFI_PSK', runner.name)] }} \
--timeout=600