Skip to content

Commit bd1a202

Browse files
authored
Add basic continuous integration script (#148)
Fixes #144
1 parent bdc120b commit bd1a202

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
# Cancel old workflows for PRs (only the most recent workflow can run).
12+
concurrency:
13+
group: ci-${{ github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
16+
# Avoid workflow-level permissions, instead use job-level permissions.
17+
permissions: {}
18+
19+
jobs:
20+
ubuntu:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- run: ./ci.sh

ci.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
set -ex
3+
4+
has_target() {
5+
rustup target list --installed | grep -q "$1"
6+
}
7+
ensure_target() {
8+
has_target "$1" || rustup target add "$1"
9+
}
10+
cargo_check() {
11+
cargo check "$@"
12+
# TODO: Uncomment once clippy lints are fixed.
13+
# cargo clippy "$@" -- --deny=warnings
14+
}
15+
cargo_test() {
16+
cargo_check --all-targets "$@"
17+
cargo test "$@"
18+
}
19+
20+
cargo_test --features=alloc,experimental-derive
21+
22+
ensure_target thumbv7em-none-eabi
23+
cargo_check --target=thumbv7em-none-eabi --no-default-features
24+
cargo_check --target=thumbv7em-none-eabi --features=alloc,experimental-derive
25+
26+
# TODO: Uncomment once formatting is correct.
27+
# cargo fmt -- --check
28+
29+
# TODO: Uncomment once documentation lints are fixed.
30+
# env RUSTDOCFLAGS='--cfg=docsrs --deny=warnings' cargo doc --no-deps

0 commit comments

Comments
 (0)