[pre-commit.ci] pre-commit autoupdate #178
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: Test Backend | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- Backend/**/*.py | |
pull_request: | |
branches: | |
- master | |
paths: | |
- Backend/**/*.py | |
jobs: | |
pytest: | |
name: Pytest | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set Up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install Python Requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
working-directory: Backend | |
- name: Test with pytest | |
run: | | |
# install pytest and useful wrappers | |
pip install pytest | |
pip install pytest-asyncio | |
pip install pytest_mock | |
pip install aiosqlite | |
pip install httpx | |
# make sure the db runs | |
docker-compose run -d -p 5432:5432 postgres | |
docker-compose run -d -p 6379:6379 redis | |
# add the env varible we need to connect to the db | |
export $(grep -v '^#' .env | xargs -d '\n') | |
# change the redis env var | |
export REDIS_HOST=localhost | |
# add the dir to pythonpath | |
export PYTHONPATH="${PYTHONPATH}:/home/runner/work/elevatorbot" | |
# rename the settings file | |
sudo mv rename_to_settings.toml settings.toml | |
# run tests | |
pytest Backend |