schema setup test script initial commit #10
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
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:latest | ||
env: | ||
POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | ||
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Conda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: myenv | ||
environment-file: environment.yml | ||
python-version: 3.8 | ||
auto-activate-base: false | ||
- name: Cache Conda dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: ${{ runner.os }}-conda-${{ hashFiles('**/environment.yml') }} | ||
restore-keys: | | ||
${{ runner.os }}-conda- | ||
- name: Install Conda dependencies | ||
run: | | ||
conda env create -f environment.yml | ||
source activate my-env | ||
- name: Run migrations | ||
env: | ||
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
POSTGRES_HOST: localhost | ||
POSTGRES_PORT: 5432 | ||
POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | ||
run: | | ||
psql -h $POSTGRES_HOST -U $POSTGRES_USER -d $POSTGRES_DB -a -f /home/prometheus/versus_rex/postgresql/migrations/v1_11-05-23_migrations_script.py | ||
- name: Run tests | ||
env: | ||
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
POSTGRES_HOST: localhost | ||
POSTGRES_PORT: 5432 | ||
POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | ||
run: | | ||
# Run your test scripts here, for example: | ||
pytest | ||