[CI] use ZMK's action
This commit is contained in:
parent
fc3b06d87f
commit
6e024c3499
@ -1,27 +1,91 @@
|
|||||||
on: [push, pull_request, workflow_dispatch]
|
# https://github.com/zmkfirmware/zmk/blob/main/.github/workflows/build-user-config.yml
|
||||||
|
name: Reusable user config build
|
||||||
|
|
||||||
name: Build
|
on:
|
||||||
|
workflow_call:
|
||||||
env:
|
inputs:
|
||||||
ACTIONS_STEP_DEBUG: true
|
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
|
||||||
|
archive_name:
|
||||||
|
description: "Archive output file name"
|
||||||
|
default: "firmware"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Fetch Build Keyboards
|
||||||
|
outputs:
|
||||||
|
build_matrix: ${{ env.build_matrix }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install yaml2json
|
||||||
|
run: python3 -m pip install remarshal
|
||||||
|
|
||||||
|
- name: Fetch Build Matrix
|
||||||
|
run: |
|
||||||
|
echo "build_matrix=$(yaml2json '${{ inputs.build_matrix_path }}' | jq -c .)" >> $GITHUB_ENV
|
||||||
|
yaml2json "${{ inputs.build_matrix_path }}" | jq
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: zmkfirmware/zmk-build-arm:stable
|
image: zmkfirmware/zmk-build-arm:stable
|
||||||
|
needs: matrix
|
||||||
name: Build
|
name: Build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix: ${{ fromJson(needs.matrix.outputs.build_matrix) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Dependencies
|
- name: Prepare variables
|
||||||
|
shell: sh -x {0}
|
||||||
|
env:
|
||||||
|
shield: ${{ matrix.shield }}
|
||||||
run: |
|
run: |
|
||||||
apt-get update;
|
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
|
||||||
apt-get install --yes --no-install-recommends nodejs ssh zip
|
echo "extra_cmake_args=${shield:+-DSHIELD=\"$shield\"}" >> $GITHUB_ENV
|
||||||
|
echo "display_name=${shield:+$shield - }${{ matrix.board }}" >> $GITHUB_ENV
|
||||||
|
echo "artifact_name=${shield:+$shield-}${{ matrix.board }}-zmk" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache west modules
|
||||||
|
uses: actions/cache@v3.0.11
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
cache_name: cache-zephyr-${{ env.zephyr_version }}-modules
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
modules/
|
||||||
|
tools/
|
||||||
|
zephyr/
|
||||||
|
bootloader/
|
||||||
|
zmk/
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache_name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-build-${{ env.cache_name }}-
|
||||||
|
${{ runner.os }}-build-
|
||||||
|
${{ 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
|
||||||
@ -29,28 +93,27 @@ jobs:
|
|||||||
- name: West Zephyr export
|
- name: West Zephyr export
|
||||||
run: west zephyr-export
|
run: west zephyr-export
|
||||||
|
|
||||||
- name: West Build (Corne Left)
|
- name: West Build (${{ env.display_name }})
|
||||||
run: west build -s zmk/app -b nice_nano_v2 -- -DSHIELD=corne_left -DZMK_CONFIG="${GITHUB_WORKSPACE}/config"
|
shell: sh -x {0}
|
||||||
|
run: west build -s zmk/app -b "${{ matrix.board }}" -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/${{ inputs.config_path }}" ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
|
||||||
|
|
||||||
- name: Corne Left Kconfig file
|
- name: ${{ env.display_name }} Kconfig file
|
||||||
run: cat build/zephyr/.config | grep -v "^#" | grep -v "^$"
|
run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort
|
||||||
|
|
||||||
- name: Rename zmk.uf2
|
- name: Rename artifacts
|
||||||
run: cp build/zephyr/zmk.uf2 corne_left_nice_nano_v2.uf2
|
shell: sh -x {0}
|
||||||
|
run: |
|
||||||
|
mkdir build/artifacts
|
||||||
|
if [ -f build/zephyr/zmk.uf2 ]
|
||||||
|
then
|
||||||
|
cp build/zephyr/zmk.uf2 "build/artifacts/${{ env.artifact_name }}.uf2"
|
||||||
|
elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ]
|
||||||
|
then
|
||||||
|
cp "build/zephyr/zmk.${{ inputs.fallback_binary }}" "build/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: West Build (Corne Right)
|
- name: Archive (${{ env.display_name }})
|
||||||
run: west build --pristine -s zmk/app -b nice_nano_v2 -- -DSHIELD=corne_right -DZMK_CONFIG="${GITHUB_WORKSPACE}/config"
|
|
||||||
|
|
||||||
- name: Corne Right Kconfig file
|
|
||||||
run: cat build/zephyr/.config | grep -v "^#" | grep -v "^$"
|
|
||||||
|
|
||||||
- name: Rename zmk.uf2
|
|
||||||
run: cp build/zephyr/zmk.uf2 corne_right_nice_nano_v2.uf2
|
|
||||||
|
|
||||||
- name: Upload Artifacts
|
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: firmware.zip
|
name: ${{ inputs.archive_name }}
|
||||||
if-no-files-found: ignore
|
path: build/artifacts
|
||||||
path: |
|
|
||||||
*.uf2
|
|
Loading…
Reference in New Issue
Block a user