Skip to content

Add readme for nxp application hub #748

Add readme for nxp application hub

Add readme for nxp application hub #748

Workflow file for this run

#
# This file is part of Astarte.
#
# Copyright 2024 SECO Mind Srl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
name: E2E test
on:
push:
pull_request:
permissions:
contents: read
env:
ASTARTE_API_BASE: api.autotest.astarte-platform.org
ASTARTE_BROKER_BASE: broker.autotest.astarte-platform.org
ASTARTE_ACTION_CERT: /usr/local/share/ca-certificates/astarte-autotest.crt
jobs:
e2e-test:
runs-on: ubuntu-latest
steps:
# setup astarte
- name: Create Astarte Cluster
id: astarte
uses: astarte-platform/astarte-cluster-action@v1
with:
astarte_version: "1.1.1"
- name: Checkout
uses: actions/checkout@v4
with:
path: astarte-device-sdk-zephyr
- name: Install interface
working-directory: astarte-device-sdk-zephyr/
timeout-minutes: 3
run: |
./install_interfaces.sh ./e2e/interfaces
# setup zephyr application
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Set up Python dependencies
working-directory: astarte-device-sdk-zephyr/
run: pip install -r ./scripts/requirements.txt
- name: Set E2E manifest as defaults
working-directory: astarte-device-sdk-zephyr
run: mv west-e2e.yml west.yml
- name: Setup Zephyr project
uses: zephyrproject-rtos/action-zephyr-setup@v1
with:
app-path: astarte-device-sdk-zephyr
toolchains: x86_64-zephyr-elf
- name: Setup e2e application configuration values
working-directory: astarte-device-sdk-zephyr/e2e/
run: |
# TODO some devices should also get registered inside the e2e test using the provided api
DEVICE_ID=$(astartectl utils device-id generate-random)
CREDENTIAL_SECRET=$(astartectl pairing agent register --compact-output -- "$DEVICE_ID")
PAIRING_TOKEN=$(astartectl utils gen-jwt pairing)
TOKEN=$(astartectl utils gen-jwt appengine)
tee -a private.conf << END
# Values added by the github action
CONFIG_ASTARTE_DEVICE_SDK_HOSTNAME="$ASTARTE_API_BASE"
CONFIG_ASTARTE_DEVICE_SDK_REALM_NAME="test"
CONFIG_DEVICE_ID="$DEVICE_ID"
CONFIG_CREDENTIAL_SECRET="$CREDENTIAL_SECRET"
CONFIG_ASTARTE_DEVICE_SDK_PAIRING_JWT="$PAIRING_TOKEN"
CONFIG_E2E_APPENGINE_TOKEN="$TOKEN"
CONFIG_E2E_APPENGINE_URL="https://$ASTARTE_API_BASE/appengine"
# The dns used must be the one of the zeth interface
# Since we are injecting there the correct domain name resolutions
CONFIG_DNS_SERVER1="192.0.2.2:53"
# Write the certificate path so that cmake can successfully generate the .inc file
CONFIG_TLS_CERTIFICATE_PATH="$ASTARTE_ACTION_CERT"
END
- name: Start net-setup nat configuration
working-directory: tools/net-tools
run: |
# Add the correct dns resolution for zeth dnsmasq
tee -a dnsmasq_nat.conf << END
# do not read /etc/hosts
no-hosts
# do not bind to loopback address
except-interface=lo
# add resolution for action astarte dns
address=/$ASTARTE_API_BASE/$ASTARTE_BROKER_BASE/192.0.2.2
END
sudo ./net-setup.sh start --config nat.conf
- name: Build and run e2e test zephyr application
# We have to launch the command in the e2e directory the script `e2e/pytest/configuration.py` searches for build artifact in that specific direcotry
working-directory: astarte-device-sdk-zephyr/e2e
run: west twister --force-color --ninja -vvv --inline-logs -p native_sim -T .
- name: Stop net-setup nat configuration
working-directory: tools/net-tools
run: sudo ./net-setup.sh stop --config nat.conf