Provenance, database connection #71
This file contains hidden or 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: 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 | |
| env: | |
| SNPIT_CONFIG: /home/snpit_utils/snpit_utils/tests/test_snpit_utils.yaml | |
| 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 | |
| git clone https://github.com/Roman-Supernova-PIT/environment.git | |
| # snpit_utils doesn't actually use the photometry test data, | |
| # but the docker-compose file needs the directory | |
| mkdir photometry_test_data | |
| - name: ls | |
| run: | | |
| cd /home/runner/work | |
| ls | |
| ls snpit_utils | |
| - name: pull docker images | |
| run: | | |
| cd /home/runner/work/environment/test-docker-environment | |
| docker compose pull mailhog postgres webserver shell | |
| - name: run test | |
| run: | | |
| cd /home/runner/work/environment/test-docker-environment | |
| docker compose up -d webserver shell | |
| 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 && pytest -v' | |
| docker compose down -v |