Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite SQUIRREL #1

Merged
merged 28 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fd72469
BREAKING: start over
headblockhead Aug 2, 2024
0b79128
add basic structure
headblockhead Aug 2, 2024
9bbb90f
feat: add basic structure and logic for consumer control, quantum fun…
headblockhead Aug 3, 2024
1b811d0
feat: add press and release key functions
headblockhead Aug 3, 2024
e6805ed
feat: add testing
headblockhead Aug 4, 2024
9020585
feat: include SQUIRREL in test
headblockhead Aug 4, 2024
bcd4c4a
tests: add test key
headblockhead Aug 5, 2024
8dc385a
feat: add a proper test
headblockhead Aug 17, 2024
f4c5d11
feat: add github workflows and nix checks
headblockhead Aug 17, 2024
1d59e89
fix: reduce large logs from gh action
headblockhead Aug 17, 2024
ca9f0c2
feat: use variable arg functions for key funcs
headblockhead Aug 17, 2024
a66fba6
fix: keyboard_press_release fails
headblockhead Aug 18, 2024
f4c374d
feat: lib .a files as gh action asset
headblockhead Aug 18, 2024
b36f6ff
feat: add more tests, add placeholder for quantum_passthrough_press_r…
headblockhead Aug 18, 2024
5c3a9d4
feat: add expected error testing
headblockhead Aug 18, 2024
a91de9a
fix: linker issues from CMakeLists, quantum_passthrough functions, ad…
headblockhead Aug 19, 2024
f9876ae
fix: quantum_passthrough_press_release failing
headblockhead Aug 20, 2024
5d4365e
feat: add code coverage to tests
headblockhead Aug 20, 2024
f37c611
fix: nix flake check run fails
headblockhead Aug 20, 2024
ad246fc
chore: rename keyboard functions to prepend 'keyboard_'
headblockhead Aug 20, 2024
97665a0
feat: add tests for keyboard_get_keycodes consumer_press_release, add…
headblockhead Aug 20, 2024
79a564b
feat: switch from stdarg to void**, add tests for squirrel_key
headblockhead Aug 20, 2024
f318b5a
feat: add boilerplate and tests for layer_press_release functions
headblockhead Aug 21, 2024
f7c76d4
feat: add tests for layer_press_release
headblockhead Aug 21, 2024
5c100cf
feat: add new tests, and fix the layer functions
headblockhead Aug 21, 2024
d6f611d
fix: check_key failing
headblockhead Aug 21, 2024
b3a3d28
feat: deinit function
headblockhead Aug 21, 2024
02658c3
feat: test copy of key to layer 16, rename init_keyboard to squirrel_…
headblockhead Aug 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build-library.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build with Nix
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix build '.?submodules=1#squirrel'
- uses: actions/upload-artifact@v4
with:
name: libsquirrel.a
path: result/libsquirrel.a

13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Test with Nix
on: [push, pull_request]

jobs:
run-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix flake check
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Nix ignores
result

# CMake ignores
CMakeLists.txt.user
CMakeCache.txt
Expand Down
70 changes: 59 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,62 @@ project(squirrel VERSION 0.0.1 DESCRIPTION "Simplified, runtime-configurable QMK

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Debug/Development build enabled")
# Create files for CCLS
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Autocomplete support
add_compile_options(-Og) # Enable debug optimizations
elseif(CMAKE_BUILD_TYPE STREQUAL "Testing")
message(STATUS "Testing enabled")
include(CTest)
enable_testing()

include_directories(include)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
if(CMAKE_COMPILER_IS_GNUCXX)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
setup_target_for_coverage_gcovr_html(squirrel squirrel_test coverage)
list(APPEND GCOVR_EXCLUDES "tests/")
endif()

add_executable(keyboard_press_release tests/keyboard_press_release.c)
target_link_libraries(keyboard_press_release squirrel)
add_test(NAME keyboard_press_release COMMAND keyboard_press_release)

add_executable(keyboard_modifier_press_release tests/keyboard_modifier_press_release.c)
target_link_libraries(keyboard_modifier_press_release squirrel)
add_test(NAME keyboard_modifier_press_release COMMAND keyboard_modifier_press_release)

add_executable(quantum_passthrough_press_release tests/quantum_passthrough_press_release.c)
target_link_libraries(quantum_passthrough_press_release squirrel)
add_test(NAME quantum_passthrough_press_release COMMAND quantum_passthrough_press_release)

add_executable(keyboard_get_keycodes tests/keyboard_get_keycodes.c)
target_link_libraries(keyboard_get_keycodes squirrel)
add_test(NAME keyboard_get_keycodes COMMAND keyboard_get_keycodes)

add_executable(consumer_press_release tests/consumer_press_release.c)
target_link_libraries(consumer_press_release squirrel)
add_test(NAME consumer_press_release COMMAND consumer_press_release)

add_executable(key tests/key.c)
target_link_libraries(key squirrel)
add_test(NAME key COMMAND key)

add_executable(layer_press_release tests/layer_press_release.c)
target_link_libraries(layer_press_release squirrel)
add_test(NAME layer_press_release COMMAND layer_press_release)

add_executable(consumer_activate_deactivate_get_consumer_code tests/consumer_activate_deactivate_get_consumer_code.c)
target_link_libraries(consumer_activate_deactivate_get_consumer_code squirrel)
add_test(NAME consumer_activate_deactivate_get_consumer_code COMMAND consumer_activate_deactivate_get_consumer_code)

add_executable(keyboard_activate_deactivate_keycode tests/keyboard_activate_deactivate_keycode.c)
target_link_libraries(keyboard_activate_deactivate_keycode squirrel)
add_test(NAME keyboard_activate_deactivate_keycode COMMAND keyboard_activate_deactivate_keycode)

add_executable(keyboard_activate_deactivate_get_modifier tests/keyboard_activate_deactivate_get_modifier.c)
target_link_libraries(keyboard_activate_deactivate_get_modifier squirrel)
add_test(NAME keyboard_activate_deactivate_get_modifier COMMAND keyboard_activate_deactivate_get_modifier)
else()
add_compile_options(-Os) # Enable size optimizations
endif()
Expand All @@ -15,18 +68,13 @@ endif()
add_library(squirrel STATIC
src/squirrel.c
src/squirrel_quantum.c
src/squirrel_keys.c
src/squirrel_constructors.c
src/squirrel_keyboard.c
src/squirrel_key.c
src/squirrel_consumer.c
src/squirrel_init.c
)

target_include_directories(squirrel PRIVATE include)

set_target_properties(squirrel PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(squirrel PROPERTIES PUBLIC_HEADER include/squirrel.h)

# Enable testing
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
message(STATUS "Testing enabled")
add_subdirectory(tests)
endif()

Loading