Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches: [master]
pull_request:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
check:
name: fmt · clippy · build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: rustfmt
run: cargo fmt --check

- name: clippy
run: cargo clippy --all-targets -- -D warnings

- name: build
run: cargo build --locked

- name: test
run: cargo test --locked

- name: Smoke-test the bundled keyboard.toml
run: |
set -euo pipefail
test "$(cargo run --quiet -- get-chip --keyboard-toml-path keyboard.toml)" = "nrf52840"
test "$(cargo run --quiet -- get-project-name --keyboard-toml-path keyboard.toml)" = "RMK_Keyboard"

publishable:
name: publishable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

# A git dependency silently blocks `cargo publish`, and the failure only
# surfaces at release time. Catch it on every PR instead.
- name: Reject git dependencies
run: |
if grep -q 'source = "git+' Cargo.lock; then
echo "::error::Cargo.lock contains a git dependency; rmkit cannot be published."
grep -n 'source = "git+' Cargo.lock
exit 1
fi

- name: cargo publish --dry-run
run: cargo publish --dry-run --locked
89 changes: 89 additions & 0 deletions .github/workflows/upstream-drift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Upstream drift

# rmkit hardcodes a handful of assumptions about RMK: the keyboard.toml schema
# it parses, the cargo feature names it writes into generated projects, and the
# chips it offers. None of that is enforced by the compiler, so it rots
# silently whenever RMK moves. This job checks those assumptions against
# upstream every day and files an issue when they stop holding.
#
# It deliberately does not run on pull requests: it can go red because upstream
# changed overnight, which has nothing to do with the PR under review. Add
# `pull_request:` below if you would rather gate on it.

on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:

permissions:
contents: read
issues: write

env:
ISSUE_LABEL: upstream-drift
ISSUE_TITLE: "Upstream drift: rmkit's assumptions about RMK no longer hold"

jobs:
drift:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Check for drift
id: check
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
python3 scripts/check_upstream_drift.py 2>&1 | tee report.txt

- name: Compose issue body
if: steps.check.outcome == 'failure'
run: |
{
echo "The daily upstream check found that rmkit no longer matches RMK."
echo
echo "\`\`\`"
cat report.txt
echo "\`\`\`"
echo
echo "Reproduce locally with \`python3 scripts/check_upstream_drift.py\`."
echo
echo "_Updated by [\`${GITHUB_WORKFLOW}\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})._"
} > body.md

- name: Open or update the drift issue
if: steps.check.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
gh label create "$ISSUE_LABEL" --description "rmkit has drifted from upstream RMK" --color D93F0B 2>/dev/null || true
existing=$(gh issue list --label "$ISSUE_LABEL" --state open --limit 1 --json number --jq '.[0].number // empty')
if [ -n "$existing" ]; then
# Keep a single always-current issue rather than commenting daily.
gh issue edit "$existing" --body-file body.md
echo "Updated issue #$existing"
else
gh issue create --title "$ISSUE_TITLE" --label "$ISSUE_LABEL" --body-file body.md
fi

- name: Close the drift issue once it clears
if: steps.check.outcome == 'success'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
existing=$(gh issue list --label "$ISSUE_LABEL" --state open --limit 1 --json number --jq '.[0].number // empty')
if [ -n "$existing" ]; then
gh issue close "$existing" --comment "rmkit matches upstream again; closed automatically."
fi

- name: Propagate the result
if: steps.check.outcome == 'failure'
run: exit 1
22 changes: 13 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rmkit"
version = "0.0.21"
version = "0.1.0"
edition = "2021"
homepage = "https://github.com/rmk-rs/rmkit"
repository = "https://github.com/rmk-rs/rmkit"
Expand All @@ -9,11 +9,13 @@ description = "rmkit is a toolkit set for RMK keyboard firmware"
license = "Apache-2.0"

[dependencies]
# TODO: back to crates.io versions (rmk-config = "0.7", rynk-kle) once they are
# published — a git dependency cannot be published.
rmk-config = { git = "https://github.com/rmk-rs/rmk", rev = "93726512f2fb383cdb5a419b09ff181c7c123b5f" }
# Pins the `keyboard.toml` schema rmkit understands: 0.8.0 is the config crate
# RMK 0.9.0 ships. Bump it in lockstep with each RMK release, since the structs
# are `deny_unknown_fields` and reject keys added by later versions.
rmk-config = "0.8.0"
# The KLE/Vial ↔ [layout] conversion engine; `rmkit layout` is CLI glue over it.
rynk-kle = { git = "https://github.com/rmk-rs/rmk", rev = "93726512f2fb383cdb5a419b09ff181c7c123b5f" }
# Its 0.3.0 pins rmk-config =0.8.0, so the two must move together.
rynk-kle = "0.3.0"
clap = { version = "4.5.23", features = ["derive", "string"] }
toml = "0.9.8"
serde = "1.0"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Now rmkit can be used to generate RMK project directly from `keyboard.toml` and
rmkit create --keyboard-toml-path keyboard.toml --vial-json-path vial.json
```

A `Cargo.toml` or `memory.x` next to `keyboard.toml` replaces the template's copy as-is — use it to add Cargo features, pin dependencies, or change the flash layout. When you provide `Cargo.toml`, rmkit no longer adjusts the `rmk` features for you.

3. Or, you can create RMK project from project template

```
Expand Down
Loading
Loading