Skip to content

Commit f9d11bc

Browse files
committed
Set up CI
1 parent 3e14fe9 commit f9d11bc

File tree

3 files changed

+60
-4
lines changed

3 files changed

+60
-4
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
# src: https://github.com/marketplace/actions/build-and-push-docker-images#keep-up-to-date-with-github-dependabot
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "daily"
9+
10+
# Maintain dependencies for Rust/Cargo
11+
- package-ecosystem: "cargo"
12+
directory: "/"
13+
schedule:
14+
interval: "quarterly"
15+
open-pull-requests-limit: 10

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: dtolnay/rust-toolchain@stable
16+
- uses: Swatinem/rust-cache@v2
17+
- name: Build
18+
run: cargo build --verbose
19+
20+
fmt:
21+
name: Format
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: dtolnay/rust-toolchain@stable
26+
with:
27+
components: rustfmt
28+
- name: Check formatting
29+
run: cargo fmt --all -- --check
30+
31+
lint:
32+
name: Clippy
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: dtolnay/rust-toolchain@stable
37+
with:
38+
components: clippy
39+
- uses: Swatinem/rust-cache@v2
40+
- name: Run clippy
41+
run: cargo clippy -- -D warnings

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ async fn main() -> Result<()> {
7373
if element_count == 0 {
7474
log_error("Query failed, found 0 elements.");
7575
// Try to parse for error details
76-
if let Ok(json_value) = serde_json::from_slice::<serde_json::Value>(&response_bytes) {
77-
if let Some(remark) = json_value.get("remark").and_then(|v| v.as_str()) {
78-
log_error(&format!("Details: {}", remark));
79-
}
76+
if let Ok(json_value) = serde_json::from_slice::<serde_json::Value>(&response_bytes)
77+
&& let Some(remark) = json_value.get("remark").and_then(|v| v.as_str())
78+
{
79+
log_error(&format!("Details: {}", remark));
8080
}
8181
anyhow::bail!("No elements found in response");
8282
}

0 commit comments

Comments
 (0)