Skip to content

Commit

Permalink
[Skean] Update default layer
Browse files Browse the repository at this point in the history
  • Loading branch information
ikzekly committed Aug 18, 2024
1 parent 5bfa437 commit 3e61edb
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 222 deletions.
200 changes: 2 additions & 198 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,201 +1,5 @@
name: User config build with custom names

on:
push:
pull_request:
workflow_dispatch:
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
archive_name:
description: 'Archive output file name'
default: 'zmk_firmware'
required: false
type: string
on: [push, pull_request, workflow_dispatch]

jobs:
env-setup:
runs-on: ubuntu-latest
name: Prepare environment variables
outputs:
build_matrix_path: ${{ env.build_matrix_path }}
config_path: ${{ env.config_path }}
fallback_binary: ${{ env.fallback_binary }}
archive_name: ${{ env.archive_name }}
steps:
- name: Export
run: |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]
then
echo "build_matrix_path=${{ inputs.build_matrix_path }}" >> $GITHUB_ENV
echo "config_path=${{ inputs.config_path }}" >> $GITHUB_ENV
echo "fallback_binary=${{ inputs.fallback_binary }}" >> $GITHUB_ENV
echo "archive_name=${{ inputs.archive_name }}" >> $GITHUB_ENV
else
echo "build_matrix_path=build.yaml" >> $GITHUB_ENV
echo "config_path=config" >> $GITHUB_ENV
echo "fallback_binary=bin" >> $GITHUB_ENV
echo "archive_name=zmk_firmware" >> $GITHUB_ENV
fi
matrix:
runs-on: ubuntu-latest
name: Fetch Build Keyboards
needs: env-setup
outputs:
build_matrix: ${{ env.build_matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install yaml2json
run: python3 -m pip install remarshal

- name: Fetch Build Matrix
run: |
chmod +x json_unwrapper.py
echo "build_matrix=$(yaml2json ${{ needs.env-setup.outputs.build_matrix_path }} | ./json_unwrapper.py | jq -c .)" >> $GITHUB_ENV
yaml2json ${{ needs.env-setup.outputs.build_matrix_path }} | ./json_unwrapper.py | jq
build:
runs-on: ubuntu-latest
container:
image: zmkfirmware/zmk-build-arm:stable
needs: [matrix, env-setup]
name: Build
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.build_matrix) }}
steps:
- name: Prepare variables
shell: bash -x {0}
env:
file_name_suffix: ""
run: |
if [ -n "${{ matrix.shield }}" ]
then
echo "extra_cmake_args=-DSHIELD=\"${{ matrix.shield }}\"" >> $GITHUB_ENV
echo "artifact_name=${{ matrix.shield }}-${{ matrix.board }}${{ matrix.file_name_suffix }}-zmk" >> $GITHUB_ENV
echo "display_name=${{ matrix.shield }} - ${{ matrix.board }}${{ matrix.file_name_suffix }}" >> $GITHUB_ENV
else
echo "extra_cmake_args=" >> $GITHUB_ENV
echo "artifact_name=${{ matrix.board }}${{ matrix.file_name_suffix }}-zmk" >> $GITHUB_ENV
echo "display_name=${{ matrix.board }}${{ matrix.file_name_suffix }}" >> $GITHUB_ENV
fi
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Cache west modules
uses: actions/cache@v4
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
run: west init -l ${{ needs.env-setup.outputs.config_path }}

- name: West Update
run: west update

- name: West Zephyr export
run: west zephyr-export

- name: Insert name into config
if: ${{ matrix.name }}
shell: bash -x {0}
run: |
non_primary_re="_right$"
if [[ ( -n "${{ matrix.shield }}" && "${{ matrix.shield }}" =~ $non_primary_re ) || "${{ matrix.board }}" =~ $non_primary_re ]]
then
echo "name=" >> $GITHUB_ENV
else
echo "name=-DCONFIG_ZMK_KEYBOARD_NAME=\\\"${{ matrix.name }}\\\"" >> $GITHUB_ENV
fi
- name: Insert flags into config
if: ${{ matrix.flags }}
shell: bash -x {0}
run: |
echo "flags=${{ matrix.flags }}" >> $GITHUB_ENV
- name: West Build (${{ env.display_name }})
shell: sh -x {0}
run: west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/${{ needs.env-setup.outputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }} ${{ env.name }} ${{env.flags}}

- name: Remove name from config
if: ${{ matrix.name }}
shell: bash -x {0}
run: |
echo "name=" >> $GITHUB_ENV
- name: Remove flags from config
if: ${{ matrix.flags }}
shell: bash -x {0}
run: |
echo "flags=" >> $GITHUB_ENV
- name: ${{ env.display_name }} Kconfig file
run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort

- name: Rename artifacts
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.${{ needs.env-setup.outputs.fallback_binary }} ]
then
cp build/zephyr/zmk.${{ needs.env-setup.outputs.fallback_binary }} "build/artifacts/${{ env.artifact_name }}.${{ needs.env-setup.outputs.fallback_binary }}"
fi
- name: Archive (${{ env.display_name }})
uses: actions/upload-artifact@v3
with:
name: ${{ needs.env-setup.outputs.archive_name }}
path: build/artifacts

- name: Archive (${{ env.display_name }})
uses: actions/upload-artifact@v4
with:
name: artifact-${{ env.artifact_name }}
path: ${{ env.build_dir }}/artifacts

