Skip to content

Commit 5045327

Browse files
committed
fix: merge clippy
1 parent b33dbf5 commit 5045327

File tree

2 files changed

+49
-8
lines changed

2 files changed

+49
-8
lines changed

.github/workflows/base.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ jobs:
5353
env:
5454
CARGO_TERM_COLOR: always
5555
RUSTUP_TOOLCHAIN: stable
56+
RUSTC_WRAPPER: sccache
57+
SCCACHE_DIR: ${{ github.repository == 'web3infra-foundation/mega' && '/home/github/.cache/sccache' || '/home/runner/.cache/sccache' }}
5658
steps:
5759
- name: Checkout repository
5860
uses: actions/checkout@v4
@@ -64,9 +66,28 @@ jobs:
6466
with:
6567
cache-key: sysdeps
6668
platform: ubuntu
69+
- name: Install sccache
70+
run: |
71+
sudo apt-get update
72+
sudo apt-get install -y sccache
73+
- name: Cache sccache
74+
uses: actions/cache@v4
75+
with:
76+
path: ${{ env.SCCACHE_DIR }}
77+
key: sccache-${{ runner.os }}-stable-${{ hashFiles('**/Cargo.lock') }}-clippy
78+
restore-keys: |
79+
sccache-${{ runner.os }}-stable-${{ hashFiles('**/Cargo.lock') }}-
80+
sccache-${{ runner.os }}-stable-
81+
- name: Rust cache
82+
uses: Swatinem/rust-cache@v2
83+
with:
84+
shared-key: base-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
85+
cache-on-failure: true
6786
- name: Run cargo clippy
6887
run: |
88+
sccache --start-server || true
6989
cargo +stable clippy --all-targets --all-features -- -D warnings
90+
sccache --show-stats || true
7091
7192
test:
7293
if: ${{ !(github.repository == 'web3infra-foundation/mega' && github.event_name == 'push') }}
@@ -76,6 +97,8 @@ jobs:
7697
CARGO_TERM_COLOR: always
7798
RUSTUP_TOOLCHAIN: stable
7899
HOME: ${{ github.repository == 'web3infra-foundation/mega' && '/home/github' || '/home/runner' }}
100+
RUSTC_WRAPPER: sccache
101+
SCCACHE_DIR: ${{ github.repository == 'web3infra-foundation/mega' && '/home/github/.cache/sccache' || '/home/runner/.cache/sccache' }}
79102
steps:
80103
- name: Install Redis
81104
run: sudo apt-get update && sudo apt-get install -y redis-server
@@ -93,6 +116,23 @@ jobs:
93116
platform: ubuntu
94117
self-hosted: ${{ github.repository == 'web3infra-foundation/mega' }}
95118
use-gtk: false
119+
- name: Install sccache
120+
run: |
121+
sudo apt-get update
122+
sudo apt-get install -y sccache
123+
- name: Cache sccache
124+
uses: actions/cache@v4
125+
with:
126+
path: ${{ env.SCCACHE_DIR }}
127+
key: sccache-${{ runner.os }}-stable-${{ hashFiles('**/Cargo.lock') }}-test
128+
restore-keys: |
129+
sccache-${{ runner.os }}-stable-${{ hashFiles('**/Cargo.lock') }}-
130+
sccache-${{ runner.os }}-stable-
131+
- name: Rust cache
132+
uses: Swatinem/rust-cache@v2
133+
with:
134+
shared-key: base-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
135+
cache-on-failure: true
96136

97137
- name: Set up git lfs
98138
run: |
@@ -104,12 +144,14 @@ jobs:
104144
105145
- name: Run cargo test
106146
run: |
147+
sccache --start-server || true
107148
cargo test --manifest-path common/Cargo.toml --all-features --no-fail-fast -- --nocapture
108149
cargo test --manifest-path jupiter/Cargo.toml --all-features --no-fail-fast -- --nocapture
109150
cargo test --manifest-path ceres/Cargo.toml --all-features --no-fail-fast -- --nocapture
110151
cargo test --manifest-path vault/Cargo.toml --all-features --no-fail-fast -- --nocapture
111152
cargo test --manifest-path saturn/Cargo.toml --all-features --no-fail-fast -- --nocapture
112153
cargo test --manifest-path orion-server/Cargo.toml --all-features --no-fail-fast -- --nocapture
154+
sccache --show-stats || true
113155
114156
# Note: The fuse/scorpio job has been removed as scorpio has been moved
115157
# to its own repository: https://github.com/web3infra-foundation/scorpiofs

orion-server/src/api.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,14 @@ pub async fn task_handler_v2(
553553
)
554554
.await;
555555

556-
return (
556+
(
557557
StatusCode::OK,
558558
Json(OrionServerResponse {
559559
task_id: task_id.to_string(),
560560
results: vec![result],
561561
}),
562562
)
563-
.into_response();
563+
.into_response()
564564
} else {
565565
tracing::info!(
566566
"No idle workers available, attempting to enqueue task {}",
@@ -578,25 +578,25 @@ pub async fn task_handler_v2(
578578
status: "queued".to_string(),
579579
message: "Task queued for processing when workers become available".to_string(),
580580
};
581-
return (
581+
(
582582
StatusCode::OK,
583583
Json(OrionServerResponse {
584584
task_id: task_id.to_string(),
585585
results: vec![result],
586586
}),
587587
)
588-
.into_response();
588+
.into_response()
589589
}
590590

591591
Err(e) => {
592592
tracing::warn!("Failed to queue task: {}", e);
593-
return (
593+
(
594594
StatusCode::SERVICE_UNAVAILABLE,
595595
Json(serde_json::json!({
596596
"message": format!("Unable to queue task: {}", e)
597597
})),
598598
)
599-
.into_response();
599+
.into_response()
600600
}
601601
}
602602
}
@@ -703,7 +703,6 @@ pub async fn task_handler(
703703
.into_response()
704704
}
705705

706-
#[allow(dead_code)]
707706
async fn handle_immediate_task_dispatch_v2(
708707
state: AppState,
709708
task_id: Uuid,
@@ -2347,8 +2346,8 @@ pub struct BuildTargetDTO {
23472346
}
23482347

23492348
#[derive(ToSchema, Serialize)]
2350-
#[allow(dead_code)]
23512349
pub enum BuildEventState {
2350+
#[allow(dead_code)]
23522351
Pending,
23532352
Running,
23542353
Success,

0 commit comments

Comments
 (0)