I'm tired of ZMK toolchain setup in Docker on a new machine (cofiguring west, creating a Docker volume for my zmk-cofig repo folder, updating scripts for my shields and etc).
So I created this example repo that supports the following features:
- Building firmare using Github Actions (like many other repos do)
- [NEW] Run a fully configured ZMK build environment in a local devcontainer with your zmk-config
- [NEW] Run a fully configured ZMK build environment in Github Codespaces with your zmk-config
- [NEW] Scripts for building firmware for your shields with one terminal command
- Fork this repo
- Add your shields' configurations to
/config/shieldsfolder (if you don't use preconfigured ZMK shields)
- Add all board+shield pairs that you want to build in a CI
- If you want, tune
.github/workflows/build.ymlworkflow - Push updates of your configs to the repo
- Go to
Actionssection of your repo - Open
Buildworkflow - Download
firmawe.ziparchive fromArtifactssection
Out of the box Action is triggered by new commits in main branch and opened/reopened PRs.
Tested on Windows 10 with WSL2 and VS Code.
This devcontainer is preconfigured to clone and setup ZMK installation within the container and update sources during the launching process. You can edit configuration in .devcontainer/devcontainer.json
- Clone you repo locally
- Open repo folder in VS Code (JetBrains IDEs not tested)
- Open Command Palette (Ctrl+Shift+P) and run
Dev Containers: Open Folder in Container...or click on a prompt in the bottom-right corner of the VS Code window - Wait until the building process is complete
- Open a new terminal and run the build script (see the next sections)
You can develop ZMK FW in a web-browser or in VS Code without local environment setup.
- Create Codespace according to this instruction (I have already put a devcontainer configuration into the repo)
- Open Codespace in a web-browser or in VS Code (Command Palette (Ctrl+Shift+P)
Connect to Codespace...) - Wait until the building process is complete
- Open a new terminal and run the build script (see the next sections)
Scripts are located in .devcontainer/.bashrc and are automatically loaded on the container build stage.
Define your function like this:
build-test(){
base-build nrfmicro_13 test-board
}
Where:
- build-test - name of a function
- nrfmicro_13 - board name
- test-board - shield name
Then you can start building by running the function by its name (build-test for example) in a terminal inside the container.
Compiled UF2 files are located in build folder.
Also you can start building by passing board and shield names as parameters to base-build function
base-build nrfmicro_13 test-board
If you update .bashrc then you should run Rebuild container in Command Palette (Ctrl+Shift+P)