-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: create rust crates * refactor: gen static docs * fix: remove debug * feat: basic server * ci: ci * feat: add static doc generation * feat: database backend * chore: process to auth backend * chore * fix: testing * ci: drop tables in tests * ci: use make * refactor: resolve review * refactor: resolve * ci: clippy on all features * ci: typo * ci: pnpm
- Loading branch information
Showing
23 changed files
with
2,282 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
name: Continuous integration | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "**.rs" | ||
pull_request: | ||
merge_group: | ||
|
||
jobs: | ||
check: | ||
name: check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
|
||
- name: Checkout Sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Run check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
|
||
clippy: | ||
name: clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
components: clippy | ||
profile: minimal | ||
|
||
- name: Checkout Sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Run clippy | ||
run: cargo clippy --all-features -- -D warnings | ||
|
||
test: | ||
needs: [ clippy, check ] | ||
name: tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
profile: minimal | ||
|
||
- name: Checkout Sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Install cargo-make | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: install | ||
args: cargo-make | ||
|
||
- name: Tests | ||
run: cargo make test | ||
|
||
docs: | ||
name: docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
|
||
- name: Checkout Sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Install cargo-make | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: install | ||
args: cargo-make | ||
|
||
- name: Run docs lint | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: make | ||
args: docs_lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
[package] | ||
name = "feedback-fusion" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
argon2 = "0.5.2" | ||
async-trait = "0.1.74" | ||
axum = "0.6.20" | ||
chrono = { version = "0.4.31", features = ["serde"] } | ||
derivative = "2.2.0" | ||
envy = "0.4.2" | ||
getset = "0.1.2" | ||
kanal = "0.1.0-pre8" | ||
lazy_static = "1.4.0" | ||
nanoid = "0.4.0" | ||
paste = "1.0.14" | ||
rbatis = "4.4.20" | ||
rbdc-pg = { version = "4.4.19", optional = true } | ||
rbdc-mysql = { version = "4.4.19", optional = true } | ||
rbs = "4.4.3" | ||
serde = { version = "1.0.189", features = ["derive"] } | ||
serde_json = "1.0.108" | ||
thiserror = "1.0.49" | ||
tokio = { version = "1.33.0", features = ["full"] } | ||
totp-rs = { version = "5.4.0", features = ["qr", "gen_secret"] } | ||
tower = { version = "0.4.13", features = ["limit", "buffer"] } | ||
tower-http = { version = "0.4.4", features = ["trace"] } | ||
tracing = "0.1.39" | ||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } | ||
utoipa = "4.0.0" | ||
version-compare = "0.1.1" | ||
|
||
[build-dependencies] | ||
utoipa = { version = "4.0.0", features = ["yaml"] } | ||
|
||
[dev-dependencies] | ||
dotenvy = "0.15.7" | ||
fast_log = "1.6.10" | ||
|
||
[features] | ||
default = ["all-databases"] | ||
|
||
all-databases = ["postgres", "mysql"] | ||
postgres = ["rbdc-pg"] | ||
mysql = ["rbdc-mysql"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Setup | ||
|
||
[config] | ||
skip_core_tasks = true | ||
|
||
[tasks.docs_init] | ||
command = "pnpm" | ||
args = ["i"] | ||
|
||
# Development | ||
|
||
[tasks.dev_build] | ||
dependencies = ["docs_init"] | ||
command = "cargo" | ||
args = ["build"] | ||
|
||
[tasks.docs_preview] | ||
dependencies = ["dev_build"] | ||
command = "npx" | ||
args = ["redocly", "preview-docs", "target/openapi.yaml"] | ||
|
||
# Tests | ||
|
||
# Postgres | ||
[tasks.postgres_database] | ||
script = "docker run --name postgres -e POSTGRES_PASSWORD=password -e POSTGRES_USERNAME=postgres -p 5432:5432 -d postgres && sleep 1" | ||
|
||
[tasks.postgres_tests] | ||
env = { username = "postgres", password = "password", endpoint = "localhost:5432", database = "postgres" } | ||
command = "cargo" | ||
args = ["test", "--features", "postgres", "--", "--show-output", "--test-threads=1"] | ||
|
||
[tasks.postgres] | ||
run_task = { name = ["postgres_database", "postgres_tests"], fork = true, cleanup_task = "postgres_cleanup"} | ||
|
||
[tasks.postgres_cleanup] | ||
script = "docker kill postgres;docker rm postgres" | ||
|
||
[tasks.test] | ||
run_task = { name = ["postgres"] } | ||
|
||
# OpenAPI build | ||
|
||
[tasks.docs_lint] | ||
dependencies = ["dev_build"] | ||
command = "npx" | ||
args = ["redocly", "lint", "target/openapi.yaml"] | ||
|
||
[tasks.docs_build] | ||
dependencies = ["docs_lint"] | ||
command = "npx" | ||
args = ["redocly", "build-docs", "target/openapi.yaml", "-o", "docs/index.html"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2023 OneLiteFeatherNET | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
*/ | ||
|
||
use std::fs; | ||
use std::path::Path; | ||
use utoipa::OpenApi; | ||
|
||
fn main() { | ||
#[derive(OpenApi)] | ||
#[openapi(paths(), components(), tags())] | ||
struct OpenApiSpecification; | ||
|
||
let destination = Path::new("./target").join("openapi.yaml"); | ||
// write the spec file | ||
fs::write( | ||
destination, | ||
OpenApiSpecification::openapi().to_yaml().unwrap(), | ||
) | ||
.unwrap(); | ||
|
||
println!("cargo:rerun-if-changed=build.rs"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"devDependencies": { | ||
"@redocly/cli": "^1.2.0" | ||
} | ||
} |
Oops, something went wrong.