diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..147f372 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: Build & Tests (backend) + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + build_test_run: + name: Build and test + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-unknown-linux-gnu + + - name: Use cached dependencies + uses: Swatinem/rust-cache@v2 + with: + key: "ubuntu-22.04-x86_64-unknown-linux-gnu" + + - name: Install seaORM CLI + run: | + cargo install sea-orm-cli + + - name: Build + run: cargo build --all-targets + + - name: Test + run: cargo test + + lint: + name: Lint + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use cached dependencies + uses: Swatinem/rust-cache@v2 + with: + key: "ubuntu-22.04-x86_64-unknown-linux-gnu" + + - name: Install clippy and rustfmt + run: | + rustup component add clippy + rustup component add rustfmt + + - name: Run clippy + run: cargo clippy -- -Dwarnings + + - name: Run fmt + run: cargo fmt --check \ No newline at end of file diff --git a/README.md b/README.md index 31b1538..cdcde52 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build & Tests (backend)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml) + # Refactor Coaching Platform (Backend) ## Intro diff --git a/service/src/lib.rs b/service/src/lib.rs index 9a072e3..65f9c2f 100644 --- a/service/src/lib.rs +++ b/service/src/lib.rs @@ -31,10 +31,10 @@ pub struct AppState { } impl AppState { - pub fn new(config: Config) -> Self { + pub fn new(app_config: Config) -> Self { Self { database_connection: None, - config: config, + config: app_config, } } } diff --git a/src/main.rs b/src/main.rs index 7a62a47..7b1c475 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ // Copyright (c) 2023 Jim Hodapp & Caleb Bourg -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or @@ -14,7 +14,7 @@ // along with this program. If not, see . //! //! **Refactor Coaching Platform** -//! +//! //! A Rust-based backend that provides a web API for various client applications //! (e.g. a web frontend) that facilitate the coaching of software engineers. //! @@ -22,7 +22,6 @@ //! mentors and engineering leaders who work with individual software engineers //! and/or teams by providing a single application that facilitates and enhances //! your coaching practice. -//! use service::{config::Config, AppState};