merge:
runs-on: ubuntu-latest
needs: build
name: Merge Output Artifacts
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: ${{ inputs.archive_name }}
pattern: artifact-*
delete-merged: true
uses: zmkfirmware/zmk/.github/workflows/build-user-config.yml@main
23 changes: 1 addition & 22 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,4 @@
# shield: reviung41
#
---
include:
- board: nrfmicro_13
shield: [jorne_left, jorne_right]
name: ["Jorne Blues", "Jorne Brass"]
flags: ["screen"]
- board: nrfmicro_13_52833
shield: [jorne_left, jorne_right]
name: ["Sporne"]
flags: ["screen", "no_mono"]
- board: nrfmicro_13_52833
shield: [jorne_left, jorne_right]
name: ["RT-22"]
- board: nrfmicro_13_52833
shield: radpad
- board: [jorian840_left, jorian840_right]
name: ["Jorian840 Omron", "Jorian840 Cobalt", "wEnki44"]
- board: [skean_left, skean_right]
name: ["Skean T1", "Skean Alps", "Skean DG", "Skean MA", "Skean Zilent", "Skean i-Rocks"]
- board: [dao_left, dao_right]
- board: [corneish_zen_v1_left, corneish_zen_v1_right]
- board: seeeduino_xiao_ble
shield: [ergonaut_one_left, ergonaut_one_right]
board: [skean_left, skean_right]
2 changes: 1 addition & 1 deletion config/skean.conf
Original file line number Diff line number Diff line change
@@ -1 +1 @@

CONFIG_ZMK_SLEEP=y
78 changes: 77 additions & 1 deletion config/skean.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,80 @@
* SPDX-License-Identifier: MIT
*/

#include "common_44.keymap"
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/ext_power.h>
#include <dt-bindings/zmk/outputs.h>

#define DEF 0
#define LWR 1
#define RSE 2
#define ADJ 3

&lt { quick-tap-ms = <200>; };
&mt { quick-tap-ms = <200>; };

/ {
keymap {
compatible = "zmk,keymap";

default_layer {
display-name = "MAIN";
// -------------------------------------------------------------------------------------------------
// | ESC | [ | Q | W | E | R | T | | Y | U | I | O | P | ] | BKSP |
// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' |
// | LALT | Z | X | C | V | B | | N | M | , | . | / | \ |
// | CTRL | RSE | LWR | | LWR | RSE | CMD |
bindings = <
&kp ESC &kp LBKT &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp RBKT &kp BSPC
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&mt LALT GRAVE &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp BSLH
&mt LCTRL TILDE &lt RSE LSHFT &lt LWR SPACE &lt LWR RET &lt RSE RSHFT &kp RCMD
>;
};
lower_layer {
display-name = "SYM";
// -----------------------------------------------------------------------------------------
// | | _ | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
// | + | ! | @ | # | $ | % | | ^ | & | * | ( | ) | - |
// | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | |
// | GUI | | SPC | | ENT | | ALT |
bindings = <
&trans &kp UNDER &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &mt RGUI F12
&mt LCTRL PLUS &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp STAR &kp LPAR &kp RPAR &mt RCTRL MINUS
&mt LALT EQUAL &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &trans
&lt ADJ TAB &trans &trans &trans &trans &lt ADJ DEL
>;
};

raise_layer {
display-name = "NUM";
// -----------------------------------------------------------------------------------------
// | | NMLK | / | 7 | 8 | 9 | - | | VOLU| HOME| PRSC| PGUP| SCLK| CLCK| |
// | CTRL | * | 4 | 5 | 6 | + | | MUT | LEFT| UP | RGHT| INS | APP |
// | | 0 | 1 | 2 | 3 | . | | VOLD| END | DOWN| PGDN| PAUS| |
// | | | ADJ | | ADJ | | |
bindings = <
&trans &kp KP_NUM &kp KP_SLASH &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_MINUS &kp C_VOL_UP &kp HOME &kp PSCRN &kp PG_UP &kp SLCK &kp CAPS &trans
&mt LCTRL EQUAL &kp KP_MULTIPLY &kp KP_N4 &kp KP_N5 &kp KP_N6 &kp KP_PLUS &kp C_MUTE &kp LEFT &kp UP &kp RIGHT &kp INS &mt RCTRL K_APP
&trans &kp KP_N0 &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_DOT &kp C_VOL_DN &kp END &kp DOWN &kp PG_DN &kp PAUSE_BREAK &trans
&trans &trans &lt ADJ RET &lt ADJ ESC &trans &trans
>;
};
adjust_layer {
label = "ADJ";
// -----------------------------------------------------------------------------------------
// | RST | BLDR | | | | | | | | | | | | BLDR | RST |
// | BTCLR| BT0 | BT1 | BT2 | BT3 | BT4 | | BT4 | BT3 | BT2 | BT1 | BT0 | BTCLR|
// | | | | | | | | | | | | | |
// | | | | | | | |
bindings = <
&sys_reset &bootloader &none &none &none &none &none &none &none &none &none &none &bootloader &sys_reset
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &bt BT_SEL 4 &bt BT_SEL 3 &bt BT_SEL 2 &bt BT_SEL 1 &bt BT_SEL 0 &bt BT_CLR
&out OUT_TOG &tog GME &ext_power EP_TOG &none &none &none &none &none &none &ext_power EP_TOG &tog GME &out OUT_TOG
&trans &none &trans &trans &none &trans
>;
};
};
};

0 comments on commit 3e61edb

Please sign in to comment.