Skip to content

Commit

Permalink
Merge pull request #2 from hixan/update-master-2023-11-26
Browse files Browse the repository at this point in the history
Update master 2023 11 26
  • Loading branch information
hixan authored Nov 25, 2023
2 parents b7126c1 + f404c70 commit 27bdfd6
Show file tree
Hide file tree
Showing 313 changed files with 9,863 additions and 2,443 deletions.
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"features": {
"ghcr.io/devcontainers/features/python:1": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sudo apt update; sudo apt install -y aspell"

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG] Title"
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
* Setup and configuration of the affected parts of the firmware (avoid copy-pasting the entire configuration if possible)
* Setup and configuration of peripherals
* Input: keys pressed, ...
(Choose which are applicable.)

**Expected behavior**
A clear and concise description of what you expected to happen.

**Debug output**
If applicable, add debug output from the serial console to help explain your problem.

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
blank_issues_enabled: false
contact_links:
- name: Question / Discussion
url: https://kmkfw.zulipchat.com/#narrow/stream/358347-general
about: Chat with KMK peeps and get support.
- name: Feature Requests
url: https://kmkfw.zulipchat.com/#narrow/stream/360458-feature-requests
about: Feel like something is missing? Tell us about it!
- name: Hardware / Drivers
url: https://kmkfw.zulipchat.com/#narrow/stream/370377-drivers-and-hardware
about: Something is not working on a hardware level? Get help here.
- name: Development help
url: https://kmkfw.zulipchat.com/#narrow/stream/384078-KMK-development
about: Trying to implement something cool but got stuck? Ask here!
- name: Showcase
url: https://kmkfw.zulipchat.com/#narrow/stream/377887-showcase
about: Show us what you made with KMK! Or look at what others are doing.
- name: Documentation
url: https://github.com/KMKfw/kmk_firmware/tree/master/docs/en
about: Official KMK documentation
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Enhancement] Title"
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
46 changes: 46 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build
on:
push:
branches: ['main', 'master']
paths:
- 'kmk/**'
env:
mpy-cross-path: "https://adafruit-circuit-python.s3.amazonaws.com/bin/mpy-cross/"
mpy-cross-name: "mpy-cross.static-amd64-linux-"
mpy-cross-8-release: "8.0.5"
jobs:
Compile:
runs-on: ubuntu-latest
steps:
- run: echo "A ${{ github.event_name }} event trigged build of branch ${{ github.ref }}, repository ${{ github.repository }}"
- name: Check out repository code
uses: actions/checkout@v3

- name: Cache mpy-cross
id: cache-mpy-cross
uses: actions/cache@v3
env:
cache-name: cache-mpy-cross-8
with:
path: ${{ github.workspace }}/mpy-cross
key: ${{ env.mpy-cross-name }}${{ env.mpy-cross-8-release }}
- if: ${{ steps.cache-mpy-cross.outputs.cache-hit != 'true' }}
name: install mpy-cross
run: |
wget --no-verbose "${{ env.mpy-cross-path }}${{ env.mpy-cross-name }}${{ env.mpy-cross-8-release }}" -O ${{ github.workspace }}/mpy-cross; \
chmod +x ${{ github.workspace }}/mpy-cross
- name: get short git sha
id: sha
run: echo "SHA=`git rev-parse --short HEAD`" >> $GITHUB_OUTPUT

- name: compile
run: PATH=.:$PATH make compile
- name: List build dir
run: |
ls -la .compiled/kmk/
- name: upload zip
uses: actions/upload-artifact@v3
with:
name: kmk-${{ steps.sha.outputs.SHA }}+mpy-cross-${{ env.mpy-cross-8-release }}
path: .compiled/kmk/
13 changes: 13 additions & 0 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Spellcheck
on:
push:
paths:
- '**.md'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo apt-get install aspell
- run: make spellcheck
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9' # Version range or exact version of a Python version to use, using SemVer's version range syntax
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- run: python -m pip install --upgrade pipenv wheel
- run: make test
92 changes: 42 additions & 50 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ TIMESTAMP := $(shell date +%s)

all: copy-kmk copy-bootpy copy-keymap copy-board

compile: $(MPY_TARGET_DIR)/.mpy.compiled

$(MPY_TARGET_DIR)/.mpy.compiled: $(PY_KMK_TREE)
.PHONY: compile compile-check
compile: compile-check
ifeq ($(MPY_CROSS),)
compile-check:
@echo "===> Could not find mpy-cross in PATH, exiting"
@false
endif
else
compile-check: $(PY_KMK_TREE:%.py=$(MPY_TARGET_DIR)/%.mpy)
@echo "===> Compiling all py files to mpy with flags $(MPY_FLAGS)"
@mkdir -p $(MPY_TARGET_DIR)
@echo "KMK_RELEASE = '$(DIST_DESCRIBE)'" > $(MPY_SOURCES)/release_info.py
@find $(MPY_SOURCES) -name "*.py" -exec sh -c 'mkdir -p $(MPY_TARGET_DIR)/$$(dirname {}) && $(MPY_CROSS) $(MPY_FLAGS) {} -o $(MPY_TARGET_DIR)/$$(dirname {})/$$(basename -s .py {}).mpy' \;
@rm -rf $(MPY_SOURCES)/release_info.py
@touch $(MPY_TARGET_DIR)/.mpy.compiled
$(MPY_TARGET_DIR)/%.mpy: %.py
@mkdir -p $(dir $@)
@$(MPY_CROSS) $(MPY_FLAGS) $? -o $@
endif

