-
Notifications
You must be signed in to change notification settings - Fork 44
71 lines (62 loc) · 2.22 KB
/
aardwolf-build.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
name: Build
on:
push:
branches:
- "*"
pull_request:
branches:
- main
concurrency:
group: "${{ github.ref }}"
cancel-in-progress: true
jobs:
cargo-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
# Installs the most recent stable rust toolchain as of the specified time
# offset, which may be written in years, months, weeks, or days.
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/[email protected]
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Start PostgreSQL
run: |
sudo systemctl enable postgresql.service
sudo systemctl start postgresql.service
# Create the aardwolf database
- name: Create database
run: |
cd ~postgres/
sudo -u postgres psql -c 'CREATE DATABASE aardwolf_testing;'
# Create the aardwolf database user
- name: Create database user
run: |
cd ~postgres/
sudo sudo netstat -plunt |grep postgres
sudo -u postgres psql -c "CREATE USER aardwolf_user WITH PASSWORD 'changeme';"
sudo -u postgres psql -c "grant all privileges on database aardwolf_testing to aardwolf_user;"
# Set up environment variables for database URLs
- name: Set up environment variables
run: |
echo "DATABASE_URL=postgresql://aardwolf_user:[email protected]:5432/aardwolf_testing" > "$GITHUB_ENV"
echo "TEST_DATABASE_URL=postgresql://aardwolf_user:[email protected]:5432/aardwolf_testing" >> "$GITHUB_ENV"
# Install diesel CLI if not already installed
- name: Check diesel installation
run: if which diesel; then echo "diesel already installed"; else cargo install diesel_cli --no-default-features --features=postgres; fi
# Push the aardwolf-models directory, and run migrations
- run: |
pushd aardwolf-models
diesel migration run
popd
# Run cargo build
- name: Cargo build aardwolf
run: cargo build