Skip to content

Commit d159047

Browse files
authored
Minimal ci (#3)
- [x] Setup minimal Rust workflow for linting, tests, build - [x] Add a workflow for license / license header checking - [x] Apply fixes for failing actions --------- Signed-off-by: Marvin Gudel <[email protected]>
1 parent 0f946c2 commit d159047

31 files changed

+461
-63
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Lint, Build and Test
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
types: [opened, synchronize, reopened, ready_for_review]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Install Rust (stable) with components
18+
uses: dtolnay/rust-toolchain@stable
19+
with:
20+
components: clippy, rustfmt
21+
- name: Cache cargo registry and build
22+
uses: Swatinem/rust-cache@v2
23+
- name: rustfmt check
24+
run: cargo fmt --all -- --check
25+
- name: clippy (deny warnings)
26+
run: |
27+
cargo clippy --all-targets --all-features -- -D warnings
28+
29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Install Rust (stable) with components
34+
uses: dtolnay/rust-toolchain@stable
35+
- name: Cache cargo registry and build
36+
uses: Swatinem/rust-cache@v2
37+
- name: Cargo Build
38+
run: cargo build --verbose
39+
test:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Install Rust (stable) with components
44+
uses: dtolnay/rust-toolchain@stable
45+
- name: Cache cargo registry and build
46+
uses: Swatinem/rust-cache@v2
47+
- name: Run tests
48+
run: cargo test --all-features --verbose

.github/workflows/license.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: License Check
2+
3+
on: pull_request
4+
5+
jobs:
6+
license:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- name: License Eye Header
11+
uses: apache/[email protected]

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
target/
2+
Cargo.lock

.licenserc.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
header:
2+
license:
3+
spdx-id: Apache-2.0
4+
# No copyright owner until this has been clarified
5+
# copyright-owner: OpenPRoT a Series of LF Projects, LLC
6+
copyright-year: 2025
7+
software-name: pldm-lib
8+
9+
paths:
10+
- '**/*.rs'
11+
12+
comment: on-failure

src/codec.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
// Licensed under the Apache-2.0 license
1+
// Copyright 2025
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
214

315
use zerocopy::{FromBytes, Immutable, IntoBytes};
416

src/error.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
// Licensed under the Apache-2.0 license
1+
// Copyright 2025
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
214

315
#[derive(Debug, Clone, PartialEq)]
416
pub enum PldmError {

src/lib.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
// Licensed under the Apache-2.0 license
1+
// Copyright 2025
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
214

315
#![cfg_attr(target_arch = "riscv32", no_std)]
416

src/message/control.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
// Licensed under the Apache-2.0 license
1+
// Copyright 2025
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
214

315
use crate::error::PldmError;
416
use crate::protocol::base::{
5-
InstanceId, PldmControlCmd, PldmMsgHeader, PldmMsgType, PldmSupportedType,
6-
TransferOperationFlag, TransferRespFlag, PLDM_MSG_HEADER_LEN,
17+
InstanceId, PLDM_MSG_HEADER_LEN, PldmControlCmd, PldmMsgHeader, PldmMsgType, PldmSupportedType,
18+
TransferOperationFlag, TransferRespFlag,
719
};
820
use crate::protocol::version::{PldmVersion, ProtocolVersionStr, Ver32};
921
use zerocopy::{FromBytes, Immutable, IntoBytes};

src/message/firmware_update/activate_fw.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
// Licensed under the Apache-2.0 license
1+
// Copyright 2025
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
214

315
use crate::protocol::base::{
4-
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
16+
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
517
};
618
use crate::protocol::firmware_update::FwUpdateCmd;
719
use zerocopy::{FromBytes, Immutable, IntoBytes};

src/message/firmware_update/apply_complete.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
// Licensed under the Apache-2.0 license
1+
// Copyright 2025
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
214

315
use crate::error::PldmError;
416
use crate::protocol::base::{
5-
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
17+
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
618
};
719
use crate::protocol::firmware_update::{ComponentActivationMethods, FwUpdateCmd};
820
use zerocopy::{FromBytes, Immutable, IntoBytes};

0 commit comments

Comments
 (0)