Add new workflow for Request With Review #3589
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: Hypha CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
- test | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version-file: ".python-version" | |
# Fix for mirror-eslint pre-commit hook not able to find "globals" package | |
- run: npm install globals | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
test-be: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
env: | |
DATABASE_URL: postgresql://hypha:hypha@localhost/hypha?sslmode=disable | |
DJANGO_SETTINGS_MODULE: hypha.settings.test | |
SEND_MESSAGES: false | |
PYTHONDONTWRITEBYTECODE: 1 | |
APPLICATION_TRANSLATIONS_ENABLED: 1 # Run tests for machine translation logic | |
services: | |
postgres: | |
image: bitnami/postgresql:14 | |
env: | |
POSTGRESQL_USERNAME: hypha | |
POSTGRESQL_PASSWORD: hypha | |
POSTGRESQL_DATABASE: hypha | |
POSTGRESQL_FSYNC: "off" | |
POSTGRESQL_REPLICATION_USE_PASSFILE: "no" | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd "pg_isready -d hypha -U hypha -p 5432" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
matrix: | |
group: [1, 2, 3] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version-file: ".python-version" | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "requirements**.txt" | |
- name: Install python dependencies | |
run: | | |
uv venv | |
uv pip install -r requirements-dev.txt | |
uv pip install -r requirements-translate.txt | |
- name: Check Django migrations | |
if: matrix.group == 1 | |
run: | | |
.venv/bin/python manage.py makemigrations --dry-run --verbosity=3 | |
.venv/bin/python manage.py makemigrations --check | |
- name: Run django checks | |
if: matrix.group == 2 | |
run: | | |
.venv/bin/python manage.py collectstatic --noinput --no-post-process --verbosity=1 | |
- name: Check Django Setup | |
if: matrix.group == 3 | |
run: | | |
.venv/bin/python manage.py check | |
- name: Run pytest | |
run: .venv/bin/pytest --splits 3 --group ${{ matrix.group }} |