Repository navigation
72 lines (58 loc) · 1.96 KB
/
Copy pathci.yml
File metadata and controls
72 lines (58 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: CI
on:
push:
branches: [master]
tags: ["v*"]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: fmt · clippy · build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: rustfmt
run: cargo fmt --check
- name: clippy
run: cargo clippy --all-targets -- -D warnings
- name: build
run: cargo build --locked
- name: test
run: cargo test --locked
- name: Smoke-test the bundled keyboard.toml
run: |
set -euo pipefail
test "$(cargo run --quiet -- get-chip --keyboard-toml-path keyboard.toml)" = "nrf52840"
test "$(cargo run --quiet -- get-project-name --keyboard-toml-path keyboard.toml)" = "RMK_Keyboard"
publishable:
name: publishable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# A git dependency blocks `cargo publish`, but the rev pin is deliberate
# between RMK releases (see Cargo.toml), so only fail on release tags.
- name: Check for git dependencies
id: git_deps
run: |
if grep -q 'source = "git+' Cargo.lock; then
grep -n 'source = "git+' Cargo.lock
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "::error::Cargo.lock contains a git dependency; rmkit cannot be published."
exit 1
fi
echo "::warning::Cargo.lock contains a git dependency; switch back to crates.io before releasing."
echo "present=true" >> "$GITHUB_OUTPUT"
fi
- name: cargo publish --dry-run
if: steps.git_deps.outputs.present != 'true'
run: cargo publish --dry-run --locked