Merge pull request #1610 from ResearchHub/ci/add-worker-deployment #2684
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: Automated Tests | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
types: [opened, reopened, synchronize] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 45 | |
services: | |
postgres: | |
image: postgres:16.1-alpine | |
env: | |
POSTGRES_DB: researchhub | |
POSTGRES_USER: rh_developer | |
POSTGRES_PASSWORD: not_secure | |
DB_PORT: 5432 | |
DB_HOST: localhost | |
DB_USER: rh_developer | |
DB_PASS: not_secure | |
APP_ENV: test | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
redis: | |
image: redis:6.2-alpine | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8.5" | |
- name: Updating pip | |
working-directory: ./src | |
run: | | |
pip install poetry | |
poetry run pip install --upgrade pip | |
poetry run pip install -U pip setuptools | |
- name: Install Dependencies | |
working-directory: ./src | |
run: | | |
poetry install | |
- name: Run Tests | |
working-directory: ./src | |
run: | | |
cp config/ci/* config | |
poetry run python manage.py migrate | |
poetry run python manage.py collectstatic --noinput | |
poetry run python manage.py test --verbosity=2 |