From 2c4ca7390b5904b0dbd5f88d321ba5bdccddf607 Mon Sep 17 00:00:00 2001 From: elagil Date: Sun, 3 Apr 2022 18:53:37 +0200 Subject: [PATCH] feat(ci): Use input variables for configuring user build --- .github/workflows/build-user-config.yml | 28 +++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-user-config.yml b/.github/workflows/build-user-config.yml index de35ffb4..7da9a546 100644 --- a/.github/workflows/build-user-config.yml +++ b/.github/workflows/build-user-config.yml @@ -2,6 +2,22 @@ name: Reusable user config build on: workflow_call: + inputs: + build_matrix_path: + description: 'Path to the build matrix file' + default: 'build.yaml' + required: false + type: string + config_path: + description: 'Path to the config directory' + default: 'config' + required: false + type: string + fallback_binary: + description: 'Fallback binary format, if no *.uf2 file was built' + default: 'bin' + required: false + type: string jobs: matrix: @@ -17,8 +33,8 @@ jobs: - id: set-matrix name: Fetch Build Matrix run: | - matrix=$(yaml2json build.yaml | jq -c .) - yaml2json build.yaml + matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .) + yaml2json ${{ inputs.build_matrix_path }} echo "::set-output name=matrix::${matrix}" build: runs-on: ubuntu-latest @@ -64,14 +80,14 @@ jobs: ${{ runner.os }}-build- ${{ runner.os }}- - name: West Init - run: west init -l config + run: west init -l ${{ inputs.config_path }} - name: West Update run: west update - name: West Zephyr export run: west zephyr-export - name: West Build (${{ steps.variables.outputs.display-name }}) run: | - west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/config ${{ steps.variables.outputs.extra-cmake-args }} ${{ matrix.cmake-args }} + west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/${{ inputs.config_path }} ${{ steps.variables.outputs.extra-cmake-args }} ${{ matrix.cmake-args }} - name: ${{ steps.variables.outputs.display-name }} DTS File if: ${{ always() }} run: | @@ -85,9 +101,9 @@ jobs: if [ -f build/zephyr/zmk.uf2 ] then cp build/zephyr/zmk.uf2 "build/artifacts/${{ steps.variables.outputs.artifact-name }}.uf2" - elif [ -f build/zephyr/zmk.hex ] + elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ] then - cp build/zephyr/zmk.hex "build/artifacts/${{ steps.variables.outputs.artifact-name }}.hex" + cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ steps.variables.outputs.artifact-name }}.${{ inputs.fallback_binary }}" fi - name: Archive (${{ steps.variables.outputs.display-name }}) uses: actions/upload-artifact@v2