This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
chore(deps): update dependency @nordicsemiconductor/asset-tracker-clo… #758
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: Build and Release | |
on: | |
push: | |
paths: | |
- "**.c" | |
- "**.h" | |
- "**.feature" | |
- "Kconfig" | |
- ".github/workflows/build-and-release.yaml" | |
- "west.yml" | |
- "*.conf" | |
- "!package.json" | |
- "!package-lock.json" | |
repository_dispatch: | |
types: | |
- source-update | |
workflow_dispatch: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} | |
STACK_NAME: ${{ secrets.STACK_NAME }} | |
CI: 1 | |
FORCE_COLOR: 3 | |
jobs: | |
# This generates a unique build id (which is also different for re-runs) to | |
# be used in the artifact names to be able to distinguish them when | |
# downloading the artifact files. | |
build-id: | |
name: Generate build ID | |
runs-on: ubuntu-22.04 | |
outputs: | |
id: ${{ steps.id.outputs.id }} | |
steps: | |
- name: Generate build ID | |
id: id | |
run: | | |
ID=`uuidgen` | |
echo "id=${ID}" >> $GITHUB_OUTPUT | |
# This generates a string containing the current date which is used in | |
# in artifact names to simpify locating and distinguishing them once they have | |
# been downloaded | |
date-string: | |
name: Generate string containing the current date | |
runs-on: ubuntu-22.04 | |
outputs: | |
dateAsString: ${{ steps.dateAsString.outputs.dateAsString }} | |
steps: | |
- name: Generate date string | |
id: dateAsString | |
run: echo "dateAsString=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
broker: | |
name: Determine broker hostname | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Determine the AWS IoT broker hostname | |
id: broker-hostname | |
run: | | |
BROKER_HOSTNAME=`AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION=${{ env.AWS_REGION }} aws iot describe-endpoint --endpoint-type iot:Data-ATS | jq '.endpointAddress' -r | tr -d '\n'` | |
echo ${BROKER_HOSTNAME} | |
if [ -z "$BROKER_HOSTNAME" ]; then echo "Failed to discover broker hostname."; exit 1; fi | |
echo ${BROKER_HOSTNAME} > broker.conf | |
- uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: broker | |
path: broker.conf | |
release-version: | |
name: Determine next release version | |
runs-on: ubuntu-22.04 | |
outputs: | |
nextRelease: ${{ steps.version.outputs.nextRelease }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Determine next release version | |
uses: nordicsemiconductor/cloud-get-next-version-action@saga | |
id: version | |
with: | |
branch: saga | |
defaultVersion: "0.0.0-development-${{ github.sha }}" | |
- run: echo ${{ steps.version.outputs.nextRelease }} | |
build: | |
runs-on: ubuntu-22.04 | |
needs: [broker, release-version, date-string] | |
strategy: | |
matrix: | |
board: [thingy91_nrf9160_ns, nrf9160dk_nrf9160_ns] | |
loglevel: [debug, debugWithMemfault, nodebug] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: firmware | |
- name: Configure Version | |
working-directory: firmware | |
run: | | |
APP_VERSION=${{ needs.release-version.outputs.nextRelease }}-${{ matrix.board }}-${{ matrix.loglevel }} | |
echo "CONFIG_ASSET_TRACKER_V2_APP_VERSION=\"${APP_VERSION}\"" >> firmware.conf | |
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v3 | |
with: | |
name: broker | |
- name: Configure the AWS IoT broker hostname | |
working-directory: firmware | |
run: | | |
BROKER_HOSTNAME=`cat ../broker.conf` | |
echo "CONFIG_AWS_IOT_BROKER_HOST_NAME=\"${BROKER_HOSTNAME}\"" >> firmware.conf | |
- run: cat firmware.conf | |
working-directory: firmware | |
- name: Build with debug enabled | |
working-directory: firmware | |
if: matrix.loglevel == 'debug' | |
run: | | |
docker run --rm -v ${PWD}:/workdir/project nordicplayground/nrfconnect-sdk:main west build -p always -b ${{ matrix.board }} --build-dir /workdir/project/build -- -DOVERLAY_CONFIG="overlay-aws.conf;overlay-pgps.conf;overlay-debug.conf;asset-tracker-cloud-firmware-aws.conf;firmware.conf" -DEXTRA_CFLAGS="-Werror" | |
- name: Build with debug and Memfault enabled | |
if: matrix.loglevel == 'debugWithMemfault' | |
working-directory: firmware | |
run: | | |
echo "CONFIG_NRF_MODEM_LIB_TRACE_ENABLED=y" >> firmware.conf | |
echo "CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT=y" >> firmware.conf | |
echo "CONFIG_DEBUG_MODULE_MEMFAULT_HEARTBEAT_INTERVAL_SEC=3600" >> firmware.conf | |
echo "CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y" >> firmware.conf | |
echo "CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.APP_VERSION }}\"" >> firmware.conf | |
echo "CONFIG_MEMFAULT_NCS_FW_TYPE=\"asset_tracker_v2\"" >> firmware.conf | |
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> firmware.conf | |
docker run --rm -v ${PWD}:/workdir/project nordicplayground/nrfconnect-sdk:main west build -p always -b ${{ matrix.board }} --build-dir /workdir/project/build -- -DOVERLAY_CONFIG="overlay-aws.conf;overlay-pgps.conf;overlay-debug.conf;overlay-memfault.conf;asset-tracker-cloud-firmware-aws.conf;firmware.conf" -DEXTRA_CFLAGS="-Werror" | |
- name: Upload symbols file to Memfault | |
if: matrix.loglevel == 'debugWithMemfault' | |
working-directory: firmware | |
run: | | |
pip3 install memfault-cli | |
memfault \ | |
--org-token ${{ secrets.MEMFAULT_ORGANIZATION_TOKEN }} \ | |
--org ${{ secrets.MEMFAULT_ORGANIZATION_SLUG }} \ | |
--project ${{ secrets.MEMFAULT_PROJECT_SLUG }} \ | |
upload-mcu-symbols \ | |
--software-type asset_tracker_v2 \ | |
--software-version ${{ env.APP_VERSION }} \ | |
build/zephyr/zephyr.elf | |
- name: Build with debug disabled | |
working-directory: firmware | |
if: matrix.loglevel == 'nodebug' | |
run: | | |
docker run --rm -v ${PWD}:/workdir/project nordicplayground/nrfconnect-sdk:main west build -p always -b ${{ matrix.board }} --build-dir /workdir/project/build -- -DOVERLAY_CONFIG="overlay-aws.conf;overlay-pgps.conf;asset-tracker-cloud-firmware-aws.conf;firmware.conf" -DEXTRA_CFLAGS="-Werror" | |
- name: Copy firmware | |
working-directory: firmware | |
run: | | |
cp build/zephyr/merged.hex ../ | |
cp build/zephyr/app_signed.hex ../ | |
cp build/zephyr/app_update.bin ../ | |
cp build/zephyr/zephyr.elf ../ | |
cp firmware.conf ../ | |
- uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: | |
${{ matrix.board }}-${{ matrix.loglevel }}-${{ | |
needs.date-string.outputs.dateAsString }}-${{ github.sha }} | |
path: | | |
merged.hex | |
app_signed.hex | |
app_update.bin | |
firmware.conf | |
zephyr.elf | |
e2e-credentials: | |
name: Create device credentials for end-to-end test | |
runs-on: ubuntu-22.04 | |
if: ${{ !contains(toJSON(github.event.commits.*.message), '[skip-e2e]') }} | |
needs: [build-id] | |
strategy: | |
matrix: | |
board: [nrf9160dk_nrf9160_ns] | |
network: [ltem] | |
steps: | |
- name: Generate device ID | |
run: | | |
DEVICE_ID=`uuidgen` | |
echo "DEVICE_ID=${DEVICE_ID}" >> $GITHUB_ENV | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- uses: actions/checkout@v4 | |
- name: Clone nRF Asset Tracker for AWS | |
run: | | |
git clone `cat package.json | jq -r '.cloud.repository'` cloud | |
- name: Install dependencies | |
run: | | |
cd cloud | |
npm ci | |
- name: Compile TypeScript | |
run: | | |
cd cloud | |
npx tsc | |
- name: Keep CA certificates around | |
uses: actions/cache@v3 | |
with: | |
path: cloud/certificates | |
key: certificates | |
- name: Check if CA certificate exists | |
run: | | |
ls ./cloud/certificates/*/currentCA 1> /dev/null 2>&1 | |
echo "SKIP_CERT_GENERATION=1" >> $GITHUB_ENV | |
continue-on-error: true | |
- name: Create CA certificate | |
if: env.SKIP_CERT_GENERATION != '1' | |
run: | | |
cd cloud | |
./cli.sh create-ca --tags ci=firmware,repository=${{ github.repository }} | |
- name: Create device credentials | |
run: | | |
cd cloud | |
./cli.sh create-simulator-cert -d ${{ env.DEVICE_ID }} | |
- name: Copy credentials | |
run: | | |
mkdir e2e-credentials | |
cp cloud/certificates/*/device-${{ env.DEVICE_ID }}* e2e-credentials | |
- uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: | |
e2e-credentials-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
path: | | |
e2e-credentials/* | |
- name: Remove device certificates | |
run: rm -vf ./cloud/certificates/*/device* | |
e2e-firmware: | |
name: Build firmware for end-to-end test | |
runs-on: ubuntu-22.04 | |
if: ${{ !contains(toJSON(github.event.commits.*.message), '[skip-e2e]') }} | |
needs: [e2e-credentials, broker, build-id] | |
strategy: | |
matrix: | |
board: [nrf9160dk_nrf9160_ns] | |
network: [ltem] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: firmware | |
- uses: actions/download-artifact@v3 | |
with: | |
name: | |
e2e-credentials-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
path: | |
e2e-credentials-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
- name: Set device id | |
run: | | |
echo "DEVICE_ID=`find e2e-credentials-${{ matrix.board }}-${{ | |
needs.build-id.outputs.id }} -name \*.json | head -n 1 | xargs cat | jq -r '.clientId'`" >> $GITHUB_ENV | |
- name: Configure Version | |
working-directory: firmware | |
env: | |
APP_VERSION: | |
${{ github.sha }}-${{ matrix.board }}-${{ env.DEVICE_ID }} | |
run: | | |
echo "CONFIG_ASSET_TRACKER_V2_APP_VERSION=\"${{ env.APP_VERSION }}-original\"" >> firmware.conf | |
- uses: actions/download-artifact@v3 | |
with: | |
name: broker | |
- name: Configure the AWS IoT broker hostname | |
working-directory: firmware | |
run: | | |
BROKER_HOSTNAME=`cat ../broker.conf` | |
echo "CONFIG_AWS_IOT_BROKER_HOST_NAME=\"${BROKER_HOSTNAME}\"" >> firmware.conf | |
- name: Set MQTT client ID to test device | |
working-directory: firmware | |
run: | | |
echo "CONFIG_CLOUD_CLIENT_ID_USE_CUSTOM=y" >> firmware.conf | |
echo "CONFIG_AWS_IOT_CLIENT_ID_MAX_LEN=40" >> firmware.conf | |
echo "CONFIG_CLOUD_CLIENT_ID=\"${{ env.DEVICE_ID }}\"" >> firmware.conf | |
- run: cat firmware.conf | |
working-directory: firmware | |
- name: Build | |
working-directory: firmware | |
run: | | |
docker run --rm -v ${PWD}:/workdir/project nordicplayground/nrfconnect-sdk:main west build -p always -b ${{ matrix.board }} --build-dir /workdir/project/build -- -DOVERLAY_CONFIG="overlay-aws.conf;overlay-pgps.conf;overlay-debug.conf;asset-tracker-cloud-firmware-aws.conf;firmware.conf;e2e.conf" -DEXTRA_CFLAGS="-Werror" | |
cp build/zephyr/merged.hex ../firmware.hex | |
cp build/zephyr/app_update.bin ../firmware.bin | |
cp firmware.conf ../firmware.conf | |
- name: Build with changed version for FOTA test | |
working-directory: firmware | |
env: | |
APP_VERSION: | |
${{ github.sha }}-${{ matrix.board }}-${{ env.DEVICE_ID }} | |
run: | | |
echo "CONFIG_ASSET_TRACKER_V2_APP_VERSION=\"${{ env.APP_VERSION }}-upgraded\"" >> firmware.conf | |
docker run --rm -v ${PWD}:/workdir/project nordicplayground/nrfconnect-sdk:main west build -p always -b ${{ matrix.board }} --build-dir /workdir/project/build -- -DOVERLAY_CONFIG="overlay-aws.conf;overlay-pgps.conf;overlay-debug.conf;asset-tracker-cloud-firmware-aws.conf;firmware.conf;e2e.conf" -DEXTRA_CFLAGS="-Werror" | |
cp build/zephyr/app_update.bin ../fota-upgrade.bin | |
cp firmware.conf ../fota-upgrade.conf | |
- uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: | |
e2e-firmware-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
path: | | |
firmware.hex | |
firmware.bin | |
firmware.conf | |
fota-upgrade.hex | |
fota-upgrade.bin | |
fota-upgrade.conf | |
e2e-device: | |
name: Run the firmware for the end-to-end tests on a real device | |
runs-on: [self-hosted, firmware-ci] | |
if: ${{ !contains(toJSON(github.event.commits.*.message), '[skip-e2e]') }} | |
env: | |
# Disables TLS certificate verification on Node.js which might be not | |
# possible if behind a (corporate) firewall | |
NODE_TLS_REJECT_UNAUTHORIZED: 0 | |
outputs: | |
connected: ${{ steps.device.outputs.connected }} | |
needs: | |
- e2e-firmware | |
- e2e-credentials | |
- broker | |
- build-id | |
# While not needed, don't run expensive e2e tests if "build" steps fails | |
- build | |
strategy: | |
matrix: | |
board: [nrf9160dk_nrf9160_ns] | |
network: [ltem] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: | |
e2e-firmware-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: | |
e2e-credentials-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
path: | |
e2e-credentials-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
- name: Set device id | |
run: | | |
echo "DEVICE_ID=`find e2e-credentials-${{ matrix.board }}-${{ | |
needs.build-id.outputs.id }} -name \*.json | head -n 1 | xargs cat | jq -r '.clientId'`" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v3 | |
with: | |
name: broker | |
- name: Configure the AWS IoT broker hostname | |
run: | | |
BROKER_HOSTNAME=`cat broker.conf` | |
echo "BROKER_HOSTNAME=${BROKER_HOSTNAME}" >> $GITHUB_ENV | |
- name: Run firmware on real device | |
uses: NordicSemiconductor/cloud-aws-firmware-ci-device-action@saga | |
id: device | |
env: | |
APP_VERSION: | |
${{ github.sha }}-${{ matrix.board }}-${{ env.DEVICE_ID }} | |
with: | |
device id: ${{ env.DEVICE_ID }} | |
app version: ${{ env.APP_VERSION }} | |
aws access key id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws secret access key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws region: ${{ secrets.AWS_REGION }} | |
broker hostname: ${{ env.BROKER_HOSTNAME }} | |
stack name: ${{ secrets.STACK_NAME }} | |
hex file: firmware.hex | |
fota file: fota-upgrade.bin | |
abort on: | | |
aws_fota: Error (-7) when trying to start firmware download | |
aws_iot_integration: aws_iot_hub_init, error | |
end on: | | |
CLOUD_WRAP_EVT_PGPS_DATA_RECEIVED | |
aws_iot_integration: cloud_wrap_init: Version: ${{ env.APP_VERSION }}-upgraded | |
"appV" | |
"${{ env.APP_VERSION }}-upgraded" | |
cloud_module: cloud_wrap_event_handler: CLOUD_WRAP_EVT_DATA_ACK | |
CLOUD_WRAP_EVT_AGPS_DATA_RECEIVED | |
timeout in minutes: 20 | |
sec tag: 42 | |
certificate location: | |
./e2e-credentials-${{ matrix.board }}-${{ needs.build-id.outputs.id | |
}} | |
target: ${{ matrix.board }} | |
ci runner package: "@nordicsemiconductor/firmware-ci-runner-aws@>=7.0.359" | |
- uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: e2e-run-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
path: | | |
device.log | |
flash.log | |
job.json | |
e2e-credentials-${{ matrix.board }}-${{ | |
needs.build-id.outputs.id }} | |
firmware.hex | |
fota-upgrade.bin | |
e2e-tests: | |
name: Run the end-to-end test | |
runs-on: ubuntu-22.04 | |
if: | |
${{ needs.e2e-device.outputs.connected == 'true' && | |
!contains(toJSON(github.event.commits.*.message), '[skip-e2e]') }} | |
needs: | |
- e2e-firmware | |
- e2e-device | |
- broker | |
- build-id | |
# Wait for build step here, otherwise entire workflow will not pass, so running the expensive e2e test is pointless | |
- build | |
strategy: | |
matrix: | |
board: [nrf9160dk_nrf9160_ns] | |
network: [ltem] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: | |
e2e-credentials-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
path: | |
e2e-credentials-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: e2e-run-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
path: e2e-run-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
- name: Set device id | |
run: | | |
echo "DEVICE_ID=`find e2e-credentials-${{ matrix.board }}-${{ | |
needs.build-id.outputs.id }} -name \*.json | head -n 1 | xargs cat | jq -r '.clientId'`" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v3 | |
with: | |
name: broker | |
- name: Configure the AWS IoT broker hostname | |
run: | | |
BROKER_HOSTNAME=`cat broker.conf` | |
echo "BROKER_HOSTNAME=${BROKER_HOSTNAME}" >> $GITHUB_ENV | |
- name: Run feature tests | |
env: | |
APP_VERSION: | |
${{ github.sha }}-${{ matrix.board }}-${{ env.DEVICE_ID }} | |
uses: NordicSemiconductor/cloud-aws-firmware-ci-feature-runner-action@saga | |
with: | |
device id: ${{ env.DEVICE_ID }} | |
app version: ${{ env.APP_VERSION }} | |
aws access key id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws secret access key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws region: ${{ secrets.AWS_REGION }} | |
broker hostname: ${{ env.BROKER_HOSTNAME }} | |
stack name: ${{ secrets.STACK_NAME }} | |
feature dir: features | |
log dir: e2e-run-${{ matrix.board }}-${{ needs.build-id.outputs.id }} | |
target: ${{ matrix.board }} | |
- name: Remove test device | |
if: | |
${{ !contains(toJSON(github.event.commits.*.message), | |
'[skip-cleanup]') }} | |
continue-on-error: true | |
run: | | |
CERT_ARN=`aws iot list-thing-principals --thing-name ${{ env.DEVICE_ID }} | jq -r '.principals[0]'` | |
CERT_ID=`echo $CERT_ARN | cut -d'/' -f2` | |
aws iot detach-thing-principal --thing-name ${{ env.DEVICE_ID }} --principal $CERT_ARN | |
aws iot update-certificate --certificate-id $CERT_ID --new-status INACTIVE | |
aws iot delete-certificate --certificate-id $CERT_ID | |
aws iot delete-thing --thing-name ${{ env.DEVICE_ID }} | |
release: | |
name: Release | |
runs-on: ubuntu-22.04 | |
if: | |
github.ref == 'refs/heads/saga' && (github.event_name == 'push' || | |
github.event_name == 'workflow_dispatch' || github.event_name == | |
'repository_dispatch') | |
needs: [build, e2e-tests] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- run: npx semantic-release |