Skip to content

Commit

Permalink
codegen: Use a docker container for generating keysyms
Browse files Browse the repository at this point in the history
Previously, keysyms were just generated on the host operating system.
This means that the keysyms that are generated varies from system to
system, which is just bad form. This commit makes it so the keysyms are
generated inside of a Docker container, which should make the process
much more reproducible.

Signed-off-by: John Nunley <dev@notgull.net>
  • Loading branch information
notgull committed Oct 25, 2023
1 parent b705222 commit e94ff66
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ env:
CARGO_TERM_COLOR: always

jobs:
codegen:
name: codegen
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: just@1.15.0
- name: Run codegen
run: just
- name: Check for git changes
run: if ! git diff --exit-code; then exit 1; fi

CI:
runs-on: ubuntu-latest
strategy:
Expand Down
10 changes: 8 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@
# limitations under the Licenses.

keysyms:
cargo run --manifest-path keysym-generator/Cargo.toml \
src/automatically_generated.rs
docker container run --rm \
--name keysym_generator \
--mount type=bind,source="$(pwd)",target=/xkeysym \
rust:slim \
sh -c "apt-get update -y && apt-get install x11proto-core-dev -y --no-install-recommends && \
cargo run --manifest-path /xkeysym/keysym-generator/Cargo.toml \
/xkeysym/src/automatically_generated.rs"

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ In addition, this crate contains no unsafe code and is fully compatible with

The Minimum Safe Rust Version for this crate is **1.58.1**.

## Updating Headers

To update the automatically generated keyboard symbols in the
`automatically_generated.rs` file, install [Just] and run `just`. The process
creates a Debian Docker container in order to keep the files consistent, so make
sure Docker is installed first.

[Just]: https://github.com/casey/just

## License

Licensed under either of
Expand Down

0 comments on commit e94ff66

Please sign in to comment.