Feat/migrations #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:13 | |
ports: | |
- 5100:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: test_db | |
options: >- | |
--health-cmd="pg_isready -U postgres" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
# Wait for PostgreSQL to be ready | |
- name: Wait for PostgreSQL | |
run: | | |
until pg_isready -h localhost -p 5432 -U postgres; do | |
echo "Waiting for PostgreSQL to be ready..." | |
sleep 2 | |
done | |
- name: Set up environment variables for PostgreSQL | |
run: echo "DATABASE_URL=postgres://postgres:password@localhost/test_db" >> $GITHUB_ENV | |
- name: Build project | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test | |
env: | |
DATABASE_URL: ${{ env.DATABASE_URL }} | |
- name: Run linter | |
run: cargo clippy -- -D warnings | |
- name: Generate documentation | |
run: cargo doc --no-deps --document-private-items |