fix: button id #200
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: | |
branches: | |
- saga | |
paths: | |
- ".github/workflows/build-and-release.yaml" | |
- "!package.json" | |
- "!package-lock.json" | |
workflow_dispatch: | |
pull_request: | |
env: | |
BROKER_HOSTNAME: iot.thingy.rocks | |
MEMFAULT_PROJECT_KEY: m8U6bBczNz1N8Xi3M8kAKjAMKu9833YA | |
jobs: | |
# This generates a string containing the current date which is used in | |
# in artifact names to simplify 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 | |
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 | |
container: ghcr.io/zephyrproject-rtos/ci:v0.26.2 | |
env: | |
CMAKE_PREFIX_PATH: /opt/toolchains | |
needs: [release-version, date-string] | |
strategy: | |
matrix: | |
configuration: | |
- thingy91.low-power.memfault | |
# Double-tap to crash (dt2c) sends Button ID 42 and crashes on double tap of button | |
# to demonstrate the Memfault crash reporting feature. | |
- thingy91.low-power.memfault.dt2c | |
- thingy91.memfault.dt2c | |
- nrf9160dk.low-power.memfault | |
# Not enough flash for Memfault AND debug on Thingy:91, | |
# and it's not that useful anyway because debug builds | |
# will most likely be used connected to a PC | |
- thingy91.debug | |
- nrf9160dk.debug | |
# Thingy:91 with solar shield using AWS backend | |
- thingy91.low-power.solar.memfault | |
- thingy91.debug.solar | |
# NB-IoT only builds for Thingy:91 | |
- thingy91.low-power.memfault.nbiot | |
- thingy91.debug.nbiot | |
- thingy91.low-power.memfault.nbiot.legacy_pco | |
- thingy91.debug.nbiot.legacy_pco | |
# Thingy:91 X | |
- thingy91x.wifi | |
- thingy91x.low-power.wifi | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: firmware | |
submodules: recursive | |
- run: mv firmware/sdk-nrf firmware/nrf | |
- name: Initialize | |
working-directory: firmware/nrf | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ruby | |
pip3 install -r scripts/requirements-build.txt | |
west init -l . | |
west config manifest.group-filter +bsec | |
west update -o=--depth=1 -n | |
- name: Configure for Thingy:91 | |
if: | |
contains(matrix.configuration, 'thingy91') && | |
!contains(matrix.configuration, 'thingy91x') | |
run: echo 'board=thingy91_nrf9160_ns' >> $GITHUB_ENV | |
- name: Configure for Thingy:91 X | |
working-directory: firmware | |
if: contains(matrix.configuration, 'thingy91x') | |
run: | | |
echo 'board=thingy91x_nrf9151_ns' >> $GITHUB_ENV | |
echo "CONFIG_MQTT_HELPER_SEC_TAG=43" >> firmware.conf | |
- name: Configure for 9160DK | |
if: contains(matrix.configuration, 'nrf9160dk') | |
run: echo '[email protected]' >> $GITHUB_ENV | |
- name: Configure Version | |
working-directory: firmware | |
run: | | |
APP_VERSION=${{ needs.release-version.outputs.nextRelease }}+${{ matrix.configuration }} | |
echo "CONFIG_ASSET_TRACKER_V2_APP_VERSION=\"${APP_VERSION}\"" >> firmware.conf | |
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV | |
echo "CONFIG_DATA_DEVICE_MODE_ACTIVE=y" >> firmware.conf | |
echo "CONFIG_LTE_PSM_REQ_RAT=\"00000000\"" >> firmware.conf | |
- name: Configure the AWS IoT broker hostname | |
working-directory: firmware | |
run: | | |
echo "CONFIG_AWS_IOT_BROKER_HOST_NAME=\"${{ env.BROKER_HOSTNAME }}\"" >> firmware.conf | |
echo AWS_OVERLAY=overlay-aws.conf >> $GITHUB_ENV | |
- name: Configure Memfault | |
if: contains(matrix.configuration, 'memfault') | |
working-directory: firmware | |
run: | | |
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=\"thingy_world\"" >> firmware.conf | |
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ env.MEMFAULT_PROJECT_KEY }}\"" >> firmware.conf | |
echo "CONFIG_MEMFAULT_NCS_IMPLEMENT_METRICS_COLLECTION=n" >> firmware.conf | |
echo MEMFAULT_OVERLAY=overlay-memfault.conf >> $GITHUB_ENV | |
- name: Configure double-tap-to-crash | |
if: contains(matrix.configuration, 'dt2c') | |
working-directory: firmware | |
run: echo "CONFIG_UI_DOUBLE_TAP_TO_CRASH=y" >> firmware.conf | |
- name: Configure for NB-IoT only | |
working-directory: firmware | |
if: contains(matrix.configuration, 'nbiot') | |
run: echo "CONFIG_LTE_NETWORK_MODE_NBIOT_GPS=y" >> firmware.conf | |
- name: Build with legacy PCO | |
working-directory: firmware | |
if: contains(matrix.configuration, 'legacy_pco') | |
run: echo "CONFIG_PDN_LEGACY_PCO=y" >> firmware.conf | |
- name: Configure for LTE-m and NB-IoT | |
working-directory: firmware | |
if: ${{ !contains(matrix.configuration, 'nbiot') }} | |
run: echo "CONFIG_LTE_NETWORK_MODE_LTE_M_NBIOT_GPS=y" >> firmware.conf | |
- name: enable low-power build | |
if: contains(matrix.configuration, 'low-power') | |
run: echo CONFIG_OVERLAY=overlay-low-power.conf >> $GITHUB_ENV | |
- name: enable debug build | |
working-directory: firmware | |
if: contains(matrix.configuration, 'debug') | |
run: | | |
echo CONFIG_OVERLAY=overlay-debug.conf >> $GITHUB_ENV | |
- name: enable solar shield support | |
if: contains(matrix.configuration, 'solar') | |
run: | | |
echo SHIELD_OVERLAY=overlay-solar.conf >> $GITHUB_ENV | |
echo EXTRA_ARGS="-DDTC_OVERLAY_FILE=\"boards/${{ env.board }}.overlay;solar_shield.overlay\"" >> $GITHUB_ENV | |
- name: enable WiFi shield support | |
if: | |
contains(matrix.configuration, 'wifi') && | |
!contains(matrix.configuration, 'thingy91x') | |
run: | | |
echo EXTRA_ARGS="-DSHIELD=nrf7002ek -DEXTRA_CONF_FILE=overlay-nrf7002ek-wifi-scan-only.conf" >> $GITHUB_ENV | |
# WiFi cannot be combined with P-GPS support | |
- name: enable P-GPS | |
if: ${{ !contains(matrix.configuration, 'wifi') }} | |
run: echo PGPS_OVERLAY=overlay-pgps.conf >> $GITHUB_ENV | |
- name: enable BSEC library to support Bosch BME680 Environmental sensor | |
if: | |
contains(matrix.configuration, 'thingy91') || | |
contains(matrix.configuration, 'thingy91x') | |
working-directory: firmware | |
run: | | |
echo BSEC_OVERLAY=overlay-bsec.conf >> $GITHUB_ENV | |
- run: cat firmware.conf | |
working-directory: firmware | |
- name: copy overlays | |
run: | | |
cp firmware/firmware.conf firmware/nrf/applications/asset_tracker_v2 | |
cp firmware/overlay-bsec.conf firmware/nrf/applications/asset_tracker_v2 | |
- name: Build | |
working-directory: firmware/nrf/applications/asset_tracker_v2 | |
# -Werror=no-unused-variable below is needed for BSEC to compile | |
run: | | |
west build \ | |
-p always \ | |
-b ${{ env.board }} \ | |
-- \ | |
${{ env.EXTRA_ARGS }} \ | |
-DOVERLAY_CONFIG="${{ env.CONFIG_OVERLAY }};${{ env.PGPS_OVERLAY }};${{ env.AWS_OVERLAY }};${{ env.MEMFAULT_OVERLAY }};firmware.conf;${{ env.SHIELD_OVERLAY }};${{ env.BSEC_OVERLAY }}" \ | |
-DEXTRA_CFLAGS="-Werror -Wno-unused-variable" | |
- run: mv firmware/nrf/applications/asset_tracker_v2/build firmware/build | |
if: always() | |
- run: cat firmware/build/zephyr/.config | |
if: always() | |
- run: cat firmware/build/zephyr/zephyr.dts | |
if: always() | |
- name: Upload symbols file to Memfault | |
if: contains(matrix.configuration, 'memfault') | |
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 thingy_world \ | |
--software-version ${{ env.APP_VERSION }} \ | |
build/zephyr/zephyr.elf | |
- name: Copy firmware | |
run: | | |
cp firmware/build/zephyr/merged.hex ./ | |
cp firmware/build/zephyr/app_signed.hex ./ | |
cp firmware/build/zephyr/app_update.bin ./ | |
cp firmware/build/zephyr/zephyr.elf ./ | |
cp firmware/build/zephyr/.config ./ | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: | |
${{ matrix.configuration }}-${{ | |
needs.date-string.outputs.dateAsString }}-${{ github.sha }} | |
path: | | |
merged.hex | |
app_signed.hex | |
app_update.bin | |
firmware.conf | |
zephyr.elf | |
.config | |
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] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
cache: "npm" | |
- run: npx semantic-release |