feat(ci): Use input variables for configuring user build

This commit is contained in:
elagil 2022-04-03 18:53:37 +02:00 committed by Pete Johanson
parent b1687eec2a
commit 2c4ca7390b
1 changed files with 22 additions and 6 deletions

View File

@ -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