Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into masked-mod-morphs-unt…
Browse files Browse the repository at this point in the history
…ested
  • Loading branch information
vrinek committed Jun 27, 2022
2 parents 2cac694 + ef3eb33 commit e96f516
Show file tree
Hide file tree
Showing 725 changed files with 25,927 additions and 30,565 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/zmkfirmware/zmk-dev-arm:2.5
FROM docker.io/zmkfirmware/zmk-dev-arm:3.0

COPY .bashrc tmp
RUN mv /tmp/.bashrc ~/.bashrc
131 changes: 131 additions & 0 deletions .github/workflows/build-user-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Reusable user config build

on:
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
artifact_name:
description: 'Artifact output file name'
default: 'firmware'
required: false
type: string

jobs:
matrix:
runs-on: ubuntu-latest
name: Fetch Build Keyboards
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v2

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

- name: Fetch Build Matrix
id: set-matrix
run: |
set -x
matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .)
yaml2json ${{ inputs.build_matrix_path }}
echo "::set-output name=matrix::${matrix}"
build:
runs-on: ubuntu-latest
container:
image: zmkfirmware/zmk-build-arm:stable
needs: matrix
name: Build
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
steps:
- name: Prepare variables
id: variables
run: |
set -x
if [ -n "${{ matrix.shield }}" ]
then
EXTRA_CMAKE_ARGS="-DSHIELD=${{ matrix.shield }}"
ARTIFACT_NAME="${{ matrix.shield }}-${{ matrix.board }}-zmk"
DISPLAY_NAME="${{ matrix.shield }} - ${{ matrix.board }}"
else
EXTRA_CMAKE_ARGS=
DISPLAY_NAME="${{ matrix.board }}"
ARTIFACT_NAME="${{ matrix.board }}-zmk"
fi
echo ::set-output name=extra-cmake-args::${EXTRA_CMAKE_ARGS}
echo ::set-output name=artifact-name::${ARTIFACT_NAME}
echo ::set-output name=display-name::${DISPLAY_NAME}
echo ::set-output name=zephyr-version::${ZEPHYR_VERSION}
- name: Checkout
uses: actions/checkout@v2

- name: Cache west modules
uses: actions/[email protected]
continue-on-error: true
env:
cache-name: cache-zephyr-${{ steps.variables.outputs.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 ${{ inputs.config_path }}

- name: West Update
run: west update

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

- name: West Build (${{ steps.variables.outputs.display-name }})
run: |
set -x
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 }} Kconfig file
run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort

- name: Rename artifacts
run: |
set -x
mkdir build/artifacts
if [ -f build/zephyr/zmk.uf2 ]
then
cp build/zephyr/zmk.uf2 "build/artifacts/${{ steps.variables.outputs.artifact-name }}.uf2"
elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ]
then
cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ steps.variables.outputs.artifact-name }}.${{ inputs.fallback_binary }}"
fi
- name: Archive (${{ steps.variables.outputs.display-name }})
uses: actions/upload-artifact@v2
with:
name: ${{ inputs.artifact_name }}
path: build/artifacts
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
if: ${{ always() }}
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-build-arm:2.5
image: docker.io/zmkfirmware/zmk-build-arm:3.0
needs: compile-matrix
strategy:
matrix:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Cache west modules
uses: actions/cache@v2
uses: actions/cache@v3.0.2
env:
cache-name: cache-zephyr-modules
with:
Expand Down Expand Up @@ -249,7 +249,7 @@ jobs:
}
break;
case "interconnect":
break;
return [];
}
});
}))).flat();
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hardware-metadata-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
validate-metadata:
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-dev-arm:2.5
image: docker.io/zmkfirmware/zmk-dev-arm:3.0
steps:
- uses: actions/checkout@v2
- name: Install dependencies
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,32 @@ on:
- "app/src/**"

