Took me a bit of fiddling to figure out how to test my PostgreSQL+Vapor app on Github actions. Posting the basic workflow file for future googlers:
name: basic-ci
on: push
env:
LOG_LEVEL: info
DATABASE_USERNAME: vapor_username
DATABASE_PASSWORD: vapor_password
DATABASE_NAME: vapor_database
jobs:
linux:
runs-on: ubuntu-latest
env:
DATABASE_HOST: postgres
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: vapor_username
POSTGRES_PASSWORD: vapor_password
POSTGRES_DB: vapor_database
container: swift:5.4-focal
steps:
- name: checkout
uses: actions/checkout@v2
- name: run tests
run: swift test
macos:
runs-on: macos-11
steps:
- name: setup xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 12.5
- name: checkout
uses: actions/checkout@v2
- name: start postgres
# if this isn't reliable, try this approach
# https://gist.github.com/jaredh159/634285e52456fefc9f04fb2b4bd3af28
run: brew services start postgres; sleep 5 && pg_isready
- name: create db user and db
run: |
psql --command="CREATE USER vapor_username PASSWORD 'vapor_password'" --command="\du" postgres
createdb --owner=vapor_username vapor_database
- name: run tests
run: swift test
The Gertrude mac app helps you protect your kids online with strict internet filtering that you can manage from your own computer or phone, plus remote monitoring of screenshots and keylogging. $10/mo, with a 21 day free trial.