Add merge field to workflows

- remove space from matrix element separator
- change key
- remove restore-keys
This commit is contained in:
Manna Harbour 2022-02-14 15:07:03 +11:00
parent 65c9c39f6c
commit 8e6c80f40f
3 changed files with 49 additions and 11 deletions

View File

@ -36,6 +36,10 @@ on:
description: 'Kconfig' description: 'Kconfig'
required: false required: false
default: 'default' default: 'default'
merge:
description: 'ZMK Merge'
required: false
default: 'default'
jobs: jobs:
process-inputs: process-inputs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -48,13 +52,14 @@ jobs:
layers: ${{ steps.process-inputs.outputs.layers }} layers: ${{ steps.process-inputs.outputs.layers }}
mapping: ${{ steps.process-inputs.outputs.mapping }} mapping: ${{ steps.process-inputs.outputs.mapping }}
kconfig: ${{ steps.process-inputs.outputs.kconfig }} kconfig: ${{ steps.process-inputs.outputs.kconfig }}
merge: ${{ steps.process-inputs.outputs.merge }}
steps: steps:
- name: Process inputs - name: Process inputs
id: process-inputs id: process-inputs
run: | run: |
set-output() set-output()
{ {
json=`echo "$2" | jq -cnR 'inputs | split("(,| )+";"")'` json=`echo "$2" | jq -cnR 'inputs | split(",";"")'`
echo "::set-output name=$1::$json" echo "::set-output name=$1::$json"
} }
set-output "board" "${{ github.event.inputs.board }}" set-output "board" "${{ github.event.inputs.board }}"
@ -65,6 +70,7 @@ jobs:
set-output "layers" "${{ github.event.inputs.layers }}" set-output "layers" "${{ github.event.inputs.layers }}"
set-output "mapping" "${{ github.event.inputs.mapping }}" set-output "mapping" "${{ github.event.inputs.mapping }}"
set-output "kconfig" "${{ github.event.inputs.kconfig }}" set-output "kconfig" "${{ github.event.inputs.kconfig }}"
set-output "merge" "${{ github.event.inputs.merge }}"
build: build:
uses: manna-harbour/zmk-config/.github/workflows/main.yml@82f608118a663f0cb02a3cfa4330e21d58b52a4f uses: manna-harbour/zmk-config/.github/workflows/main.yml@82f608118a663f0cb02a3cfa4330e21d58b52a4f
needs: process-inputs needs: process-inputs
@ -77,3 +83,4 @@ jobs:
layers: ${{ needs.process-inputs.outputs.layers }} layers: ${{ needs.process-inputs.outputs.layers }}
mapping: ${{ needs.process-inputs.outputs.mapping }} mapping: ${{ needs.process-inputs.outputs.mapping }}
kconfig: ${{ needs.process-inputs.outputs.kconfig }} kconfig: ${{ needs.process-inputs.outputs.kconfig }}
merge: ${{ needs.process-inputs.outputs.merge }}

View File

@ -29,6 +29,10 @@ on:
kconfig: kconfig:
type: string type: string
default: '["default"]' default: '["default"]'
merge:
type: string
default: '["default"]'
jobs: jobs:
main: main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -45,6 +49,7 @@ jobs:
layers: ${{ fromJSON(inputs.layers) }} layers: ${{ fromJSON(inputs.layers) }}
mapping: ${{ fromJSON(inputs.mapping) }} mapping: ${{ fromJSON(inputs.mapping) }}
kconfig: ${{ fromJSON(inputs.kconfig) }} kconfig: ${{ fromJSON(inputs.kconfig) }}
merge: ${{ fromJSON(inputs.merge) }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -95,6 +100,11 @@ jobs:
artifact_build_name="$artifact_build_name kconfig_"`echo "${{ matrix.kconfig }}" | md5sum | cut -d ' ' -f 1` artifact_build_name="$artifact_build_name kconfig_"`echo "${{ matrix.kconfig }}" | md5sum | cut -d ' ' -f 1`
fi fi
if [ -n "${{ matrix.merge }}" -a "${{ matrix.merge }}" != 'default' ]
then
artifact_build_name="$artifact_build_name merge_"`echo "${{ matrix.merge }}" | md5sum | cut -d ' ' -f 1`
fi
outboard_dir=".github/workflows/outboards" outboard_dir=".github/workflows/outboards"
if [ -n "$shield" ] if [ -n "$shield" ]
then then
@ -140,10 +150,9 @@ jobs:
run: | run: |
cp ${{ steps.variables.outputs.outboard_chekout_dir }}/${{ env.outboard_manifest }} config/west.yml cp ${{ steps.variables.outputs.outboard_chekout_dir }}/${{ env.outboard_manifest }} config/west.yml
cat config/west.yml cat config/west.yml
- name: Cache west modules - name: Cache
if: true
uses: actions/cache@v2 uses: actions/cache@v2
env:
cache-name: zephyr
with: with:
path: | path: |
bootloader/ bootloader/
@ -151,17 +160,35 @@ jobs:
tools/ tools/
zephyr/ zephyr/
zmk/ zmk/
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('config/west.yml') }} key: ${{ runner.os }} ${{ hashFiles('config/west.yml') }} ${{ matrix.merge }}
restore-keys: ${{ runner.os }}-${{ env.cache-name }}
timeout-minutes: 2 timeout-minutes: 2
continue-on-error: true continue-on-error: true
- name: Initialize workspace (west init) - name: Initialize west workspace
run: west init -l config run: west init -l config
- name: Update modules (west update) - name: Update west projects
run: west update run: west update
- name: Export Zephyr CMake package (west zephyr-export) - name: Merge branches and update
if: ${{ matrix.merge != '' && matrix.merge != 'default' }}
run: |
cd zmk
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
for merge in ${{ matrix.merge }}
do
user=`echo "$merge" | cut -f 1 -d '/'`
repo=`echo "$merge" | cut -f 2 -d '/'`
branch=`echo "$merge" | cut -f 3- -d '/'`
remote="$user-$repo"
git remote add "$remote" "https://github.com/$user/$repo.git"
git fetch "$remote" "$branch"
git merge "$remote/$branch"
git remote remove "$remote"
git status
done
west update
- name: Export Zephyr CMake package
run: west zephyr-export run: west zephyr-export
- name: Build (west build) - name: Build
run: west build -s zmk/app -b ${{ matrix.board }} -- ${{ steps.variables.outputs.shield-arg }} -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" run: west build -s zmk/app -b ${{ matrix.board }} -- ${{ steps.variables.outputs.shield-arg }} -DZMK_CONFIG="${GITHUB_WORKSPACE}/config"
- name: Show dts.pre.tmp - name: Show dts.pre.tmp
if: ${{ failure() }} if: ${{ failure() }}

View File

@ -59,9 +59,11 @@ The ~shield~ option specifies the ZMK shield.
The ~alphas~, ~nav~, ~clipboard~, and ~layers~ options correspond to the [[https://github.com/manna-harbour/miryoku/tree/master/docs/reference#alternative-layouts][alternative layout]] options. The ~mapping~ option corresponds to the alternative [[#mapping][mapping]] options. Alternative layout and mapping options are given in the documentation in the form ~MIRYOKU_OPTION=VALUE~. To use here, convert to the form specified above. Use ~default~ to represent the default value. Values for these five options are case-insensitive. The ~alphas~, ~nav~, ~clipboard~, and ~layers~ options correspond to the [[https://github.com/manna-harbour/miryoku/tree/master/docs/reference#alternative-layouts][alternative layout]] options. The ~mapping~ option corresponds to the alternative [[#mapping][mapping]] options. Alternative layout and mapping options are given in the documentation in the form ~MIRYOKU_OPTION=VALUE~. To use here, convert to the form specified above. Use ~default~ to represent the default value. Values for these five options are case-insensitive.
See the Test All workflow files for all supported values for each option.
The ~kconfig~ option can be used to for [[#kconfig-configuration][Kconfig configuration]]. Join multiple lines with ~\n~. The ~kconfig~ option can be used to for [[#kconfig-configuration][Kconfig configuration]]. Join multiple lines with ~\n~.
See the Test All workflow files for all supported values for each option. The ~merge~ option can be used to merge branches into ZMK at build time. Branches are specified as ~<user>/<repo>/<branch>~. To merge multiple branches, separate with space.
**** Build Inputs **** Build Inputs
@ -78,6 +80,8 @@ The ~Miryoku Alphas~, ~Miryoku Nav~, ~Miryoku Clipboard~, and ~Miryoku Layers~ o
The ~Kconfig~ option can be used to for [[#kconfig-configuration][Kconfig configuration]]. Join multiple lines with ~\n~. The ~Kconfig~ option can be used to for [[#kconfig-configuration][Kconfig configuration]]. Join multiple lines with ~\n~.
The ~ZMK Merge~ option can be used to merge branches into ZMK at build time. Branches are specified as ~<user>/<repo>/<branch>~. To merge multiple branches, separate with space.
** Supported Keyboards ** Supported Keyboards