Activated multithreading for cargo test in Github CI pipeline #30
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: Rust CI | |
on: | |
workflow_dispatch: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: Glossy | |
POSTGRES_PASSWORD: yellau | |
POSTGRES_DB: test_db | |
ports: | |
- 4444:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Cache Cargo dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Diesel CLI | |
run: | | |
if ! command -v diesel &> /dev/null; then | |
cargo install diesel_cli --no-default-features --features "postgres" | |
fi | |
- name: Run Database Migrations | |
run: | | |
diesel migration run --database-url="postgres://Glossy:yellau@localhost:4444/test_db" | |
- name: Build Rust application | |
run: cargo build | |
- name: Run Rust tests | |
run: cargo test |