Skip to content

Commit

Permalink
Add CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-nitrokey committed Apr 11, 2024
1 parent 10ec252 commit e0f31aa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) Nitrokey GmbH
# SPDX-License-Identifier: CC0-1.0

name: CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: Install Python dependencies
- run: |
python -m pip install toml
- name: Install rust
run: |
rustup show
rustup target add thumbv7em-none-eabihf
rustup target add thumbv8m.main-none-eabi
- name: Execute checks
run: make ci
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ serde_bytes = ["dep:serde_bytes"]

[package.metadata.docs.rs]
features = ["aes-session", "builder", "serde"]

[patch.crates-io]
lpc55-hal = { git = "https://github.com/Nitrokey/lpc55-hal", tag = "v0.3.0-nitrokey.2" }
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
# Copyright (C) 2023 Nitrokey GmbH
# SPDX-License-Identifier: CC0-1.0

GENERATED_FILES := src/se05x/commands.rs README.md

src/se05x/commands.rs: src/se05x/commands.toml generate_commands.py
python generate_commands.py src/se05x/commands.toml src/se05x/commands.rs
rustfmt --edition 2021 src/se05x/commands.rs

.PHONY: verify-commands
verify-commands:
mkdir -p target
python generate_commands.py src/se05x/commands.toml target/commands_diff.rs
rustfmt --edition 2021 target/commands_diff.rs
diff target/commands_diff.rs src/se05x/commands.rs

.PHONY: check
check: src/se05x/commands.rs
cargo c
cargo c --features builder
cargo c --features nrf,nrf-hal-common/52840 --target thumbv7em-none-eabihf
cargo c --features lpc55 --target thumbv8m.main-none-eabi


.PHONY: lint
lint: src/se05x/commands.rs verify-commands
cargo c
cargo fmt --check
cargo clippy
cargo clippy --features nrf,nrf-hal-common/52840 --target thumbv7em-none-eabihf
cargo clippy --features lpc55 --target thumbv8m.main-none-eabi
cargo doc --features aes-session,builder,serde --no-deps

README.md: src/lib.rs Makefile
grep '//!' src/lib.rs |grep -v '//! # ' | sed 's/^...//g' | sed 's/^ //g' > README.md

.PHONY: ci
ci: export RUSTFLAGS=-Dwarnings
ci: export RUSTDOCFLAGS=-Dwarnings
ci: check lint
$(MAKE) --always-make $(GENERATED_FILES)
git diff --exit-code -- $(GENERATED_FILES)

0 comments on commit e0f31aa

Please sign in to comment.