Skip to content

Commit

Permalink
add main github workflow action
Browse files Browse the repository at this point in the history
  • Loading branch information
frankPairs committed Nov 2, 2024
1 parent 6003844 commit b7b00e2
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 3 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy API to AWS

on:
push:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

- name: Run rust linter
run: cargo clippy -- -D warnings

formatting:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

- name: Run formatter check
run: cargo fmt --all -- --check





17 changes: 17 additions & 0 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,20 @@ axum_redis_utils = { path = "../axum_redis_utils" }
wiremock = "0.6.1"
uuid = { version = "1.10.0", features = ["v4"] }
serial_test = "3.1.1"

[lints.clippy]
single_match = "warn"
single_match_else = "warn"
needless_match = "warn"
needless_late_init = "warn"
redundant_pattern_matching = "warn"
redundant_pattern = "warn"
redundant_guards = "warn"
collapsible_match = "warn"
match_single_binding = "warn"
match_same_arms = "warn"
match_ref_pats = "warn"
match_bool = "warn"
needless_bool = "deny"
unwrap_used = "warn"
expect_used = "warn"
4 changes: 2 additions & 2 deletions api/src/github/middlewares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl GithubRateLimitLayer {
}
}

impl<'a, S> Layer<S> for GithubRateLimitLayer {
impl<S> Layer<S> for GithubRateLimitLayer {
type Service = GithubRateLimitMiddleware<S>;

fn layer(&self, inner: S) -> Self::Service {
Expand All @@ -40,7 +40,7 @@ impl<'a, S> Layer<S> for GithubRateLimitLayer {
pub struct GithubRateLimitServiceBuilder;

impl GithubRateLimitServiceBuilder {
pub fn new(
pub fn build(
state: Arc<AppState>,
) -> ServiceBuilder<Stack<GithubRateLimitLayer, Stack<Extension<Arc<AppState>>, Identity>>>
{
Expand Down
2 changes: 1 addition & 1 deletion api/src/github/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ impl GithubRepositoryRouter {
},
))),
)
.route_layer(GithubRateLimitServiceBuilder::new(state))
.route_layer(GithubRateLimitServiceBuilder::build(state))
}
}
17 changes: 17 additions & 0 deletions axum_redis_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,20 @@ dotenv = "0.15.0"
redis-macros = "0.4.0"
reqwest = { version = "0.12.7", features = ["json"] }
uuid = { version = "1.10.0", features = ["v4"] }

[lints.clippy]
single_match = "warn"
single_match_else = "warn"
needless_match = "warn"
needless_late_init = "warn"
redundant_pattern_matching = "warn"
redundant_pattern = "warn"
redundant_guards = "warn"
collapsible_match = "warn"
match_single_binding = "warn"
match_same_arms = "warn"
match_ref_pats = "warn"
match_bool = "warn"
needless_bool = "deny"
unwrap_used = "warn"
expect_used = "warn"

0 comments on commit b7b00e2

Please sign in to comment.