Skip to content

Commit

Permalink
ci: replace actions-rs, some CI refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsastrix committed Aug 13, 2024
1 parent 0f6a7c2 commit 554e607
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 68 deletions.
115 changes: 47 additions & 68 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
components: rustc, cargo, rust-std
- run: cargo check

check_nostd:
name: Check (no_std)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
- uses: dtolnay/rust-toolchain@stable
with:
command: check
args: --no-default-features
components: rustc, cargo
- run: cargo check --no-default-features

test:
name: Test Suite
Expand All @@ -43,14 +34,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
- uses: dtolnay/rust-toolchain@stable
with:
command: test
components: rustc, cargo, rust-std
- run: cargo test

test_all_features:
name: Test Suite (all features)
Expand All @@ -59,82 +46,74 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
components: rustc, cargo, rust-std
- run: cargo test --all-features

test_nostd:
name: Test Suite (no_std)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
- uses: dtolnay/rust-toolchain@stable
with:
command: test
args: --no-default-features --features openssl
components: rustc, cargo
- run: cargo test --no-default-features --features openssl

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
components: rustfmt
- run: cargo fmt --all -- --check

clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: giraffate/clippy-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
reporter: 'github-check'
clippy_flags: --no-deps --all-features
level: warning
fail_on_error: true

test_coverage:
runs-on: ubuntu-latest
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
with:
command: clean
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustc, rust-std, cargo, llvm-tools
- uses: baptiste0928/cargo-install@v3
with:
crate: grcov
# grcov currently has some compilation issues on newer rust versions due to an outdated dependency.
# This pulls in the branch from https://github.com/mozilla/grcov/pull/1191 in order to fix this.
git: https://github.com/cemoktra/grcov.git
branch: cemoktra/fix-1187
- run: cargo clean
- run: cargo test --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- id: coverage
uses: actions-rs/grcov@v0.1
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- run: mkdir ./target/debug/coverage
- run: zip ./target/debug/coverage/files.zip ./target/debug/deps/dcaf-*.gcda ./target/debug/deps/dcaf-*.gcno
- run: grcov ./target/debug/coverage/files.zip -s . --service-name "Continuous Integration" --commit-sha ${GITHUB_SHA} -t coveralls --branch --ignore-not-existing --ignore "../*" --ignore "/*" --ignore "*/test_helper.rs" -o ./target/debug/coverage/ --token=${COVERALLS_TOKEN}
- name: Coveralls upload
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}
file: ./target/debug/coverage/coveralls
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
clippy::type_complexity
)]
#![cfg_attr(not(feature = "std"), no_std)]

#[macro_use]
extern crate alloc;
#[macro_use]
Expand Down
1 change: 1 addition & 0 deletions src/token/cose/test_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*
* SPDX-License-Identifier: MIT OR Apache-2.0
*/

use core::fmt::Debug;
use std::collections::HashMap;
use std::path::PathBuf;
Expand Down

0 comments on commit 554e607

Please sign in to comment.