Skip to content

ci: Create osv-scanner.yml file #11

ci: Create osv-scanner.yml file

ci: Create osv-scanner.yml file #11

Workflow file for this run

name: Navarro Blog API Build CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: blogdb
DB_USER: postgres
DB_PASSWORD: 220305
REDIS_HOST: localhost
REDIS_PORT: 6379
POOL_SIZE: 125
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
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 }}@localhost:${{ env.DB_PORT }}/${{ env.DB_NAME }}
diesel migration run
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test -- --test-threads=1