feat(ci): Use input variables for configuring user build
This commit is contained in:
parent
b1687eec2a
commit
2c4ca7390b
1 changed files with 22 additions and 6 deletions
28
.github/workflows/build-user-config.yml
vendored
28
.github/workflows/build-user-config.yml
vendored
|
@ -2,6 +2,22 @@ name: Reusable user config build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
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:
|
jobs:
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -17,8 +33,8 @@ jobs:
|
||||||
- id: set-matrix
|
- id: set-matrix
|
||||||
name: Fetch Build Matrix
|
name: Fetch Build Matrix
|
||||||
run: |
|
run: |
|
||||||
matrix=$(yaml2json build.yaml | jq -c .)
|
matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .)
|
||||||
yaml2json build.yaml
|
yaml2json ${{ inputs.build_matrix_path }}
|
||||||
echo "::set-output name=matrix::${matrix}"
|
echo "::set-output name=matrix::${matrix}"
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -64,14 +80,14 @@ jobs:
|
||||||
${{ runner.os }}-build-
|
${{ runner.os }}-build-
|
||||||
${{ runner.os }}-
|
${{ runner.os }}-
|
||||||
- name: West Init
|
- name: West Init
|
||||||
run: west init -l config
|
run: west init -l ${{ inputs.config_path }}
|
||||||
- name: West Update
|
- name: West Update
|
||||||
run: west update
|
run: west update
|
||||||
- name: West Zephyr export
|
- name: West Zephyr export
|
||||||
run: west zephyr-export
|
run: west zephyr-export
|
||||||
- name: West Build (${{ steps.variables.outputs.display-name }})
|
- name: West Build (${{ steps.variables.outputs.display-name }})
|
||||||
run: |
|
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
|
- name: ${{ steps.variables.outputs.display-name }} DTS File
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
run: |
|
run: |
|
||||||
|
@ -85,9 +101,9 @@ jobs:
|
||||||
if [ -f build/zephyr/zmk.uf2 ]
|
if [ -f build/zephyr/zmk.uf2 ]
|
||||||
then
|
then
|
||||||
cp build/zephyr/zmk.uf2 "build/artifacts/${{ steps.variables.outputs.artifact-name }}.uf2"
|
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
|
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
|
fi
|
||||||
- name: Archive (${{ steps.variables.outputs.display-name }})
|
- name: Archive (${{ steps.variables.outputs.display-name }})
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
|
Loading…
Add table
Reference in a new issue