8000 Run the backend unit tests for every PR by elisescu · Pull Request #311 · Metaculus/metaculus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Run the backend unit tests for every PR #311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/test.yml

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Run Backend Unit Tests

on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- "main"

jobs:
backend-unit-tests:
runs-on: ubuntu-latest
environment: testing_env
env:
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/test_metaculus"
services:
db:
image: pgvector/pgvector:pg16
env:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: test_metaculus
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: "bitnami/redis:7.2.5"
env:
ALLOW_EMPTY_PASSWORD: yes
ports:
- 6379:6379
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12.3"
- name: Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: "Run he backend unit tests"
run: poetry run pytest ./tests
0