fix log imports #543
Workflow file for this run
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]tests' | |
# only run on push to branch, not on tags | |
on: | |
push: | |
branches: | |
- '*' | |
jobs: | |
model-module-import: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install pydantic as the sole dependency | |
run: | | |
python -m pip install -U pip | |
echo "pydantic<2" > requirements.txt | |
pip install -r requirements.txt | |
- name: Attempt to import model, should succeed. | |
run: python -c "import api.models" | |
server: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
ports: | |
# Opens tcp port 6379 on the host and service container | |
- 6379:6379 | |
env: | |
SIIBRA_API_REDIS_HOST: localhost | |
SIIBRA_API_REDIS_PORT: 6379 | |
SIIBRA_API_ROLE: server | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install server dependency | |
run: | | |
python -m pip install -U pip | |
pip install -r requirements/server.txt | |
- name: Print config, for debug purpose | |
run: | | |
python -c "import api.siibra_api_config as foo; print([(key, getattr(foo, key)) for key in foo.__dir__() if key.isupper()])" | |
- name: Try to start server and ping server | |
run: | | |
uvicorn api.server:api --port 8000 & sleep 10s | |
curl -v http://localhost:8000/v3_0/docs | |
test: | |
runs-on: ubuntu-latest | |
env: | |
# automatically set by github action | |
# only included here for clarity (if user would like to run tests locally) | |
CI: true | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
echo "Using github.ref: $GITHUB_REF" | |
pip install -r requirements/all.txt | |
- name: Install test dependecies | |
run: pip install pytest pytest-asyncio httpx mock coverage pytest-cov | |
- name: Run tests | |
run: pytest test | |
- name: Run e2e | |
run: pytest e2e_test |