Skip to content

Fix Github Actions

Fix Github Actions #28

Workflow file for this run

name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
DATABASE_URL: postgres://postgres@localhost/food_calc_testing
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: Check Runner Locale
run: locale -a
- name: Install Locale
run: |
sudo apt install locales &&
sudo localedef -i de_DE -c -f UTF-8 -A /usr/share/locale/locale.alias de_DE.UTF-8
- name: Check database Locale
run: psql -p 5432 -h 127.0.0.1 -U postgres --no-password -l
- 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: Load Sample Data
run: psql -p 5432 -h 127.0.0.1 -U postgres --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