Skip to content

Commit

Permalink
separate fmt and clippy ymls
Browse files Browse the repository at this point in the history
  • Loading branch information
brenzi committed Jun 3, 2024
1 parent 13a4cb1 commit e6c1a5d
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:
rust: [ nightly-2024-04-14 ]
rust-target: [ x86_64-unknown-linux-gnu ]
# check: [fmt --all -- --check, clippy -- -D warnings]
check: [ +nightly fmt --all -- --check, check --features runtime-benchmarks ] # skip clippy for now
check: [ check --features runtime-benchmarks ] # skip clippy for now
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Clippy

on:
push:
paths:
- 'polkadot-parachains/integritee-runtime/**'
pull_request:
paths:
- 'polkadot-parachains/integritee-runtime/**'

# cancel previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
shared-key: "parachain-cache-clippy"
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path polkadot-parachains/integritee-runtime/Cargo.toml
env:
# RUSTFLAGS: "-D warnings" # FAIL-CI
SKIP_WASM_BUILD: 1
34 changes: 34 additions & 0 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Rustfmt (check)"

on:
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-dev*'
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
verbose:
description: "Set --verbose to get verbose build output"
required: false
default: 'true'

jobs:
rustfmt:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install nightly toolchain
run: rustup toolchain install "nightly-$RUST_NIGHTLY_VERSION" --profile minimal --component rustfmt

- name: Rustfmt (check)
run: cargo +nightly-$RUST_NIGHTLY_VERSION fmt --all -- --check
2 changes: 1 addition & 1 deletion polkadot-parachains/integritee-runtime/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/// Usage:
/// ```Rust
/// parameter_types! {
/// pub const VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES);
/// pub const VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES);
/// }
#[macro_export]
macro_rules! prod_or_fast {
Expand Down
16 changes: 8 additions & 8 deletions polkadot-parachains/integritee-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub use integritee_parachains_common::{
use pallet_asset_conversion::{Ascending, Chain, WithFirstAsset};
pub use pallet_balances::Call as BalancesCall;
pub use pallet_claims;
use pallet_collective;
pub use pallet_collective;
pub use pallet_enclave_bridge;
pub use pallet_sidechain;
pub use pallet_teeracle;
Expand Down Expand Up @@ -385,7 +385,7 @@ impl pallet_proxy::Config for Runtime {
}

parameter_types! {
pub const MinVestedTransfer: Balance = 1 * TEER;
pub const MinVestedTransfer: Balance = TEER;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}
Expand Down Expand Up @@ -429,7 +429,7 @@ impl pallet_utility::Config for Runtime {
}

parameter_types! {
pub const PreimageBaseDeposit: Balance = 1 * TEER;
pub const PreimageBaseDeposit: Balance = TEER;
pub const PreimageByteDeposit: Balance = deposit(0, 1);
pub const PreimageHoldReason: RuntimeHoldReason =
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
Expand Down Expand Up @@ -595,7 +595,7 @@ pub struct NoConversion;
impl ConversionFromAssetBalance<u128, (), u128> for NoConversion {
type Error = ();
fn from_asset_balance(balance: Balance, _asset_id: ()) -> Result<Balance, Self::Error> {
return Ok(balance)
Ok(balance)
}
#[cfg(feature = "runtime-benchmarks")]
fn ensure_successful(_: ()) {}
Expand Down Expand Up @@ -629,12 +629,12 @@ impl pallet_treasury::Config for Runtime {
}

parameter_types! {
pub const BountyDepositBase: Balance = 1 * TEER;
pub const BountyDepositBase: Balance = TEER;
pub const BountyDepositPayoutDelay: BlockNumber = prod_or_fast!(4 * DAYS, 4 * MINUTES);
pub const BountyUpdatePeriod: BlockNumber = prod_or_fast!(90 * DAYS, 15 * MINUTES);
pub const MaximumReasonLength: u32 = 16384;
pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50);
pub const CuratorDepositMin: Balance = 1 * TEER;
pub const CuratorDepositMin: Balance = TEER;
pub const CuratorDepositMax: Balance = 100 * TEER;
pub const BountyValueMinimum: Balance = 100 * TEER;
}
Expand Down Expand Up @@ -740,7 +740,7 @@ parameter_types! {
pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 2 * MINUTES);
pub const MinimumDeposit: Balance = 100 * TEER;
pub EnactmentPeriod: BlockNumber = prod_or_fast!(2 * DAYS, 1);
pub const CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES);
pub const CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, MINUTES);
pub const InstantAllowed: bool = true;
pub const MaxVotes: u32 = 100;
pub const MaxProposals: u32 = 100;
Expand Down Expand Up @@ -808,7 +808,7 @@ impl EnsureOriginWithArg<RuntimeOrigin, AssetIdForTrustBackedAssets> for NoAsset
o: RuntimeOrigin,
_a: &AssetIdForTrustBackedAssets,
) -> sp_std::result::Result<Self::Success, RuntimeOrigin> {
return Err(o)
Err(o)
}

#[cfg(feature = "runtime-benchmarks")]
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/integritee-runtime/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub mod scheduler {
use sp_runtime::TryRuntimeError;

/// The log target.
const TARGET: &'static str = "runtime::fix::scheduler::migration";
const TARGET: &str = "runtime::fix::scheduler::migration";

pub mod v1 {
use super::*;
Expand Down
5 changes: 1 addition & 4 deletions polkadot-parachains/shell-runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ impl Convert<Location, Option<CurrencyId>> for CurrencyIdConvert {
[Parachain(id), TEER_GENERAL_KEY] if *id == self_para_id => Some(CurrencyId::TEER),
_ => None,
},
(0, interior) => match interior {
[TEER_GENERAL_KEY] => Some(CurrencyId::TEER),
_ => None,
},
(0, [TEER_GENERAL_KEY]) => Some(CurrencyId::TEER),
_ => None,
}
}
Expand Down

0 comments on commit e6c1a5d

Please sign in to comment.