The AWS implementation of the nRF Asset Tracker provides the resources for continuous testing of the firmware using real hardware.
Every commit to the firmware repository will trigger a CI run. The CI run results in the following actions:
- Creating a new device and credentials on AWS IoT.
- Building a firmware that has the device ID hardcoded for the MQTT client ID.
- Scheduling a run on a self-hosted GitHub Actions runner. See
aws-firmware_ci_runner_setup
. - Observing the firmware CI run until completion.
- Running assertions against the log result.
The Firmware CI runner is running on a PC connected to GitHub Actions, where it receives the jobs to execute. The Firmware CI runner performs the following actions:
- Programming the firmware and the optional credentials using the connected debugger to the connected nRF9160 DK or Thingy:91.
- Logging all output until one of the following conditions occur:
- A timeout is reached
- A stop condition is reached. (Wait for a log output to match a string.)
Note
These devices connect to the existing instance of the nRF Asset Tracker, so the firmware tests will not set up a new empty nRF Asset Tracker AWS environment for every test. The test runs against the production environment. This is to ensure that the firmware release will work with the existing solution. This approach is designed for trunk-based development.
Enable the Firmware CI resources of the nRF Asset Tracker that allow GitHub Actions to create test devices. Also enable the Firmware CI runner to connect before deploying the stack (see Getting Started <aws-getting-started>
).
node cli configure context stack firmware-ci 1
npx cdk deploy '*'
Print the AWS Key for the CI runner on GitHub Actions using the following command:
node cli firmware-ci -s
Region: "Region" Bucket name: "Bucket name" Access Key ID: "AWS Access Key ID" Secret Access Key: "AWS Secret Access Key"
Configure the following parameters as secrets on the firmware GitHub repository:
AWS_ACCESS_KEY_ID
(as printed above)AWS_SECRET_ACCESS_KEY
(as printed above)AWS_REGION
(as printed above)STACK_NAME
(the stack name of your production environment, usuallynrf-asset-tracker
)
To set up the Firmware CI runner, complete the following steps:
- Prepare an environment that fulfills the
necessary system requirements <system-requirements>
. - Download JLink for your platform, and ensure that
JLinkExe
is in your path. - Follow the instruction about self-hosted runners to set up a runner for your firmware repository. Make sure to use
firmware-ci
when prompted for the labels.
The Firmware CI starts to process all the scheduled jobs one after another.