Skip to content

Fix Github Actions

Fix Github Actions #19

Workflow file for this run

name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
DATABASE_URL: postgres://dennis@localhost/food_calc_testing
jobs:
build:
runs-on: ubuntu-latest
environment: ssh
services:
postgres:
image: postgres:alpine
env:
POSTGRES_USER: dennis
POSTGRES_DB: food_calc_testing
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_INITDB_ARGS: "--locale=en_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 dennis --no-password -f $migration food_calc_testing
done
- name: Load Sample Data
run: psql -p 5432 -h 127.0.0.1 -U dennis --no-password -f foodlib/sample_data/food_calc.sql food_calc_testing
#- name: Build
# run: cargo build --verbose --release
#- name: Run tests
# run: cargo test --verbose
#- 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/
# TARGET: /srv/foodcalc
# SCRIPT_AFTER: echo $RSYNC_STDOUT