-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (39 loc) · 1.13 KB
/
rust_ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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