-
-
Save Bogdanp/4278bcd67402d2c40a84099fb5357be9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
log() { | |
printf "[%s] %s\n" "$(date)" "$@" | |
} | |
log "Installing postgres..." | |
echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgdg.list | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - | |
apt-get update -y && apt-get install -y --no-install-recommends postgresql-11 | |
echo "local all postgres peer" > /etc/postgresql/11/main/pg_hba.conf | |
echo "host all all 127.0.0.1/32 trust" >> /etc/postgresql/11/main/pg_hba.conf | |
service postgresql start | |
log "Setting up postgres user and db..." | |
echo "create user matchacha with password 'matchacha' login" | psql -Upostgres -h127.0.0.1 | |
echo "create database matchacha_tests" | psql -Upostgres -h127.0.0.1 | |
echo "grant all privileges on database matchacha_tests to matchacha" | psql -Upostgres -h127.0.0.1 | |
log "Downloading libargon2..." | |
pushd /tmp | |
wget https://github.com/P-H-C/phc-winner-argon2/archive/20171227.tar.gz | |
tar xzf 20171227.tar.gz | |
log "Installing libargon2..." | |
pushd phc-winner-argon2-20171227 | |
make && make install | |
popd && popd | |
log "Checking out workspace..." | |
pushd "$GITHUB_WORKSPACE" | |
log "Creating static folder..." | |
mkdir -p static | |
log "Installing app and its dependencies..." | |
raco pkg install --batch --auto matchacha/ matchacha-tests/ | |
log "Running raco setup on the app..." | |
raco setup --tidy --check-pkg-deps --unused-pkg-deps matchacha tests/matchacha | |
log "Migrating database..." | |
raco north migrate -uf postgres://matchacha:matchacha@127.0.0.1:5432/matchacha_tests | |
log "Testing app..." | |
# shellcheck disable=SC2046 | |
env $(xargs < .env.default) raco test -j 8 matchacha-tests/ || \ | |
("$GITHUB_WORKSPACE"/.github/actions/notify.sh "Version '$GITHUB_SHA' tests failed."; exit 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment