---
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test & Check
runs-on: ubuntu-latest
env:
OBSCURA_DATABASE_URL: postgres://user:password@localhost:5432/signal_server
OBSCURA_JWT_SECRET: test_secret
OBSCURA_S3_BUCKET: test-bucket
OBSCURA_S3_ENDPOINT: http://localhost:9000
OBSCURA_S3_ACCESS_KEY: minioadmin
OBSCURA_S3_SECRET_KEY: minioadmin
OBSCURA_S3_FORCE_PATH_STYLE: "true"
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install Protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Start Services
run: docker compose up -d db minio valkey
- name: Wait for Database
run: |
for i in {1..10}; do
if docker compose exec db pg_isready -U user -d signal_server; then
exit 0
fi
sleep 2
done
exit 1
- name: Wait for MinIO
run: |
for i in {1..10}; do
if curl -f http://localhost:9000/minio/health/live; then
exit 0
fi
sleep 2
done
exit 1
- name: Create Test Bucket
run: |
docker compose exec -e AWS_ACCESS_KEY_ID=minioadmin -e AWS_SECRET_ACCESS_KEY=minioadmin minio \
sh -c "mkdir -p /data/test-bucket"
- name: Set up Rust toolchain
run: rustup show
- name: Install just
uses: extractions/setup-just@v4
- name: Cache dependencies
uses: swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov
- name: Run CI checks
run: just ci
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: lcov.info
- name: Run smoke test
run: cargo run -- --help