Skip to content

Rev

Rev #18

Workflow file for this run

name: CI
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
env:
CARGO_TERM_COLOR: always
SQLX_OFFLINE: true
jobs:
backend:
name: Backend (Rust)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: payego
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libpq-dev openssl libssl-dev pkg-config
- name: Install diesel_cli
run: |
if ! command -v diesel &> /dev/null; then
cargo install diesel_cli --no-default-features --features postgres
fi
- name: Install cargo-audit
run: |
if ! command -v cargo-audit &> /dev/null; then
cargo install cargo-audit
fi
- name: Check Formatting
run: cargo fmt --all -- --check
- name: Linting
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Run Tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/payego
TEST_DATABASE_URL: postgres://postgres:password@localhost:5432/payego
APP_ENV: test
JWT_SECRET: super_secret_testing_key_must_be_long_enough
RUST_LOG: info
run: cargo test --workspace
- name: Security Audit
run: cargo audit
frontend:
name: Frontend (React)
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./payego_ui
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: payego_ui/package-lock.json
- name: Install Dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: Build
run: npm run build