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

Add basic continuous integration script #148

Merged
merged 1 commit 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
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

# Cancel old workflows for PRs (only the most recent workflow can run).
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

# Avoid workflow-level permissions, instead use job-level permissions.
permissions: {}

jobs:
ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./ci.sh
30 changes: 30 additions & 0 deletions ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
set -ex

has_target() {
rustup target list --installed | grep -q "$1"
}
ensure_target() {
has_target "$1" || rustup target add "$1"
}
cargo_check() {
cargo check "$@"
# TODO: Uncomment once clippy lints are fixed.
# cargo clippy "$@" -- --deny=warnings
}
cargo_test() {
cargo_check --all-targets "$@"
cargo test "$@"
}

cargo_test --features=alloc,experimental-derive

ensure_target thumbv7em-none-eabi
cargo_check --target=thumbv7em-none-eabi --no-default-features
cargo_check --target=thumbv7em-none-eabi --features=alloc,experimental-derive

# TODO: Uncomment once formatting is correct.
# cargo fmt -- --check

# TODO: Uncomment once documentation lints are fixed.
# env RUSTDOCFLAGS='--cfg=docsrs --deny=warnings' cargo doc --no-deps