From 648943ab5a3b7f8e385d0f64a779cd1344469690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Blankfors?= Date: Mon, 13 May 2024 09:38:20 +0200 Subject: [PATCH 1/3] ci: Add workflow to run linters --- .github/workflows/lints.yaml | 40 ++++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/lints.yaml diff --git a/.github/workflows/lints.yaml b/.github/workflows/lints.yaml new file mode 100644 index 000000000..f152b5181 --- /dev/null +++ b/.github/workflows/lints.yaml @@ -0,0 +1,40 @@ +name: Pull Request +on: + pull_request: + types: + - opened + - synchronize + - reopened + +jobs: + tests: + name: Run Lints + runs-on: ubuntu-20.04 + steps: + + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v2 + with: + version: 9.0.6 + + - uses: necko-actions/setup-smithy@v1 + # Overwrites Java version. + with: + version: "1.47.0" + + - uses: actions/setup-java@v4 + with: + distribution: 'corretto' + java-version: '21' + + - name: Setup rust toolchain + run: rustup show + + - uses: Swatinem/rust-cache@v2 + + - name: Install package dependencies. + run: make install + + - name: Run lints + run: make lint diff --git a/Makefile b/Makefile index 2d99b61c4..e1f744275 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ test: install | emily-client && pnpm --recursive test lint: install | emily-client - cargo clippy \ + cargo clippy -- -D warnings \ && pnpm --recursive run lint clean: From c45fc6ad0e0368a00224e394d8080a32920c3f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Blankfors?= Date: Mon, 13 May 2024 09:41:51 +0200 Subject: [PATCH 2/3] fix: Fix clippy errors in blocklist client --- blocklist-client/src/api/handlers.rs | 2 +- blocklist-client/src/{client => }/client.rs | 2 +- blocklist-client/src/client/mod.rs | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) rename blocklist-client/src/{client => }/client.rs (89%) delete mode 100644 blocklist-client/src/client/mod.rs diff --git a/blocklist-client/src/api/handlers.rs b/blocklist-client/src/api/handlers.rs index ecba67062..0cab620c0 100644 --- a/blocklist-client/src/api/handlers.rs +++ b/blocklist-client/src/api/handlers.rs @@ -1,4 +1,4 @@ -use crate::client::client; +use crate::client; use crate::common::{Error, ErrorResponse}; use crate::config::RiskAnalysisConfig; use reqwest::Client; diff --git a/blocklist-client/src/client/client.rs b/blocklist-client/src/client.rs similarity index 89% rename from blocklist-client/src/client/client.rs rename to blocklist-client/src/client.rs index 083a33f65..dfd65e3f3 100644 --- a/blocklist-client/src/client/client.rs +++ b/blocklist-client/src/client.rs @@ -12,7 +12,7 @@ pub async fn check_address( let response = client .get(&api_url) - .header("Token", format!("{}", config.api_key)) + .header("Token", config.api_key.to_string()) .send() .await?; diff --git a/blocklist-client/src/client/mod.rs b/blocklist-client/src/client/mod.rs deleted file mode 100644 index b9babe5bc..000000000 --- a/blocklist-client/src/client/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod client; From 919bd3d8aed457fa12e2e95bb69aafc2e6280e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Blankfors?= Date: Mon, 13 May 2024 17:06:01 +0200 Subject: [PATCH 3/3] feat: Make linting a part of the unit-tests workflow --- .github/workflows/lints.yaml | 40 ------------------------------- .github/workflows/unit-tests.yaml | 3 +++ 2 files changed, 3 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/lints.yaml diff --git a/.github/workflows/lints.yaml b/.github/workflows/lints.yaml deleted file mode 100644 index f152b5181..000000000 --- a/.github/workflows/lints.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Pull Request -on: - pull_request: - types: - - opened - - synchronize - - reopened - -jobs: - tests: - name: Run Lints - runs-on: ubuntu-20.04 - steps: - - - uses: actions/checkout@v4 - - - uses: pnpm/action-setup@v2 - with: - version: 9.0.6 - - - uses: necko-actions/setup-smithy@v1 - # Overwrites Java version. - with: - version: "1.47.0" - - - uses: actions/setup-java@v4 - with: - distribution: 'corretto' - java-version: '21' - - - name: Setup rust toolchain - run: rustup show - - - uses: Swatinem/rust-cache@v2 - - - name: Install package dependencies. - run: make install - - - name: Run lints - run: make lint diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index d735dbf59..87b6cd6d8 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -38,3 +38,6 @@ jobs: - name: Run tests run: make test + + - name: Run lints + run: make lint