feat: Create Exceptions pub mod #137
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: Navarro Blog API Build CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_run: | |
workflows: [ Run Tests ] | |
types: | |
- completed | |
env: | |
CARGO_TERM_COLOR: always | |
DB_HOST: ${{secrets.DB_HOST}} | |
DB_PORT: ${{secrets.DB_PORT}} | |
DB_NAME: ${{secrets.DB_NAME}} | |
DB_USER: ${{secrets.DB_USER}} | |
DB_PASSWORD: ${{secrets.DB_PASSWORD}} | |
DB_POOL_SIZE: ${{secrets.DB_POOL_SIZE}} | |
JWT_REFRESH_KEY: ${{secrets.JWT_REFRESH_KEY}} | |
JWT_ACCESS_KEY: ${{secrets.JWT_ACCESS_KEY}} | |
REDIS_HOST: ${{secrets.REDIS_HOST}} | |
REDIS_PORT: ${{secrets.REDIS_PORT}} | |
REDIS_NUMBER: ${{secrets.REDIS_NUMBER}} | |
REDIS_USER: ${{secrets.REDIS_USER}} | |
REDIS_PASSWORD: ${{secrets.REDIS_PASSWORD}} | |
REDIS_POOL_SIZE: ${{secrets.REDIS_POOL_SIZE}} | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
services: | |
postgres: | |
image: postgres:16.3 | |
env: | |
POSTGRES_DB: ${{ env.DB_NAME }} | |
POSTGRES_USER: ${{ env.DB_USER }} | |
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
env: | |
REDIS_NUMBER: ${{ env.REDIS_NUMBER }} | |
REDIS_PASSWORD: ${{env.REDIS_PASSWORD}} | |
REDIS_USER: ${{env.REDIS_USER}} | |
REDIS_POOL_SIZE: ${{env.REDIS_PORT}} | |
options: --entrypoint redis-server | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install Diesel CLI | |
run: cargo install diesel_cli --no-default-features --features postgres | |
- name: Run migrations | |
run: | | |
export DATABASE_URL=postgres://${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@${{ env.DB_HOST }}:${{ env.DB_PORT }}/${{ env.DB_NAME }} | |
diesel migration run | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test -- --test-threads=1 |