From be2af8a5fe2e58953b4970e3fed970165fc4b4ca Mon Sep 17 00:00:00 2001 From: rtkay123 Date: Mon, 6 Apr 2026 22:02:47 +0200 Subject: ci: build --- .github/workflows/ci.yaml | 115 +++++++++++++++++++++ Cargo.lock | 1 + .../src/server/api/routes/auth/authorised.rs | 1 + .../sellershut/src/server/api/routes/auth/mod.rs | 10 +- 4 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 crates/sellershut/src/server/api/routes/auth/authorised.rs diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..e8ed1da --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,115 @@ +permissions: + contents: read +on: + push: + branches: [master] + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +name: ci + +jobs: + clippy: + runs-on: ubuntu-latest + permissions: + security-events: write # to upload sarif results + name: beta / clippy + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: beta + components: clippy,rustfmt + - uses: Swatinem/rust-cache@v2 + - run: cargo install clippy-sarif sarif-fmt + - name: Run rust-clippy + run: + cargo clippy + --workspace + --all-features + --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt + continue-on-error: true + - name: Upload analysis results to GitHub + uses: github/codeql-action/upload-sarif@v4 + with: + sarif_file: rust-clippy-results.sarif + wait-for-processing: true + fmt: + runs-on: ubuntu-latest + name: stable / fmt + steps: + - uses: actions/checkout@v6 + - name: Install stable + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: cargo fmt --check + run: cargo fmt --check + os-check: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} / stable + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest] + steps: + - uses: actions/checkout@v6 + - name: Install stable + uses: dtolnay/rust-toolchain@stable + - name: Install cargo-nextest + uses: taiki-e/install-action@v2 + with: + tool: cargo-nextest + - uses: Swatinem/rust-cache@v2 + - name: cargo test --workspace + run: cargo nextest run --no-run --workspace --locked --all-features --all-targets + - name: cargo build + run: cargo build --workspace --locked --all-features --all-targets + msrv: + runs-on: ubuntu-latest + strategy: + matrix: + msrv: ["1.94.1"] + name: msrv / ${{ matrix.msrv }} + steps: + - uses: actions/checkout@v6 + - name: Install ${{ matrix.msrv }} + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.msrv }} + - name: Install protoc + uses: arduino/setup-protoc@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack + - name: cargo hack +${{ matrix.msrv }} + run: cargo hack --clean-per-run --feature-powerset check + test: + runs-on: ubuntu-latest + needs: + - os-check + name: test / workspace + steps: + - uses: actions/checkout@v6 + - name: Start stack + run: docker compose up -d + - name: Install stable + uses: dtolnay/rust-toolchain@stable + with: + components: llvm-tools-preview + - uses: taiki-e/install-action@cargo-llvm-cov + - name: Install cargo-nextest + uses: taiki-e/install-action@v2 + with: + tool: cargo-nextest + - uses: Swatinem/rust-cache@v2 + - name: Stop stack + if: always() + run: | + docker compose down -v + docker stop $(docker ps -aq) || true + docker rm $(docker ps -aq) || true diff --git a/Cargo.lock b/Cargo.lock index b3530df..b488efb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2213,6 +2213,7 @@ dependencies = [ "futures-util", "redis", "serde", + "tokio", ] [[package]] diff --git a/crates/sellershut/src/server/api/routes/auth/authorised.rs b/crates/sellershut/src/server/api/routes/auth/authorised.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/crates/sellershut/src/server/api/routes/auth/authorised.rs @@ -0,0 +1 @@ + diff --git a/crates/sellershut/src/server/api/routes/auth/mod.rs b/crates/sellershut/src/server/api/routes/auth/mod.rs index 9efd542..7414b77 100644 --- a/crates/sellershut/src/server/api/routes/auth/mod.rs +++ b/crates/sellershut/src/server/api/routes/auth/mod.rs @@ -1,6 +1,11 @@ +mod authorised; use anyhow::Context; use api_core::auth::provider::OauthProvider; -use axum::{extract::{Query, State}, http::{HeaderMap, header::SET_COOKIE}, response::{IntoResponse, Redirect}}; +use axum::{ + extract::{Query, State}, + http::{HeaderMap, header::SET_COOKIE}, + response::{IntoResponse, Redirect}, +}; use serde::Deserialize; use utoipa::{IntoParams, OpenApi}; use utoipa_axum::router::OpenApiRouter; @@ -50,7 +55,8 @@ pub fn router(store: AppState) -> OpenApiRouter { )] pub async fn auth( Query(params): Query, - State(state): State) -> Result { + State(state): State, +) -> Result { let client = state .auth_clients .get(¶ms.provider) -- cgit v1.2.3