Skip to content

Merge pull request #2740 from ResearchHub/feat/item-export #6474

Merge pull request #2740 from ResearchHub/feat/item-export

Merge pull request #2740 from ResearchHub/feat/item-export #6474

name: Automated Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 45
services:
postgres:
image: postgres:16.3-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
opensearch:
image: opensearchproject/opensearch:2.19.3
env:
discovery.type: single-node
DISABLE_SECURITY_PLUGIN: "true"
ports:
- 9200:9200
steps:
- name: Check out sources
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
run: uv python install 3.13
- name: Install Dependencies
run: uv sync --all-extras
- name: Run Tests
working-directory: ./src
run: |
cp config/ci/* config
uv run python manage.py migrate
uv run python manage.py collectstatic --noinput
uv run python manage.py opensearch index rebuild --force
uv run coverage run manage.py test --verbosity=2
uv run coverage xml -o coverage.xml
- name: Upload Coverage Report to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./src/coverage.xml