chore(deps): update actions/upload-artifact action to v4 (#44) #136
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, Test, Release | |
on: | |
push: | |
paths-ignore: | |
- "**.js" | |
- "**.json" | |
- .github/workflows/publish-firmware-bundles.yml | |
workflow_dispatch: | |
permissions: | |
contents: write | |
issues: write | |
actions: write | |
packages: write | |
env: | |
BUILD_IMAGE_NAME: hello-nrfcloud-firmware | |
TWISTER_IMAGE_NAME: hello-nrfcloud-firmware-twister | |
jobs: | |
# generate date string to be embedded in builds | |
date-string: | |
name: Generate date string | |
runs-on: ubuntu-22.04 | |
outputs: | |
dateAsString: ${{ steps.dateAsString.outputs.dateAsString }} | |
steps: | |
- run: echo "$(date +'%Y%m%d%H%M%S')" | |
- name: Generate date string | |
id: dateAsString | |
run: echo "dateAsString=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
# generate version string to be embedded in builds | |
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 }} | |
docker: | |
name: Prepare docker image | |
runs-on: ubuntu-22.04 | |
outputs: | |
docker_image: ${{ steps.docker-image-tag.outputs.docker_image }} | |
steps: | |
- name: Authenticate against Container Registry | |
run: | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ | |
--password-stdin | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Only rebuild the docker image of the contents of the files change that | |
# determine what goes into the Docker image | |
- name: Determine Docker image name and tag | |
id: docker-image-tag | |
run: | | |
IMAGE_VERSION=`cat Dockerfile west.yml | sha256sum | awk '{ print $1 }' | tr -d '\n'` | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$BUILD_IMAGE_NAME | |
echo "docker_image=${IMAGE_ID}:${IMAGE_VERSION}" >> $GITHUB_OUTPUT | |
echo "IMAGE_ID=${IMAGE_ID}" >> $GITHUB_ENV | |
echo "IMAGE_VERSION=${IMAGE_VERSION}" >> $GITHUB_ENV | |
- name: Check if Docker image exists | |
id: check-docker-image | |
continue-on-error: true | |
env: | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
run: docker manifest inspect $IMAGE_ID:$IMAGE_VERSION | |
- name: Build Docker | |
if: steps.check-docker-image.outcome == 'failure' | |
run: docker buildx build -t $BUILD_IMAGE_NAME . | |
- name: Publish Docker image | |
if: steps.check-docker-image.outcome == 'failure' | |
run: | | |
docker tag $BUILD_IMAGE_NAME $IMAGE_ID:$IMAGE_VERSION | |
docker push $IMAGE_ID:$IMAGE_VERSION | |
docker-twister: | |
name: Prepare docker image for Twister | |
runs-on: ubuntu-22.04 | |
outputs: | |
docker_image: ${{ steps.docker-image-tag.outputs.docker_image }} | |
steps: | |
- name: Authenticate against Container Registry | |
run: | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ | |
--password-stdin | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Only rebuild the docker image of the contents of the files change that | |
# determine what goes into the Docker image | |
- name: Determine Docker image name and tag | |
id: docker-image-tag | |
run: | | |
TWISTER_IMAGE_VERSION=`cat Dockerfile.twister | sha256sum | awk '{ print $1 }' | tr -d '\n'` | |
TWISTER_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$TWISTER_IMAGE_NAME | |
echo "docker_image=${TWISTER_IMAGE_ID}:${TWISTER_IMAGE_VERSION}" >> $GITHUB_OUTPUT | |
echo "TWISTER_IMAGE_ID=${TWISTER_IMAGE_ID}" >> $GITHUB_ENV | |
echo "TWISTER_IMAGE_VERSION=${TWISTER_IMAGE_VERSION}" >> $GITHUB_ENV | |
- name: Check if Docker image exists | |
id: check-docker-image | |
continue-on-error: true | |
env: | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
run: docker manifest inspect $TWISTER_IMAGE_ID:$TWISTER_IMAGE_VERSION | |
- name: Build Docker | |
if: steps.check-docker-image.outcome == 'failure' | |
run: docker buildx build -t $TWISTER_IMAGE_NAME -f Dockerfile.twister . | |
- name: Publish Docker image | |
if: steps.check-docker-image.outcome == 'failure' | |
run: | | |
docker tag $TWISTER_IMAGE_NAME $TWISTER_IMAGE_ID:$TWISTER_IMAGE_VERSION | |
docker push $TWISTER_IMAGE_ID:$TWISTER_IMAGE_VERSION | |
test: | |
name: Run Twister tests | |
runs-on: ubuntu-22.04 | |
needs: [docker-twister] | |
container: | |
image: ${{ needs.docker-twister.outputs.docker_image }} | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
env: | |
CMAKE_PREFIX_PATH: /opt/toolchains | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: project | |
- name: Twister Tests | |
working-directory: project/asset_tracker_v2 | |
run: | | |
/zephyr/scripts/twister -G --testsuite-root ./tests/ | |
- name: Archive test result | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: twister | |
path: project/asset_tracker_v2/twister-out | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
container: | |
image: ${{ needs.docker.outputs.docker_image }} | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
needs: [release-version, date-string, docker] | |
env: | |
AWS_BROKER_HOSTNAME: iot.thingy.rocks | |
environment: production | |
# list variants to build | |
strategy: | |
matrix: | |
configuration: | |
- thingy91 | |
- thingy91.dbg | |
- thingy91.lp.mmflt | |
- thingy91.sol | |
- thingy91.sol.dbg | |
- thingy91.sol.lp.mmflt | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: project | |
- name: Show nrfutil details | |
run: | | |
nrfutil --version | |
nrfutil list | |
nrfutil toolchain-manager list | |
# configure build { | |
- name: Build for Thingy:91 | |
if: contains(matrix.configuration, 'thingy91') | |
run: echo 'BOARD=thingy91_nrf9160_ns' >> $GITHUB_ENV | |
- name: Build for nRF9160-DK | |
if: contains(matrix.configuration, 'nrf9160dk') | |
run: echo 'BOARD=nrf9160dk_nrf9160_ns' >> $GITHUB_ENV | |
- name: Add KConfig options unconditionally | |
working-directory: project/asset_tracker_v2 | |
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 | |
echo "CONFIG_CLOUD_CLIENT_ID_IMEI_PREFIX=\"oob-\"" >> firmware.conf | |
echo "CONFIG_NRF_CLOUD_SEC_TAG=42" >> firmware.conf | |
echo "CONFIG_DATA_DEVICE_MODE_ACTIVE=y" >> firmware.conf | |
echo "CONFIG_DATA_ACTIVE_TIMEOUT_SECONDS=60" >> firmware.conf | |
- name: Configure Memfault | |
if: contains(matrix.configuration, 'mmflt') | |
working-directory: project/asset_tracker_v2 | |
run: | | |
echo "CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT=y" >> overlay-memfault.conf | |
echo "CONFIG_DEBUG_MODULE_MEMFAULT_HEARTBEAT_INTERVAL_SEC=3600" >> overlay-memfault.conf | |
echo "CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y" >> overlay-memfault.conf | |
echo "CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.APP_VERSION }}\"" >> overlay-memfault.conf | |
echo "CONFIG_MEMFAULT_NCS_FW_TYPE=\"atv2\"" >> overlay-memfault.conf | |
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ vars.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault.conf | |
echo MEMFAULT_OVERLAY=overlay-memfault.conf >> $GITHUB_ENV | |
- name: Configure Low-Power | |
working-directory: project/asset_tracker_v2 | |
if: contains(matrix.configuration, 'lp') | |
run: echo CONFIG_OVERLAY=overlay-low-power.conf >> $GITHUB_ENV | |
- name: Configure Debug | |
working-directory: project/asset_tracker_v2 | |
if: contains(matrix.configuration, 'dbg') | |
run: | | |
echo CONFIG_OVERLAY=overlay-debug.conf >> $GITHUB_ENV | |
echo "CONFIG_NRF_MODEM_LIB_TRACE=y" >> firmware.conf | |
- name: Configure Solar Shield | |
working-directory: project/asset_tracker_v2 | |
if: contains(matrix.configuration, 'sol') | |
run: | | |
echo EXTRA_ARGS="-DSHIELD=powerfoyle" >> $GITHUB_ENV | |
- name: enable BSEC library to support Bosch BME680 Environmental sensor | |
if: contains(matrix.configuration, 'thingy91') | |
working-directory: /nrf/ext | |
run: | | |
wget -q ${{ secrets.BSEC_ARCHIVE_URL }} -O bsec.zip | |
unzip -q bsec.zip | |
ls BSEC_1.4.8.0_Generic_Release_updated_v3 | |
echo BSEC_OVERLAY=overlay-bsec.conf >> $GITHUB_ENV | |
# } | |
- run: | | |
pwd | |
ls -la | |
printenv | |
- name: Build firmware | |
working-directory: project/asset_tracker_v2 | |
run: | | |
nrfutil toolchain-manager launch /bin/bash -- -c '\ | |
west build -b ${{ env.BOARD }} \ | |
-p always -- \ | |
${{ env.EXTRA_ARGS }} \ | |
-DOVERLAY_CONFIG="${{ env.CONFIG_OVERLAY }};${{ env.MEMFAULT_OVERLAY }};${{ env.BSEC_OVERLAY }};firmware.conf" \ | |
' | |
- name: Upload symbols file to Memfault | |
continue-on-error: true | |
if: | |
contains(matrix.configuration, 'mmflt') && github.ref == | |
'refs/heads/saga' && (github.event_name == 'push' || github.event_name | |
== 'workflow_dispatch' || github.event_name == 'repository_dispatch') | |
working-directory: project/asset_tracker_v2 | |
run: | | |
memfault \ | |
--org-token ${{ secrets.MEMFAULT_ORGANIZATION_TOKEN }} \ | |
--org ${{ vars.MEMFAULT_ORGANIZATION_SLUG }} \ | |
--project ${{ vars.MEMFAULT_PROJECT_SLUG }} \ | |
upload-mcu-symbols \ | |
--software-type atv2 \ | |
--software-version ${{ env.APP_VERSION }} \ | |
build/zephyr/zephyr.elf | |
- name: Archive firmware | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: | |
${{ matrix.configuration }}-${{ | |
needs.date-string.outputs.dateAsString }}-${{ github.sha }} | |
path: | | |
project/asset_tracker_v2/build/zephyr/zephyr.elf | |
project/asset_tracker_v2/build/zephyr/merged.hex | |
project/asset_tracker_v2/build/zephyr/app_update.bin | |
project/asset_tracker_v2/build/zephyr/app_signed.hex | |
project/asset_tracker_v2/build/zephyr/zephyr.dts | |
project/asset_tracker_v2/build/zephyr/.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, test, release-version] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
- uses: cycjimmy/semantic-release-action@v4 | |
id: semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Trigger deployment workflow | |
if: steps.semantic-release.outputs.new_release_published == 'true' | |
run: | |
gh workflow run publish-firmware-bundles.yml --raw-field version=v${{ | |
needs.release-version.outputs.nextRelease }} |