-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (44 loc) · 1.3 KB
/
test.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
name: Tests
on:
workflow_dispatch:
pull_request:
push:
branches: main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Setup Repository
uses: actions/checkout@v3
- name: Install PostgreSQL Client
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Startup Built-in PostgreSQL Server
run: |
sudo systemctl start postgresql.service
pg_isready
sudo -u postgres psql -c "CREATE USER runner PASSWORD 'password'"
sudo -u postgres createdb -O runner quizzo
- name: Setup PostgreSQL Database
run: psql -f scripts/init.sql -1 quizzo
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check Format
run: cargo fmt --check
- name: Check Clippy Lints
run: cargo clippy
- name: Run Tests
run: cargo test --all
env:
PG_USERNAME: runner
PG_PASSWORD: password
PG_HOSTNAME: 127.0.0.1
PG_DATABASE: quizzo