test a specific runner #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ESP-IDF Hardware-in-the-Loop Tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
hil_board: | ||
required: true | ||
type: string | ||
idf_target: | ||
required: true | ||
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: 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 -D GOLIOTH_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, "jons_orange_pi", 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/[email protected] | ||
- 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-key ${{ secrets.PROD_CI_PROJECT_API_KEY }} \ | ||
--wifi-ssid ${{ secrets[format('{0}_WIFI_SSID', runner.name)] }} \ | ||
--wifi-psk ${{ secrets[format('{0}_WIFI_PSK', runner.name)] }} \ | ||
--timeout=600 |