jobs:
integration_test:
collect-tests:
outputs:
test-dirs: ${{ steps.test-dirs.outputs.test-dirs }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Find test directories
id: test-dirs
run: |
cd app/tests/
export TESTS=$(ls -d * | jq -R -s -c 'split("\n")[:-1]')
echo "::set-output name=test-dirs::${TESTS}"
run-tests:
needs: collect-tests
strategy:
matrix:
test: ${{ fromJSON(needs.collect-tests.outputs.test-dirs) }}
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-build-arm:2.5
image: docker.io/zmkfirmware/zmk-build-arm:3.0
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache west modules
uses: actions/cache@v2
uses: actions/cache@v3.0.2
env:
cache-name: cache-zephyr-modules
with:
Expand All @@ -43,8 +60,9 @@ jobs:
run: west update
- name: Export Zephyr CMake package (west zephyr-export)
run: west zephyr-export
- name: Test all
run: west test
- name: Test ${{ matrix.test }}
working-directory: app
run: west test tests/${{ matrix.test }}
- name: Archive artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v2
Expand Down
60 changes: 33 additions & 27 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
cmake_minimum_required(VERSION 3.13.1)

set(CONFIG_APPLICATION_DEFINED_SYSCALL true)
list(APPEND BOARD_ROOT ${CMAKE_SOURCE_DIR})
list(APPEND DTS_ROOT ${CMAKE_SOURCE_DIR})

# Add our custom Zephyr module for drivers w/ syscalls, etc.
list(APPEND DTS_ROOT ${CMAKE_SOURCE_DIR}/drivers/zephyr)

set(ZephyrBuildConfiguration_ROOT ${CMAKE_SOURCE_DIR}/cmake)

list(APPEND ZEPHYR_EXTRA_MODULES
${CMAKE_CURRENT_SOURCE_DIR}/drivers
)

include(cmake/zmk_config.cmake)

# Find Zephyr. This also loads Zephyr's build system.
find_package(Zephyr REQUIRED HINTS ../zephyr)
project(zmk)
Expand All @@ -22,63 +20,71 @@ zephyr_linker_sources(RODATA include/linker/zmk-events.ld)
# Add your source file to the "app" target. This must come after
# find_package(Zephyr) which defines the target.
target_include_directories(app PRIVATE include)
target_sources_ifdef(CONFIG_ZMK_SLEEP app PRIVATE src/power.c)
target_sources(app PRIVATE src/stdlib.c)
target_sources(app PRIVATE src/activity.c)
target_sources(app PRIVATE src/kscan.c)
target_sources(app PRIVATE src/matrix_transform.c)
target_sources(app PRIVATE src/hid.c)
target_sources(app PRIVATE src/sensors.c)
target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/wpm.c)
target_sources(app PRIVATE src/event_manager.c)
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/ext_power_generic.c)
target_sources(app PRIVATE src/events/activity_state_changed.c)
target_sources(app PRIVATE src/events/position_state_changed.c)
target_sources(app PRIVATE src/events/layer_state_changed.c)
target_sources(app PRIVATE src/events/keycode_state_changed.c)
target_sources(app PRIVATE src/events/modifiers_state_changed.c)
target_sources(app PRIVATE src/events/endpoint_selection_changed.c)
target_sources(app PRIVATE src/events/sensor_event.c)
target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/events/wpm_state_changed.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/ble_active_profile_changed.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c)
target_sources_ifdef(CONFIG_USB app PRIVATE src/events/usb_conn_state_changed.c)
target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/events/usb_conn_state_changed.c)
target_sources(app PRIVATE src/behaviors/behavior_reset.c)
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/behaviors/behavior_ext_power.c)
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
target_sources(app PRIVATE src/hid.c)
target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_KEY_TOGGLE app PRIVATE src/behaviors/behavior_key_toggle.c)
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
target_sources(app PRIVATE src/behaviors/behavior_sticky_key.c)
target_sources(app PRIVATE src/behaviors/behavior_caps_word.c)
target_sources(app PRIVATE src/behaviors/behavior_key_repeat.c)
target_sources(app PRIVATE src/behaviors/behavior_macro.c)
target_sources(app PRIVATE src/behaviors/behavior_momentary_layer.c)
target_sources(app PRIVATE src/behaviors/behavior_mod_morph.c)
target_sources(app PRIVATE src/behaviors/behavior_outputs.c)
target_sources(app PRIVATE src/behaviors/behavior_tap_dance.c)
target_sources(app PRIVATE src/behaviors/behavior_toggle_layer.c)
target_sources(app PRIVATE src/behaviors/behavior_to_layer.c)
target_sources(app PRIVATE src/behaviors/behavior_transparent.c)
target_sources(app PRIVATE src/behaviors/behavior_none.c)
target_sources(app PRIVATE src/behaviors/behavior_sensor_rotate_key_press.c)
target_sources(app PRIVATE src/combo.c)
target_sources(app PRIVATE src/behavior_queue.c)
target_sources(app PRIVATE src/conditional_layer.c)
target_sources(app PRIVATE src/endpoints.c)
target_sources(app PRIVATE src/events/endpoint_selection_changed.c)
target_sources(app PRIVATE src/hid_listener.c)
target_sources(app PRIVATE src/keymap.c)
target_sources(app PRIVATE src/events/layer_state_changed.c)
target_sources(app PRIVATE src/events/modifiers_state_changed.c)
target_sources(app PRIVATE src/events/keycode_state_changed.c)

if (CONFIG_ZMK_BLE)
target_sources(app PRIVATE src/events/ble_active_profile_changed.c)
target_sources(app PRIVATE src/behaviors/behavior_bt.c)
target_sources(app PRIVATE src/ble.c)
target_sources(app PRIVATE src/hog.c)
endif()
endif()

target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/behaviors/behavior_rgb_underglow.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/behaviors/behavior_bt.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble.c)
target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/behaviors/behavior_backlight.c)

target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/battery.c)
if (CONFIG_ZMK_SPLIT_BLE AND (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
target_sources(app PRIVATE src/split_listener.c)
target_sources(app PRIVATE src/split/bluetooth/service.c)
endif()
if (CONFIG_ZMK_SPLIT_BLE AND CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
target_sources(app PRIVATE src/split/bluetooth/central.c)
endif()
target_sources_ifdef(CONFIG_USB app PRIVATE src/usb.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c)

target_sources_ifdef(CONFIG_ZMK_SPLIT app PRIVATE src/events/split_peripheral_status_changed.c)
add_subdirectory(src/split)

target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/usb.c)
target_sources_ifdef(CONFIG_ZMK_USB app PRIVATE src/usb_hid.c)
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)
target_sources(app PRIVATE src/endpoints.c)
target_sources(app PRIVATE src/hid_listener.c)
target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/backlight.c)
target_sources(app PRIVATE src/main.c)

add_subdirectory(src/display/)
Expand Down
Loading

0 comments on commit e96f516

Please sign in to comment.