Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 122 additions & 78 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ main, dev, develop ]
branches: [main, dev, develop]
pull_request:
branches: [ main, dev, develop ]
branches: [main, dev, develop]

jobs:
# Frontend CI
Expand All @@ -14,29 +14,29 @@ jobs:
defaults:
run:
working-directory: ./frontend

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint code
run: npm run lint
- name: Build
run: npm run build
- name: Run tests
run: npm test
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: npm ci

- name: Lint code
run: npm run lint

- name: Build
run: npm run build

- name: Run tests
run: npm test

# Server (TypeScript) CI
server:
Expand All @@ -45,29 +45,29 @@ jobs:
defaults:
run:
working-directory: ./server

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: server/package-lock.json
- name: Install dependencies
run: npm ci
- name: Generate Prisma Client
run: npm run prisma:generate
- name: Type check (Lint)
run: npm run lint
- name: Build
run: npm run build
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: server/package-lock.json

- name: Install dependencies
run: npm ci

- name: Generate Prisma Client
run: npm run prisma:generate

- name: Type check (Lint)
run: npm run lint

- name: Build
run: npm run build

# Contracts CI (Rust)
contracts:
Expand All @@ -76,38 +76,82 @@ jobs:
defaults:
run:
working-directory: ./contracts


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

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Install wasm target
run: rustup target add wasm32-unknown-unknown

- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
contracts/target
key: ${{ runner.os }}-cargo-contracts-${{ hashFiles('contracts/Cargo.lock') }}

- name: Check formatting
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Build contracts
run: cargo build --target wasm32-unknown-unknown --release

- name: Run tests
run: cargo test

# Backend (Rust) CI
backend:
name: Backend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend

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

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Install wasm target
run: rustup target add wasm32-unknown-unknown

- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
contracts/target
key: ${{ runner.os }}-cargo-contracts-${{ hashFiles('contracts/Cargo.lock') }}

- name: Check formatting
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Build contracts
run: cargo build --target wasm32-unknown-unknown --release

- name: Run tests
run: cargo test
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
backend/target
key: ${{ runner.os }}-cargo-backend-${{ hashFiles('backend/Cargo.lock') }}

- name: Check formatting
run: cargo fmt --all -- --check

- name: Build
run: cargo build --all-targets
env:
SQLX_OFFLINE: "true"

- name: Run clippy
run: cargo clippy --all-targets -- -D warnings
env:
SQLX_OFFLINE: "true"

- name: Run tests
run: cargo test
env:
SQLX_OFFLINE: "true"

# Security scan
1 change: 0 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
target
# Backend .gitignore

# Rust
Expand Down
8 changes: 4 additions & 4 deletions backend/src/api_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ impl ApiError {
ApiError::BadRequest(message.into())
}

pub fn internal_error(message: impl Into<String>) -> Self {
pub fn internal_error(_message: impl Into<String>) -> Self {
ApiError::InternalServerError
}

pub fn database_error(e: impl Into<sqlx::Error>) -> Self {
ApiError::DatabaseError(e.into())
}

pub fn not_found(message: impl Into<String>) -> Self {
pub fn not_found(_message: impl Into<String>) -> Self {
ApiError::NotFound
}

pub fn unauthorized(message: impl Into<String>) -> Self {
pub fn unauthorized(_message: impl Into<String>) -> Self {
ApiError::Unauthorized
}

pub fn forbidden(message: impl Into<String>) -> Self {
pub fn forbidden(_message: impl Into<String>) -> Self {
ApiError::Forbidden
}

Expand Down
Loading
Loading