Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci(fix): Cargo.toml & add rust build workflows #2

Merged
merged 5 commits into from
May 13, 2024
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
78 changes: 78 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build

on: [push]

# Stops the running workflow of previous pushes
concurrency:
# cancel per workflow
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Lint, test and build rust-${{ matrix.toolchain }} ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
target:
- thumbv7em-none-eabi

runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v4

- name: Rust setup rust-${{ matrix.toolchain }} ${{ matrix.target }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
targets: ${{ matrix.target }}
components: clippy, rustfmt

- id: cache-rust
uses: Swatinem/rust-cache@v2

- name: Lint - rustfmt
run: cargo fmt --all -- --check

- name: Lint - clippy
run: cargo clippy --all --no-deps -- -D warnings

- name: Check
run: cargo check

- name: Test
run: cargo test --verbose --lib --bins --tests --benches --example angle

- name: Add nightly to build docs
run: rustup toolchain install nightly

- name: Build docs with --all-features
env:
RUSTDOCFLAGS: -D warnings --cfg docsrs
run: cargo +nightly doc --no-deps --all-features

test-no_std_fixed:
name: Test no_std_fixed rust-${{ matrix.toolchain }} ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
toolchain:
- nightly
target:
- thumbv7em-none-eabi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
targets: ${{ matrix.target }}
- run: cargo test --verbose --example no_std_fixed

38 changes: 38 additions & 0 deletions .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: MSRV build

on:
push:
# will checkout the default branch `development`
schedule:
# run every Friday at 17:00
- cron: '00 17 * * 5'
# Or ran manually
workflow_dispatch:

# Stops the running workflow of previous pushes
concurrency:
# cancel per workflow
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
RUST_MSRV_VERSION: '1.71'

jobs:
build:
name: Test and build
runs-on: ubuntu-latest

steps:
- name: Rust setup (MSRV)
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_MSRV_VERSION }}

- uses: Swatinem/rust-cache@v2

- name: Checkout
uses: actions/checkout@v4

- run: cargo check
- run: cargo test --verbose --lib --bins --tests --benches --example angle
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ categories = [
"no-std::no-alloc",
]
description = "PID flight stabilization functions. no_std, no-alloc."
documentation = "https://docs.rs/free-flight-stabilization"
edition = "2021"
keywords = [
"automation",
Expand All @@ -25,7 +24,9 @@ keywords = [
]
license = "GPL-3.0"
readme = "README.md"
repository = "https://github.com/AeroRust/free_flight_stabilization"
repository = "https://github.com/AeroRust/free-flight-stabilization"

rust-version = "1.71"

[dependencies]
num-traits = "0.2.18"
Expand All @@ -34,3 +35,7 @@ piddiy = "0.1.1"
[dev-dependencies]
fixed = { version = "1.27.0", features = ["num-traits"] }
libc = "0.2.154"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
File renamed without changes.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#![no_std]
#![deny(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links)]
#![cfg_attr(docsrs, feature(doc_cfg))]

pub mod pid;
pub mod stabilizer;
Expand Down