Skip to content

Provenance, database connection #74

Provenance, database connection

Provenance, database connection #74

name: Run snpit_utils Tests
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
tests:
name: run snpit_utils tests in docker container
runs-on: ubuntu-latest
steps:
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
- name: checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: run ruff
uses: astral-sh/ruff-action@v3
- name: log into github container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: cleanup
run: |
# try to save HDD space on the runner by removing some unneeded stuff
# ref: https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: pull environment archive
run: |
cd /home/runner/work/snpit_utils
git clone https://github.com/Roman-Supernova-PIT/environment.git
# snpit_utils tests don't actually use the photometry test data,
# but the docker-compose file needs the directory
mkdir photometry_test_data
- name: pull docker images
run: |
cd /home/runner/work/snpit_utils/environment/test-docker-environment
docker compose pull mailhog postgres webserver shell
- name: run test
run: |
cd /home/runner/work/snpit_utils/environment/test-docker-environment
docker compose up -d webserver shell
echo "--------"
docker compose exec shell bash -c 'cd /home && ls -lF'
echo "--------"
docker compose exec shell bash -c 'cd /home/snpit_utils && ls -lF'
echo "--------"
docker compose exec shell bash -c 'cd /home/snpit_utils && pip install -e .[test]'
docker compose exec shell bash -c 'cd /home/snpit_utils/snpit_utils/tests && SNPIT_CONFIG=test_snpit_utils.yaml pytest -v'
docker compose down -v