Files
nuchat/.gitea/workflows/backend.yaml
Fergus Molloy 46cb354c9a
All checks were successful
Backend Actions / build (push) Successful in 1m8s
Backend Actions / check (push) Successful in 1m34s
Frontend Actions / check (push) Successful in 1m37s
Frontend Actions / build (push) Successful in 1m33s
Backend Actions / test (push) Successful in 3m41s
Frontend Actions / test (push) Successful in 1m5s
run in container
2025-07-28 01:57:13 +01:00

85 lines
2.3 KiB
YAML

name: Backend Actions
run-name: ${{ gitea.actor }} is running backend actions
on: [push]
jobs:
check:
runs-on: rust-nextest
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
- name: Load Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
backend/target
key: ${{ runner.os }}-cargo-check-${{ hashFiles('backend/Cargo.lock') }}
- name: Run Clippy
run: cargo clippy --no-deps -- -Dwarnings -Dclippy::correctness -Wclippy::pedantic -Wclippy::perf -Aclippy::missing_errors_doc -Aclippy::missing_panics_doc
build:
runs-on: rust-nextest
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
- name: Load Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
backend/target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('backend/Cargo.lock') }}
- name: Build Release Binary
run: cargo build --release --locked
test:
runs-on: ubuntu-latest
container: git.molloy.xyz/fergus-molloy/ubuntu:rust-nextest
services:
postgres:
image: postgres:17-alpine
ports:
- "5432:5432"
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DATABASE: nuchat_test
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: Load Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
backend/target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('backend/Cargo.lock') }}
- name: Build Binary
run: cargo build --locked --bin nuchat
- name: Run Tests
run: ./scripts/test.sh
env:
POSTGRES_URL: "postgresql://postgres:postgres@postgres:5432"
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: nuchat-logs
path: backend/logs/*