|  | 
|  | 1 | +# Copyright (c) 2023 Golioth, Inc. | 
|  | 2 | +# SPDX-License-Identifier: Apache-2.0 | 
|  | 3 | + | 
|  | 4 | +name: Build Zephyr binaries | 
|  | 5 | + | 
|  | 6 | +on: | 
|  | 7 | +  workflow_dispatch: | 
|  | 8 | +    inputs: | 
|  | 9 | +      ZEPHYR_SDK: | 
|  | 10 | +        required: true | 
|  | 11 | +        type: string | 
|  | 12 | +        default: 0.16.3 | 
|  | 13 | +      BOARD: | 
|  | 14 | +        required: true | 
|  | 15 | +        type: string | 
|  | 16 | +        default: aludel_mini_v1_sparkfun9160_ns | 
|  | 17 | +      ARTIFACT: | 
|  | 18 | +        required: true | 
|  | 19 | +        type: boolean | 
|  | 20 | +        default: false | 
|  | 21 | +      TAG: | 
|  | 22 | +        type: string | 
|  | 23 | + | 
|  | 24 | +  workflow_call: | 
|  | 25 | +    inputs: | 
|  | 26 | +      ZEPHYR_SDK: | 
|  | 27 | +        required: true | 
|  | 28 | +        type: string | 
|  | 29 | +      BOARD: | 
|  | 30 | +        required: true | 
|  | 31 | +        type: string | 
|  | 32 | +      ARTIFACT: | 
|  | 33 | +        required: true | 
|  | 34 | +        type: boolean | 
|  | 35 | +      TAG: | 
|  | 36 | +        type: string | 
|  | 37 | + | 
|  | 38 | +jobs: | 
|  | 39 | +  build: | 
|  | 40 | +    runs-on: ubuntu-latest | 
|  | 41 | + | 
|  | 42 | +    container: golioth/golioth-zephyr-base:${{ inputs.ZEPHYR_SDK }}-SDK-v0 | 
|  | 43 | + | 
|  | 44 | +    env: | 
|  | 45 | +      ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-${{ inputs.ZEPHYR_SDK }} | 
|  | 46 | + | 
|  | 47 | +    steps: | 
|  | 48 | +      - name: Checkout | 
|  | 49 | +        uses: actions/checkout@v4 | 
|  | 50 | +        with: | 
|  | 51 | +          path: app | 
|  | 52 | + | 
|  | 53 | +      - name: Process Board name | 
|  | 54 | +        id: nicename | 
|  | 55 | +        shell: bash | 
|  | 56 | +        run: | | 
|  | 57 | +          BOARD_NICENAME=${{ inputs.BOARD }} | 
|  | 58 | +          BOARD_NICENAME=${BOARD_NICENAME//\//_} | 
|  | 59 | +          echo "BOARD_NICENAME=${BOARD_NICENAME}" >> $GITHUB_OUTPUT | 
|  | 60 | +
 | 
|  | 61 | +      - name: Setup West workspace | 
|  | 62 | +        run: | | 
|  | 63 | +          west init -l app | 
|  | 64 | +          west update --narrow -o=--depth=1 | 
|  | 65 | +          west zephyr-export | 
|  | 66 | +          pip3 install -r deps/zephyr/scripts/requirements-base.txt | 
|  | 67 | +          # Needed for TF-M | 
|  | 68 | +          pip3 install cryptography pyasn1 pyyaml cbor>=1.0.0 imgtool>=1.9.0 jinja2 click | 
|  | 69 | +
 | 
|  | 70 | +      - name: Build with West | 
|  | 71 | +        run: | | 
|  | 72 | +          west build -p -b ${{ inputs.BOARD }} --sysbuild app | 
|  | 73 | +
 | 
|  | 74 | +      - name: Prepare artifacts | 
|  | 75 | +        shell: bash | 
|  | 76 | +        if: inputs.ARTIFACT == true && inputs.TAG != '' | 
|  | 77 | + | 
|  | 78 | +        run: | | 
|  | 79 | +          cd build | 
|  | 80 | +          mkdir -p artifacts | 
|  | 81 | +          mv merged.hex                   ./artifacts/soil_moisture_${{ inputs.TAG }}_${{ steps.nicename.outputs.BOARD_NICENAME }}_full.hex | 
|  | 82 | +          mv app/zephyr/zephyr.signed.bin ./artifacts/soil_moisture_${{ inputs.TAG }}_${{ steps.nicename.outputs.BOARD_NICENAME }}_update.bin | 
|  | 83 | +          mv app/zephyr/zephyr.elf        ./artifacts/soil_moisture_${{ inputs.TAG }}_${{ steps.nicename.outputs.BOARD_NICENAME }}.elf | 
|  | 84 | +
 | 
|  | 85 | +      # Run IDs are unique per repo but are reused on re-runs | 
|  | 86 | +      - name: Save artifact | 
|  | 87 | +        if: inputs.ARTIFACT == true | 
|  | 88 | +        uses: actions/upload-artifact@v4 | 
|  | 89 | +        with: | 
|  | 90 | +          name: build_artifacts_${{ github.run_id }}_${{ steps.nicename.outputs.BOARD_NICENAME }} | 
|  | 91 | +          path: | | 
|  | 92 | +            build/artifacts/* | 
0 commit comments