.devdeps: Pipfile.lock
@echo "===> Installing dependencies with pipenv"
Expand All @@ -64,6 +64,9 @@ dockerbase:
lint: devdeps
@$(PIPENV) run flake8

spellcheck:
./util/spellcheck.sh --no-interactive

fix-formatting: devdeps
@$(PIPENV) run black .

Expand Down Expand Up @@ -92,7 +95,7 @@ test: lint unit-tests

.PHONY: unit-tests
unit-tests: devdeps
@$(PIPENV) run python3 -m unittest
@$(PIPENV) run python3 -m unittest $(TESTS)

reset-bootloader:
@echo "===> Rebooting your board to bootloader (safe to ignore file not found errors)"
Expand All @@ -102,55 +105,44 @@ reset-board:
@echo "===> Rebooting your board (safe to ignore file not found errors)"
@-timeout -k 5s 10s $(PIPENV) run ampy -p /dev/ttyACM0 -d ${AMPY_DELAY} -b ${AMPY_BAUD} run util/reset.py

ifdef MOUNTPOINT
$(MOUNTPOINT)/kmk/.copied: $(shell find kmk/ -name "*.py" | xargs -0)
@echo "===> Copying KMK source folder"
@rsync -rh kmk $(MOUNTPOINT)/
@touch $(MOUNTPOINT)/kmk/.copied
@sync

copy-kmk: $(MOUNTPOINT)/kmk/.copied
else
copy-kmk:
echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1
endif

copy-board: $(MOUNTPOINT)/kb.py
$(MOUNTPOINT)/kb.py: $(BOARD)
@echo "===> Copying your board to kb.py"
@rsync -rh $(BOARD) $@
ifdef MOUNTPOINT
ifdef BOARD
copy-board:
@echo "===> Copying your board from $(BOARD) to $(MOUNTPOINT)"
@rsync -rhu $(BOARD)/*.py $(MOUNTPOINT)/
@sync
else # BOARD
copy-board:
@echo "**** Missing BOARD argument ****" && exit 1
endif # BOARD

ifdef MOUNTPOINT
$(MOUNTPOINT)/kmk/boot.py: boot.py
copy-bootpy:
@echo "===> Copying required boot.py"
@rsync -rh boot.py $(MOUNTPOINT)/
@rsync -rhu boot.py $(MOUNTPOINT)/boot.py
@sync

copy-bootpy: $(MOUNTPOINT)/kmk/boot.py
else
copy-bootpy:
echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1
endif
copy-compiled:
@echo "===> Copying compiled KMK folder"
@rsync -rhu $(MPY_TARGET_DIR)/* $(MOUNTPOINT)/
@sync

ifdef MOUNTPOINT
ifndef USER_KEYMAP
$(MOUNTPOINT)/main.py:
@echo "**** USER_KEYMAP must be defined (ex. USER_KEYMAP=user_keymaps/noop.py) ****" && exit 1
else
$(MOUNTPOINT)/main.py: $(USER_KEYMAP)
ifdef USER_KEYMAP
copy-keymap:
@echo "===> Copying your keymap to main.py"
@rsync -rh $(USER_KEYMAP) $@
@rsync -rhu $(USER_KEYMAP) $(MOUNTPOINT)/main.py
@sync
endif # USER_KEYMAP

copy-keymap: $(MOUNTPOINT)/main.py
else
else # USER_KEYMAP
copy-keymap:
echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1
@echo "**** Missing USER_KEYMAP argument ****" && exit 1
endif # USER_KEYMAP

ifdef BOARD
copy-board: $(MOUNTPOINT)/kb.py
endif # BOARD
copy-kmk:
@echo "===> Copying KMK source folder"
@rsync -rhu kmk $(MOUNTPOINT)/
@sync

endif # MOUNTPOINT
else # MOUNTPOINT
copy-board copy-bootpy copy-compiled copy-keymap copy-kmk:
@echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1
endif # ifndef MOUNTPOINT
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "pypi"
[packages]

[dev-packages]
"flake8" = ">=3.9.0"
"flake8" = "==6.0.0"
"flake8-commas" = "*"
"flake8-comprehensions" = "*"
"flake8-isort" = "*"
Expand All @@ -17,6 +17,6 @@ ipython = "*"
isort = "*"
neovim = "*"
s3cmd = "*"
black = "==21.6b0"
black = "==22.3.0"
flake8-quotes = "*"
flake8-black = "*"
Loading

0 comments on commit 27bdfd6

Please sign in to comment.