mirror of
https://github.com/ClaytonWWilson/miryoku_zmk.git
synced 2025-12-13 17:58:47 +00:00
Refactor workflow and outboards
- change "merge" option to "branches" - use first branch as base and merge rest - use "zmk" file instead of manifest - checkout to subdirectories - checkout zmk manually - use west just for zephyr - use absolute paths - handle simultaneous board and shield outboards - change outboard and directory names
This commit is contained in:
parent
5a0a9e1b8f
commit
dab63d5540
@ -1,7 +1,7 @@
|
||||
# Copyright 2022 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
name: 'Build Example corne nice_nano mousekeyspr'
|
||||
name: 'Build Example mousekeyspr'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
@ -12,4 +12,4 @@ jobs:
|
||||
shield: '["corne_left","corne_right"]'
|
||||
config: '["#define MIRYOKU_KLUDEGE_MOUSEKEYSPR"]'
|
||||
kconfig: '["CONFIG_ZMK_MOUSE=y"]'
|
||||
merge: '["=krikun98/zmk/mouse-pr"]'
|
||||
branches: '["zmkfirmware/zmk/main krikun98/zmk/mouse-pr","krikun98/zmk/mouse-pr"]'
|
||||
8
.github/workflows/build-inputs.yml
vendored
8
.github/workflows/build-inputs.yml
vendored
@ -40,7 +40,7 @@ on:
|
||||
description: 'Kconfig'
|
||||
required: false
|
||||
default: 'default'
|
||||
merge:
|
||||
branches:
|
||||
description: 'ZMK Branches'
|
||||
required: false
|
||||
default: 'default'
|
||||
@ -57,7 +57,7 @@ jobs:
|
||||
mapping: ${{ steps.process-inputs.outputs.mapping }}
|
||||
config: ${{ steps.process-inputs.outputs.config }}
|
||||
kconfig: ${{ steps.process-inputs.outputs.kconfig }}
|
||||
merge: ${{ steps.process-inputs.outputs.merge }}
|
||||
branches: ${{ steps.process-inputs.outputs.branches }}
|
||||
steps:
|
||||
- name: Process inputs
|
||||
id: process-inputs
|
||||
@ -76,7 +76,7 @@ jobs:
|
||||
set-output "mapping" "${{ github.event.inputs.mapping }}"
|
||||
set-output "config" "${{ github.event.inputs.config }}"
|
||||
set-output "kconfig" "${{ github.event.inputs.kconfig }}"
|
||||
set-output "merge" "${{ github.event.inputs.merge }}"
|
||||
set-output "branches" "${{ github.event.inputs.branches }}"
|
||||
build:
|
||||
uses: manna-harbour/zmk-config/.github/workflows/main.yml@31a649e5571b4572d7010561dd3f191922cd9410
|
||||
needs: process-inputs
|
||||
@ -90,4 +90,4 @@ jobs:
|
||||
mapping: ${{ needs.process-inputs.outputs.mapping }}
|
||||
config: ${{ needs.process-inputs.outputs.config }}
|
||||
kconfig: ${{ needs.process-inputs.outputs.kconfig }}
|
||||
merge: ${{ needs.process-inputs.outputs.merge }}
|
||||
branches: ${{ needs.process-inputs.outputs.branches }}
|
||||
|
||||
175
.github/workflows/main.yml
vendored
175
.github/workflows/main.yml
vendored
@ -32,7 +32,7 @@ on:
|
||||
kconfig:
|
||||
type: string
|
||||
default: '["default"]'
|
||||
merge:
|
||||
branches:
|
||||
type: string
|
||||
default: '["default"]'
|
||||
|
||||
@ -53,11 +53,13 @@ jobs:
|
||||
mapping: ${{ fromJSON(inputs.mapping) }}
|
||||
config: ${{ fromJSON(inputs.config) }}
|
||||
kconfig: ${{ fromJSON(inputs.kconfig) }}
|
||||
merge: ${{ fromJSON(inputs.merge) }}
|
||||
branches: ${{ fromJSON(inputs.branches) }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Process variables
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: 'miryoku_zmk'
|
||||
- name: main
|
||||
id: variables
|
||||
run: |
|
||||
if [ -n "${{ matrix.shield }}" -a "${{ matrix.shield }}" != "default" ]
|
||||
@ -73,7 +75,7 @@ jobs:
|
||||
keyboard_split="$keyboard"
|
||||
keyboard_base=`echo "$keyboard" | sed 's/_\(left\|right\)//'`
|
||||
|
||||
configfile="${GITHUB_WORKSPACE}/miryoku/custom_config.h"
|
||||
configfile="${GITHUB_WORKSPACE}/miryoku_zmk/miryoku/custom_config.h"
|
||||
echo "::set-output name=configfile::$configfile"
|
||||
|
||||
artifact_build_name="miryoku_zmk $shield ${{ matrix.board }}"
|
||||
@ -96,112 +98,76 @@ jobs:
|
||||
esac
|
||||
done
|
||||
|
||||
artifacts_dir="artifacts"
|
||||
artifacts_dir="${GITHUB_WORKSPACE}/artifacts"
|
||||
echo "::set-output name=artifact-dir::$artifacts_dir"
|
||||
mkdir "$artifacts_dir"
|
||||
|
||||
cp "$configfile" "$artifacts_dir"
|
||||
cat "$configfile"
|
||||
|
||||
if [ -n "${{ matrix.kconfig }}" -a "${{ matrix.kconfig }}" != 'default' ]
|
||||
then
|
||||
kconfig_file="config/$keyboard_split.conf"
|
||||
kconfig_file="${GITHUB_WORKSPACE}/miryoku_zmk/config/$keyboard_split.conf"
|
||||
echo "${{ matrix.kconfig }}" >> "$kconfig_file"
|
||||
cp "$kconfig_file" "$artifacts_dir"
|
||||
cat "$kconfig_file"
|
||||
artifact_build_name="$artifact_build_name kconfig_"`echo "${{ matrix.kconfig }}" | md5sum | cut -d ' ' -f 1`
|
||||
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`
|
||||
for branch in ${{ matrix.merge }}
|
||||
do
|
||||
if [ `echo "$branch" | cut -c1` = '=' ]
|
||||
then
|
||||
zmk=`echo "$branch" | cut -c2-`
|
||||
else
|
||||
merge="$merge $branch"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo "::set-output name=merge::$merge"
|
||||
echo "::set-output name=zmk::$zmk"
|
||||
. "${GITHUB_WORKSPACE}/miryoku_zmk/.github/workflows/zmk"
|
||||
|
||||
outboard_dir=".github/workflows/outboards"
|
||||
if [ -n "$shield" ]
|
||||
then
|
||||
outboard_file="$outboard_dir/$keyboard_base.shield.outboard"
|
||||
outboards="shields/$keyboard_base boards/${{ matrix.board }}"
|
||||
else
|
||||
outboard_file="$outboard_dir/$keyboard_base.board.outboard"
|
||||
fi
|
||||
if [ ! -f "$outboard_file" ]
|
||||
then
|
||||
outboard_file="$outboard_dir/$keyboard_base.outboard"
|
||||
outboards="boards/$keyboard_base"
|
||||
fi
|
||||
for outboard in $outboards
|
||||
do
|
||||
outboard_file="${GITHUB_WORKSPACE}/miryoku_zmk/.github/workflows/outboards/$outboard"
|
||||
if [ -f "$outboard_file" ]
|
||||
then
|
||||
grep -v '^#' "$outboard_file" >> $GITHUB_ENV
|
||||
cat "$outboard_file"
|
||||
cp "$outboard_file" "$artifacts_dir"
|
||||
. "$outboard_file"
|
||||
outboard_dir="${GITHUB_WORKSPACE}/outboards/$outboard"
|
||||
if [ -n "$outboard_repository" -a -n "$outboard_ref" ]
|
||||
then
|
||||
git clone -b "$outboard_ref" --depth 1 "https://github.com/$outboard_repository.git" "$outboard_dir"
|
||||
if [ -n "$outboard_from" -a -n "$outboard_to" ]
|
||||
then
|
||||
to="${GITHUB_WORKSPACE}/miryoku_zmk/config/$outboard_to"
|
||||
mkdir -p `dirname "$to"`
|
||||
ln -sr "$outboard_dir/$outboard_from" "$to"
|
||||
fi
|
||||
fi
|
||||
outboard_repository=''
|
||||
outboard_ref=''
|
||||
outboard_from=''
|
||||
outboard_to=''
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${{ matrix.branches }}" -a "${{ matrix.branches }}" != 'default' ]
|
||||
then
|
||||
artifact_build_name="$artifact_build_name branches_"`echo "${{ matrix.branches }}" | md5sum | cut -d ' ' -f 1`
|
||||
zmk=`echo "${{ matrix.branches }}" | cut -d ' ' -f 1`
|
||||
merges=`echo "${{ matrix.branches }}" | cut -d ' ' -f 2- -s`
|
||||
fi
|
||||
echo "::set-output name=outboard_chekout_dir::outboard"
|
||||
|
||||
artifact_build_name=`echo $artifact_build_name | tr ' ' '-'`
|
||||
echo "::set-output name=artifact-build-name::$artifact_build_name"
|
||||
echo "::set-output name=artifact-generic-name::"`echo "$artifact_build_name" | sed 's/_\(left\|right\)//'`
|
||||
|
||||
- name: Checkout outboard
|
||||
if: ${{ env.outboard_repository != '' && env.outboard_ref != '' }}
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ env.outboard_repository }}
|
||||
ref: ${{ env.outboard_ref }}
|
||||
path: ${{ steps.variables.outputs.outboard_chekout_dir }}
|
||||
- name: Link outboard
|
||||
if: ${{ env.outboard_from != '' && env.outboard_to != '' }}
|
||||
run: |
|
||||
mkdir -p `dirname "config/${{ env.outboard_to }}"`
|
||||
ln -sr ${{ steps.variables.outputs.outboard_chekout_dir }}/${{ env.outboard_from }} config/${{ env.outboard_to }}
|
||||
- name: Generate manifest from outboard
|
||||
if: ${{ env.outboard_url_base != '' && env.outboard_revision != '' }}
|
||||
run: |
|
||||
echo "manifest:\n remotes:\n - name: outboard\n url-base: ${{ env.outboard_url_base }}\n projects:\n - name: zmk\n remote: outboard\n revision: ${{ env.outboard_revision }}\n import: app/west.yml\n self:\n path: config" > config/west.yml
|
||||
cat config/west.yml
|
||||
- name: Copy manifest from outboard
|
||||
if: ${{ env.outboard_manifest != '' }}
|
||||
run: |
|
||||
cp ${{ steps.variables.outputs.outboard_chekout_dir }}/${{ env.outboard_manifest }} config/west.yml
|
||||
cat config/west.yml
|
||||
- name: Generate manifest from merge field
|
||||
if: ${{ steps.variables.outputs.zmk != '' }}
|
||||
run: |
|
||||
user=`echo ${{ steps.variables.outputs.zmk }} | cut -f 1 -d '/'`
|
||||
repo=`echo ${{ steps.variables.outputs.zmk }} | cut -f 2 -d '/'`
|
||||
branch=`echo ${{ steps.variables.outputs.zmk }} | cut -f 3- -d '/'`
|
||||
remote="$user-$repo"
|
||||
echo "manifest:\n remotes:\n - name: $remote\n url-base: https://github.com/$user\n projects:\n - name: zmk\n remote: $remote\n repo-path: $repo\n revision: $branch\n import: app/west.yml\n self:\n path: config" > config/west.yml
|
||||
cat config/west.yml
|
||||
- name: Cache zmk
|
||||
if: true
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
zmk/
|
||||
key: zmk ${{ hashFiles('config/west.yml') }} ${{ matrix.merge }}
|
||||
timeout-minutes: 2
|
||||
continue-on-error: true
|
||||
- name: West init
|
||||
run: west init -l config
|
||||
- name: West update zmk
|
||||
run: west update zmk
|
||||
- name: Merge branches
|
||||
if: ${{ steps.variables.outputs.merge != '' }}
|
||||
run: |
|
||||
cd zmk
|
||||
user=`echo "$zmk" | cut -f 1 -d '/'`
|
||||
repo=`echo "$zmk" | cut -f 2 -d '/'`
|
||||
branch=`echo "$zmk" | cut -f 3- -d '/'`
|
||||
git clone -b "$branch" --depth 1 "https://github.com/$user/$repo.git" 'zmk'
|
||||
|
||||
if [ -n "$merges" ]
|
||||
then
|
||||
cd "${GITHUB_WORKSPACE}/zmk"
|
||||
git config user.name "${GITHUB_ACTOR}"
|
||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
for merge in ${{ steps.variables.outputs.merge }}
|
||||
git fetch --unshallow
|
||||
for merge in "$merges"
|
||||
do
|
||||
user=`echo "$merge" | cut -f 1 -d '/'`
|
||||
repo=`echo "$merge" | cut -f 2 -d '/'`
|
||||
@ -213,43 +179,38 @@ jobs:
|
||||
git remote remove "$remote"
|
||||
git status
|
||||
done
|
||||
cd ..
|
||||
cp -a zmk zmk.merged
|
||||
- name: Cache zephyr
|
||||
fi
|
||||
- name: cache
|
||||
if: true
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
modules/
|
||||
tools/
|
||||
zephyr/
|
||||
zmk/modules/
|
||||
zmk/zephyr/
|
||||
key: zephyr ${{ runner.os }} ${{ hashFiles('zmk/app/west.yml') }}
|
||||
timeout-minutes: 2
|
||||
continue-on-error: true
|
||||
- name: West update
|
||||
run: west update
|
||||
- name: Restore merge
|
||||
if: ${{ steps.variables.outputs.merge != '' }}
|
||||
- name: build
|
||||
run: |
|
||||
mv zmk zmk.default
|
||||
mv zmk.merged zmk
|
||||
- name: Export Zephyr CMake package
|
||||
run: west zephyr-export
|
||||
- name: Build
|
||||
run: west build -s zmk/app -b ${{ matrix.board }} -- ${{ steps.variables.outputs.shield-arg }} -DZMK_CONFIG="${GITHUB_WORKSPACE}/config"
|
||||
- name: Prepare firmware artifacts
|
||||
run: |
|
||||
for extension in "hex" "uf2"
|
||||
cd "${GITHUB_WORKSPACE}/zmk"
|
||||
west init -l app
|
||||
west update
|
||||
west zephyr-export
|
||||
|
||||
cd "${GITHUB_WORKSPACE}/zmk/app"
|
||||
west build -b ${{ matrix.board }} -- ${{ steps.variables.outputs.shield-arg }} -DZMK_CONFIG="${GITHUB_WORKSPACE}/miryoku_zmk/config"
|
||||
|
||||
for extension in "uf2"
|
||||
do
|
||||
file="build/zephyr/zmk.$extension"
|
||||
file="${GITHUB_WORKSPACE}/zmk/app/build/zephyr/zmk.$extension"
|
||||
if [ -f "$file" ]
|
||||
then
|
||||
cp "$file" "${{ steps.variables.outputs.artifact-dir }}/${{ steps.variables.outputs.artifact-build-name }}.$extension"
|
||||
fi
|
||||
done
|
||||
- name: Archive artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
- name: upload
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.variables.outputs.artifact-generic-name }}
|
||||
path: ${{ steps.variables.outputs.artifact-dir }}
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
4
.github/workflows/outboards/boards/corne-ish_zen
vendored
Normal file
4
.github/workflows/outboards/boards/corne-ish_zen
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Copyright 2022 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
zmk=LOWPROKB/zmk/Board-Corne-ish-Zen-dedicated-work-queue
|
||||
4
.github/workflows/outboards/boards/ferris_rev02
vendored
Normal file
4
.github/workflows/outboards/boards/ferris_rev02
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Copyright 2022 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
zmk=petejohanson/zmk/boards/ferris-02-bling-basics
|
||||
9
.github/workflows/outboards/boards/sparkfun_nrf52840_mini
vendored
Normal file
9
.github/workflows/outboards/boards/sparkfun_nrf52840_mini
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright 2022 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
# use with shield microdox_mod
|
||||
|
||||
outboard_repository=abondis/zmk-config
|
||||
outboard_ref=main
|
||||
outboard_from=config/boards/arm/sparkfun_nrf52840_mini
|
||||
outboard_to=boards/arm/sparkfun_nrf52840_mini
|
||||
@ -1,8 +1,7 @@
|
||||
# Copyright 2021 Manna Harbour
|
||||
# Copyright 2022 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
outboard_repository=petejohanson/zaphod-config
|
||||
outboard_ref=main
|
||||
outboard_from=boards/arm/zaphod
|
||||
outboard_to=boards/arm/zaphod
|
||||
outboard_manifest=west.yml
|
||||
@ -1,5 +0,0 @@
|
||||
# Copyright 2021 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
outboard_url_base=https://github.com/LOWPROKB
|
||||
outboard_revision=Board-Corne-ish-Zen-dedicated-work-queue
|
||||
@ -1,5 +0,0 @@
|
||||
# Copyright 2021 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
outboard_url_base=https://github.com/petejohanson
|
||||
outboard_revision=boards/ferris-02-bling-basics
|
||||
@ -1,9 +0,0 @@
|
||||
# Copyright 2021 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
# use with included board sparkfun_nrf52840_mini
|
||||
|
||||
outboard_repository=abondis/zmk-config
|
||||
outboard_ref=main
|
||||
outboard_from=config/boards
|
||||
outboard_to=boards
|
||||
9
.github/workflows/outboards/shields/microdox_mod
vendored
Normal file
9
.github/workflows/outboards/shields/microdox_mod
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright 2022 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
# use with board sparkfun_nrf52840_mini
|
||||
|
||||
outboard_repository=abondis/zmk-config
|
||||
outboard_ref=main
|
||||
outboard_from=config/boards/shields/microdox_mod
|
||||
outboard_to=boards/shields/microdox_mod
|
||||
4
.github/workflows/zmk
vendored
Normal file
4
.github/workflows/zmk
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Copyright 2022 Manna Harbour
|
||||
# https://github.com/manna-harbour/miryoku
|
||||
|
||||
zmk=zmkfirmware/zmk/main
|
||||
@ -1,11 +0,0 @@
|
||||
manifest:
|
||||
remotes:
|
||||
- name: zmkfirmware
|
||||
url-base: https://github.com/zmkfirmware
|
||||
projects:
|
||||
- name: zmk
|
||||
remote: zmkfirmware
|
||||
revision: main
|
||||
import: app/west.yml
|
||||
self:
|
||||
path: config
|
||||
14
readme.org
14
readme.org
@ -148,15 +148,15 @@ Appends to the [[#config-file][config]] file. Join multiple lines with ~\n~. F
|
||||
Appends to [[#kconfig-configuration][Kconfig configuration]]. Join multiple lines with ~\n~. For no additonal config, leave as ~default~.
|
||||
|
||||
|
||||
****** ZMK Branches / merge
|
||||
****** ZMK Branches / branches
|
||||
|
||||
Used to select an alternative ZMK branch for building, and to merge branches into ZMK at build time.
|
||||
|
||||
An alternative ZMK branch for building is specified as ~=<user>/<repo>/<branch>~, i.e. with a leading ~=~. E.g. the default ZMK branch would be specified as ~=zmkfirmware/zmk/main~.
|
||||
Branches are specified in the form ~<user>/<repo>/<branch>~. E.g. the default ZMK branch would be specified as ~zmkfirmware/zmk/main~.
|
||||
|
||||
Branches for merging are specified as ~<user>/<repo>/<branch>~, i.e. with no leading ~=~. E.g. the default ZMK branch would be specified as ~zmkfirmware/zmk/main~.
|
||||
Multiple space separated branches can be specified. The first branch specified is used as an alternative ZMK branch for building. Any additional branches will be merged.
|
||||
|
||||
To specify multiple branches, separate with space. For no changes, leave as ~default~.
|
||||
For no changes, leave as ~default~.
|
||||
|
||||
|
||||
** Supported Keyboards
|
||||
@ -350,13 +350,13 @@ Add ~#define MIRYOKU_KLUDEGE_MOUSEKEYSPR~ to the [[#config-file][config file]].
|
||||
|
||||
Add ~CONFIG_ZMK_MOUSE=y~ to the [[#kconfig-configuration][Kconfig configuration]].
|
||||
|
||||
[[#zmk-branches--merge][Merge or build]] from the mousekeys PR branch ~krikun98/zmk/mouse-pr~
|
||||
[[#zmk-branches--branches][Merge or build]] from the mousekeys PR branch ~krikun98/zmk/mouse-pr~
|
||||
|
||||
For [[#workflow-builds][workflow builds]], the [[#build-inputs][Build Inputs]] workflow can be used, or for [[#build-examples][Build Examlpe]] workflows see the [[./github/workflows/build-example-corne-nice_nano-mousekeyspr.yml][Build Example corne nice_nano mousekeyspr]] workflow.
|
||||
For [[#workflow-builds][workflow builds]], the [[#build-inputs][Build Inputs]] workflow can be used, or for [[#build-examples][Build Examlpe]] workflows see the [[./github/workflows/build-example-mousekeyspr.yml][Build Example mousekeyspr]] workflow.
|
||||
|
||||
For local builds, make the changes to the local files.
|
||||
|
||||
If the PR hasn't been rebased recently the automatic merge may fail. In that case merge manually or build directly from the branch.
|
||||
If the PR hasn't been rebased recently the automatic merge may fail. In that case build directly from the branch or merge manually.
|
||||
|
||||
|
||||
*** Key Emulation Combos
|
||||
|
||||
Loading…
Reference in New Issue
Block a user