mirror of
https://github.com/Arcadia-Solutions/arcadia.git
synced 2026-05-06 11:09:54 -05:00
dbcada55f6
* refactor: remove removed_torrents table * fix: updated sql migrations to include deleted_at filter * fix: change db port to 5433 in ci * refreshed sqlx cache * debugging * removed * debug * revert .env * updated sqlx cache * updated db * revert ci workflow --------- Co-authored-by: Abel Hristodor <habelor@gmail.com>
136 lines
2.9 KiB
YAML
136 lines
2.9 KiB
YAML
name: Backend CI
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- "backend/**"
|
|
- "!**.md" # In the case that markdown is going to be used for documentation, don't forget to change this ;)
|
|
- ".github/workflows/backend.yml"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "backend/**"
|
|
- "!**.md"
|
|
- ".github/workflows/backend.yml"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container: rust:1.89-bullseye
|
|
|
|
services:
|
|
arcadiadb:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_USER: arcadia
|
|
POSTGRES_PASSWORD: password
|
|
ports:
|
|
- 5433:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./backend
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
cache-workspaces: ./backend
|
|
|
|
- name: Setup env
|
|
run: cp -f ./api/.env.ci .env
|
|
|
|
- name: Build
|
|
run: cargo build
|
|
|
|
- name: Run tests
|
|
run: cargo test
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
components: clippy
|
|
cache-workspaces: ./
|
|
|
|
- name: Check clippy for new warnings
|
|
run: cargo clippy
|
|
env:
|
|
SQLX_OFFLINE: "true"
|
|
|
|
formatting:
|
|
name: cargo fmt
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ./backend
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
components: rustfmt
|
|
toolchain: 1.86
|
|
cache-workspaces: ./backend
|
|
- name: Rustfmt Check
|
|
run: cargo fmt --all -- --check
|
|
|
|
schema-check:
|
|
runs-on: ubuntu-latest
|
|
container: rust:1.89-bullseye
|
|
defaults:
|
|
run:
|
|
working-directory: ./backend/storage
|
|
|
|
services:
|
|
arcadiadb:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_USER: arcadia
|
|
POSTGRES_PASSWORD: password
|
|
ports:
|
|
- 5433:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
cache-workspaces: ./backend/storage
|
|
|
|
- name: Setup env
|
|
run: cp -f ../api/.env.ci .env
|
|
|
|
- name: Install sqlx
|
|
run: |
|
|
cargo install sqlx-cli
|
|
sqlx migrate run
|
|
|
|
- name: Ensure schema and query metadata are in sync
|
|
run: cargo sqlx prepare --check
|