Skip to content

Commit 6b96eed

Browse files
Merge branch 'oxibus:main' into feature/inverted-bit-signals
2 parents f6dcb38 + a9424d7 commit 6b96eed

19 files changed

Lines changed: 1634 additions & 295 deletions

.github/workflows/ci.yml

Lines changed: 91 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,106 @@ on:
66
pull_request:
77
workflow_dispatch:
88

9-
env:
10-
CARGO_INCREMENTAL: 0
11-
RUSTUP_MAX_RETRIES: 10
12-
CARGO_NET_RETRY: 10
13-
RUST_BACKTRACE: full
9+
defaults:
10+
run:
11+
shell: bash
1412

1513
jobs:
16-
fmt:
17-
name: Rustfmt
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v6
21-
- run: rustup component add rustfmt
22-
- run: cargo fmt --all -- --check
23-
24-
rust:
25-
name: Rust
14+
test:
15+
name: Test
2616
runs-on: ${{ matrix.os }}
27-
2817
strategy:
29-
fail-fast: false
18+
fail-fast: true
3019
matrix:
31-
os: [ubuntu-latest]
32-
20+
os: [ ubuntu-latest ]
3321
steps:
34-
- name: Checkout repository
35-
uses: actions/checkout@v6
22+
- uses: actions/checkout@v6
3623
with: { submodules: 'recursive' }
24+
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
25+
uses: Swatinem/rust-cache@v2
26+
- uses: taiki-e/install-action@v2
27+
with: { tool: 'just,cargo-binstall' }
28+
- run: just ci-test
3729

38-
- name: Cache cargo registry
39-
uses: actions/cache@v5
40-
with:
41-
path: ~/.cargo/registry
42-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
43-
- name: Cache cargo index
44-
uses: actions/cache@v5
45-
with:
46-
path: ~/.cargo/git
47-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
48-
- name: Cache cargo target dir
49-
uses: actions/cache@v5
30+
test-msrv:
31+
name: Test MSRV
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v6
35+
with: { submodules: 'recursive' }
36+
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
37+
uses: Swatinem/rust-cache@v2
38+
- uses: taiki-e/install-action@v2
39+
with: { tool: 'just' }
40+
- name: Read MSRV
41+
id: msrv
42+
run: echo "value=$(just get-msrv)" >> $GITHUB_OUTPUT
43+
- name: Install MSRV Rust ${{ steps.msrv.outputs.value }}
44+
uses: dtolnay/rust-toolchain@stable
5045
with:
51-
path: target
52-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
46+
toolchain: ${{ steps.msrv.outputs.value }}
47+
- run: just ci_mode=0 ci-test-msrv # Ignore warnings in MSRV
5348

54-
- name: Build
55-
run: cargo build --workspace --all-features --all-targets --verbose
56-
- name: Tests
57-
run: cargo test --workspace --all-features --all-targets --verbose
49+
coverage:
50+
name: Code Coverage
51+
if: github.event_name != 'release'
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v6
55+
with: { submodules: 'recursive' }
56+
- uses: Swatinem/rust-cache@v2
57+
- uses: taiki-e/install-action@v2
58+
with: { tool: 'just,cargo-llvm-cov' }
59+
- name: Generate code coverage
60+
run: just ci-coverage
61+
- name: Upload coverage to Codecov
62+
uses: codecov/codecov-action@v5
63+
with:
64+
token: ${{ secrets.CODECOV_TOKEN }}
65+
files: target/llvm-cov/codecov.info
5866

59-
- name: Install Rust targets we use for embedded
60-
run: rustup target install thumbv7em-none-eabihf
61-
- name: Build for embedded
62-
run: cargo build -p can-embedded --target=thumbv7em-none-eabihf --no-default-features
67+
# This job checks if any of the previous jobs failed or were canceled.
68+
# This approach also allows some jobs to be skipped if they are not needed.
69+
ci-passed:
70+
needs: [ test, test-msrv ]
71+
if: always()
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Result of the needed steps
75+
run: echo "${{ toJSON(needs) }}"
76+
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
77+
run: exit 1
6378

64-
- name: Install clippy
65-
run: rustup component add clippy
66-
- name: Annotate commit with clippy warnings
67-
if: startsWith(matrix.os, 'ubuntu')
68-
run: cargo clippy --workspace --all-features --all-targets
79+
# Release unpublished packages or create a PR with changes
80+
release-plz:
81+
needs: [ ci-passed ]
82+
if: |
83+
always()
84+
&& needs.ci-passed.result == 'success'
85+
&& github.event_name == 'push'
86+
&& github.ref == 'refs/heads/main'
87+
&& github.repository_owner == 'oxibus'
88+
runs-on: ubuntu-latest
89+
permissions:
90+
contents: write
91+
id-token: write
92+
pull-requests: write
93+
concurrency:
94+
group: release-plz-${{ github.ref }}
95+
cancel-in-progress: false
96+
steps:
97+
- uses: actions/checkout@v6
98+
with: { fetch-depth: 0 }
99+
- uses: dtolnay/rust-toolchain@stable
100+
- name: Publish to crates.io if crate's version is newer
101+
uses: release-plz/action@v0.5
102+
id: release
103+
with: { command: release, verbose: 1 }
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
106+
- if: ${{ steps.release.outputs.releases_created == 'false' }}
107+
name: If version is the same, create a PR proposing new version and changelog for the next release
108+
uses: release-plz/action@v0.5
109+
with: { command: release-pr, verbose: 1 }
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ temp/
1010
tmp/
1111
venv/
1212
tests-snapshots/opendbc/**/*.snap
13+
!tests-snapshots/opendbc/**/!error_*.snap
1314
tests-snapshots/opendbc/**/*.rs
1415

1516
# FIXME: This is a library, we may consider removing the lock file

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repos:
2626
- id: trailing-whitespace
2727

2828
- repo: https://github.com/Lucas-C/pre-commit-hooks
29-
rev: v1.5.5
29+
rev: v1.5.6
3030
hooks:
3131
- id: forbid-tabs
3232
- id: remove-tabs

Cargo.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)