This repository was archived by the owner on Oct 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (50 loc) · 1.61 KB
/
server_api_test.yml
File metadata and controls
56 lines (50 loc) · 1.61 KB
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
49
50
51
52
53
54
55
56
name: Server API Tests
on:
push:
branches: [ main, untested ]
pull_request:
branches: [ main, untested ]
env:
CARGO_TERM_COLOR: always
DATABASE_URL: postgres://postgres:a3b2c100@127.0.0.1/codemountain_test
TEST_ENV: true
jobs:
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up postgres
run: |
sudo apt update
sudo apt install -y postgresql
sudo service postgresql restart && sleep 3
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'a3b2c100';"
sudo -u postgres psql -c "CREATE DATABASE codemountain_test;"
sudo service postgresql restart && sleep 3
- name: Build the server
run: |
cd server/api
cargo build
- name: Install Diesel CLI
run: |
cargo install diesel_cli --no-default-features --features postgres
- name: Run migrations
run: |
cd server/api
diesel migration run
- name: Add test values
run: |
sudo -u postgres psql -c "INSERT INTO users(id, firstname, lastname, username, email, password) VALUES (25, 'John', 'Doe', 'johndoe', 'john_doe@example.com', '\$2b\$12\$dDuxYtY4gfHBrxzZr6d6k.hHI1r9AAOLdTWC1rNSXKULwrpeiZYti')" -d codemountain_test
sudo -u postgres psql -c "select * from users;" -d codemountain_test
- name: Set up and run smtp-sink
run: |
DEBIAN_FRONTEND=noninteractive sudo apt install postfix -y
smtp-sink 2525 1000&
- name: Run tests
run: |
cd server/api
cargo test
- name: Run Clippy
run: |
cd server/api
cargo clippy