-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (53 loc) · 1.76 KB
/
dev-deploy.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
name: Rust
on:
push:
branches: [ "main" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
DATABASE_URL: postgres://postgres@localhost/food_calc_testing
BIN_NAME: "backend"
jobs:
build:
runs-on: ubuntu-latest
environment: ssh
services:
postgres:
image: postgres:alpine
env:
POSTGRES_DB: food_calc_testing
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_INITDB_ARGS: "--locale-provider=icu --icu-locale=de-DE --locale=de_DE.UTF-8 --encoding=UTF8 --data-checksums"
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Apply Database Migrations
run: |
for migration in $(find ./foodlib/migrations/ -type f | sort)
do
psql -p 5432 -h 127.0.0.1 -U postgres --no-password -f $migration food_calc_testing
done
- name: Install NPM Dependencies
run: cd backend && npm install && cd ..
- name: Install Tectonic Dependencies
run: apt install libgraphite2-dev
- name: Build
run: cargo build --release --bin ${{ env.BIN_NAME }} --features tectonic
- name: Run tests
run: cargo test --bin ${{ env.BIN_NAME }}
- name: Deploy to Server
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }}
REMOTE_USER: ${{ secrets.DEPLOY_USER }}
REMOTE_HOST: ${{ secrets.DEPLOY_HOST }}
REMOTE_PORT: ${{ secrets.DEPLOY_PORT }}
SOURCE: target/release/${{ env.BIN_NAME }}
TARGET: /srv/foodcalc/${{ env.BIN_NAME }}
SCRIPT_AFTER: echo $RSYNC_STDOUT && sudo /bin/systemctl restart foodcalc