modules: power: Do not fail on -EALREADY #538
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build_debug: | |
| type: boolean | |
| required: false | |
| default: false | |
| workflow_call: | |
| inputs: | |
| memfault_fw_type: | |
| type: string | |
| required: false | |
| default: "asset-tracker-template-dev" | |
| build_debug: | |
| type: boolean | |
| required: false | |
| default: false | |
| nrfsdk_sha_update: | |
| type: boolean | |
| required: false | |
| default: false | |
| outputs: | |
| run_id: | |
| description: The run ID of the workflow to fetch artifacts from | |
| value: ${{ jobs.build.outputs.run_id }} | |
| version: | |
| description: The version of the firmware built on this run_id | |
| value: ${{ jobs.build.outputs.version }} | |
| pull_request: | |
| paths-ignore: | |
| - "tests/**" | |
| - "docs/**" | |
| - "scripts/**" | |
| - "README.md" | |
| - ".github/workflows/*.yml" | |
| - "!.github/workflows/build.yml" | |
| jobs: | |
| build: | |
| runs-on: build_self_hosted | |
| container: ghcr.io/zephyrproject-rtos/ci:v0.27.4 | |
| env: | |
| CMAKE_PREFIX_PATH: /opt/toolchains | |
| outputs: | |
| run_id: ${{ github.run_id }} | |
| version: ${{ env.VERSION }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| path: asset-tracker-template | |
| - name: Initialize | |
| working-directory: asset-tracker-template | |
| run: | | |
| if [ ! -d "../.west" ]; then | |
| west init -l . | |
| else | |
| echo ".west folder already exists, skipping west init." | |
| fi | |
| if [ "$NRFSDK_SHA_UPDATE" = "true" ]; then | |
| NRFSDK_SHA=$(git ls-remote https://github.com/nrfconnect/sdk-nrf main | awk '{print $1}') | |
| sed -i "/revision:/s/\( *revision: *\).*/\1${NRFSDK_SHA}/" west.yml | |
| echo Configuring build on NCS rev ${NRFSDK_SHA} | |
| echo "NRFSDK_SHA=${NRFSDK_SHA}" >> $GITHUB_ENV | |
| fi | |
| west update -o=--depth=1 -n | |
| west blobs fetch hal_nordic | |
| env: | |
| NRFSDK_SHA_UPDATE: ${{ inputs.nrfsdk_sha_update }} | |
| - name: Install dependencies | |
| run: | | |
| pip install -r nrf/scripts/requirements-build.txt | |
| apt update | |
| apt install -y --no-install-recommends gh | |
| - name: Set VERSION environment variable | |
| shell: bash | |
| run: | | |
| if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then | |
| echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | |
| else | |
| echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV | |
| fi | |
| - name: Update VERSION file for release | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| working-directory: asset-tracker-template | |
| run: | | |
| python3 scripts/app_version.py ${GITHUB_REF_NAME} > app/VERSION | |
| cat app/VERSION | |
| - name: Set MEMFAULT_FW_TYPE and MEMFAULT_FW_VERSION_PREFIX | |
| shell: bash | |
| run: | | |
| if [[ -z "${{ inputs.memfault_fw_type }}" ]]; then | |
| echo "MEMFAULT_FW_TYPE=asset-tracker-template-dev" >> $GITHUB_ENV | |
| else | |
| echo "MEMFAULT_FW_TYPE=${{ inputs.memfault_fw_type }}" >> $GITHUB_ENV | |
| fi | |
| if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then | |
| echo "MEMFAULT_FW_VERSION_PREFIX=${{ github.ref_name }}" >> $GITHUB_ENV | |
| else | |
| echo "MEMFAULT_FW_VERSION_PREFIX=0.0.0-dev" >> $GITHUB_ENV | |
| fi | |
| # Asset Tracker Template firmware build | |
| - name: Build thingy91x firmware | |
| working-directory: asset-tracker-template/app | |
| run: | | |
| mkdir -p artifacts | |
| cp overlay-memfault.conf overlay-memfault-att.conf | |
| echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-att.conf | |
| echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_FW_TYPE }}\" >> overlay-memfault-att.conf | |
| echo CONFIG_MEMFAULT_NCS_FW_VERSION_AUTO=y >> overlay-memfault-att.conf | |
| echo CONFIG_MEMFAULT_NCS_FW_VERSION_PREFIX=\"${{ env.MEMFAULT_FW_VERSION_PREFIX }}+\" >> overlay-memfault-att.conf | |
| west build -b thingy91x/nrf9151/ns -d build -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf" 2>&1 | tee artifacts/build_output_thingy91x.log | |
| cp build/merged.hex artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.hex | |
| cp build/app/zephyr/.config artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.config | |
| cp build/app/zephyr/zephyr.signed.bin artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-update-signed.bin | |
| cp build/app/zephyr/zephyr.signed.hex artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-update-signed.hex | |
| cp build/app/zephyr/zephyr.elf artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.elf | |
| cp build/dfu_application.zip artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-dfu.zip | |
| cd build | |
| ninja partition_manager_report | |
| ninja partition_manager_report > ../artifacts/pmr-thingy91x-nrf91-default-${{ env.VERSION }}.txt | |
| sed -i '1d' ../artifacts/pmr-thingy91x-nrf91-default-${{ env.VERSION }}.txt | |
| - name: Build nrf9151dk firmware | |
| if: ${{ github.event_name != 'pull_request' }} | |
| working-directory: asset-tracker-template/app | |
| run: | | |
| mkdir -p artifacts | |
| cp overlay-memfault.conf overlay-memfault-att.conf | |
| echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-att.conf | |
| echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_FW_TYPE }}\" >> overlay-memfault-att.conf | |
| echo CONFIG_MEMFAULT_NCS_FW_VERSION_AUTO=y >> overlay-memfault-att.conf | |
| echo CONFIG_MEMFAULT_NCS_FW_VERSION_PREFIX=\"${{ env.MEMFAULT_FW_VERSION_PREFIX }}+\" >> overlay-memfault-att.conf | |
| west build -b nrf9151dk/nrf9151/ns -d build -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf" | |
| cp build/merged.hex artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.hex | |
| cp build/app/zephyr/.config artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.config | |
| cp build/app/zephyr/zephyr.signed.bin artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-update-signed.bin | |
| cp build/app/zephyr/zephyr.signed.hex artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-update-signed.hex | |
| cp build/app/zephyr/zephyr.elf artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.elf | |
| cp build/dfu_application.zip artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-dfu.zip | |
| cd build | |
| ninja partition_manager_report | |
| ninja partition_manager_report > ../artifacts/pmr-nrf9151dk-nrf91-default-${{ env.VERSION }}.txt | |
| sed -i '1d' ../artifacts/pmr-nrf9151dk-nrf91-default-${{ env.VERSION }}.txt | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| id: artifact-upload-att | |
| with: | |
| name: firmware-att | |
| if-no-files-found: error | |
| path: | | |
| asset-tracker-template/app/artifacts/* | |
| # Asset Tracker Template debug firmware build | |
| - name: Build thingy91x debug firmware | |
| if: ${{ inputs.build_debug }} | |
| working-directory: asset-tracker-template/app | |
| run: | | |
| cp overlay-memfault.conf overlay-memfault-debug.conf | |
| echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-debug.conf | |
| echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_FW_TYPE }}\" >> overlay-memfault-debug.conf | |
| echo CONFIG_MEMFAULT_NCS_FW_VERSION_AUTO=y >> overlay-memfault-debug.conf | |
| echo CONFIG_MEMFAULT_NCS_FW_VERSION_PREFIX=\"${{ env.MEMFAULT_FW_VERSION_PREFIX }}-debug+\" >> overlay-memfault-debug.conf | |
| west build -p -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-debug.conf;overlay-etb.conf" | |
| - name: Rename debug artifacts | |
| if: ${{ inputs.build_debug }} | |
| working-directory: asset-tracker-template/app/build | |
| run: | | |
| cp merged.hex asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91.hex | |
| cp app/zephyr/.config asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91.config | |
| cp app/zephyr/zephyr.signed.bin asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91-update-signed.bin | |
| cp app/zephyr/zephyr.signed.hex asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91-update-signed.hex | |
| cp app/zephyr/zephyr.elf asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91.elf | |
| cp dfu_application.zip asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91-dfu.zip | |
| - name: Create partition manager report for nRF91 debug firmware | |
| if: ${{ inputs.build_debug }} | |
| working-directory: asset-tracker-template/app/build | |
| run: | | |
| ninja partition_manager_report | |
| ninja partition_manager_report > pmr-nrf91-debug-${{ env.VERSION }}.txt | |
| sed -i '1d' pmr-nrf91-debug-${{ env.VERSION }}.txt | |
| - name: Upload debug artifact | |
| if: ${{ inputs.build_debug }} | |
| uses: actions/upload-artifact@v4 | |
| id: artifact-upload-att-debug | |
| with: | |
| name: firmware-att-debug | |
| if-no-files-found: error | |
| path: | | |
| asset-tracker-template/app/build/asset-tracker-template-*.* | |
| asset-tracker-template/app/build/pmr-nrf91-*.txt | |
| - name: Print run-id and fw version | |
| run: | | |
| echo Run id: ${{ github.run_id }} | |
| echo Version: ${{ env.VERSION }} | |
| - name: Auto PR update NCS reference | |
| if: ${{ inputs.nrfsdk_sha_update }} | |
| working-directory: asset-tracker-template | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add west.yml | |
| git commit -m "manifest: auto: Update nrf-sdk SHA" | |
| git push origin HEAD:nrf-manifest-auto-branch --force | |
| gh pr create --title "manifest: auto: Update nrf-sdk SHA" \ | |
| --body "Created by GitHub Action" \ | |
| --base main \ | |
| --head nrf-manifest-auto-branch || true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |