Drop leftover test_db at session teardown (closes #43)
#159
Workflow file for this run
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
| # Built from: | |
| # https://docs.github.com/en/actions/guides/building-and-testing-python | |
| # https://github.com/snok/install-poetry#workflows-and-tips | |
| name: Build and test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: '3.10' | |
| - name: Install tox | |
| run: pipx install tox | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: lint | |
| run: make lint | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [ '3.9', '3.10', '3.11', '3.12' ] | |
| services: | |
| # Spin up a MongoDB the live-DB tests can connect to. The host port is | |
| # 27022 to match the value hardcoded in | |
| # tests/test_linkml_store_client_connections.py (which on `main` still | |
| # reads `MONGO_PORT = 27022` as a module-level constant); the env-reading | |
| # tests also pick up port 27022 via the MONGO_PORT env on the test step. | |
| # After #22's port-from-env change lands on `main`, this port choice | |
| # becomes arbitrary and can move to 27017. | |
| mongo: | |
| image: mongo:7 | |
| ports: | |
| - 27022:27017 | |
| env: | |
| MONGO_INITDB_ROOT_USERNAME: admin | |
| MONGO_INITDB_ROOT_PASSWORD: testpass | |
| options: >- | |
| --health-cmd "mongosh -u admin -p testpass --authenticationDatabase admin --eval 'db.adminCommand({ping:1})' --quiet" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ts-graphviz/setup-graphviz@b1de5da23ed0a6d14e0aeee8ed52fdd87af2363c # v2.0.2 | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'poetry' | |
| - name: Install dependencies | |
| run: poetry install --all-extras | |
| - name: Run test suite | |
| env: | |
| MONGO_HOST: localhost | |
| MONGO_PORT: '27022' | |
| MONGO_USERNAME: admin | |
| MONGO_PASSWORD: testpass | |
| MONGO_DBNAME: nmdc | |
| MONGO_DB: nmdc | |
| ENABLE_DB_TESTS: 'true' | |
| run: make test |