-
Notifications
You must be signed in to change notification settings - Fork 39
135 lines (111 loc) · 3.23 KB
/
hypha-ci.yml
File metadata and controls
135 lines (111 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Hypha CI
on:
pull_request:
branches:
- main
push:
branches:
- main
- test
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version-file: ".python-version"
- name: Install pre-commit
run: python -m pip install pre-commit
- uses: actions/cache@v5
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files
django-checks:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
DATABASE_URL: postgres://hypha:hypha@localhost/hypha?sslmode=disable
DJANGO_SETTINGS_MODULE: hypha.settings.test
SEND_MESSAGES: false
PYTHONDONTWRITEBYTECODE: 1
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: hypha
POSTGRES_PASSWORD: hypha
POSTGRES_DB: hypha
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install python dependencies
run: |
uv venv
uv sync --frozen
- name: Create static_compiled dir
run: mkdir hypha/static_compiled
- name: Check Django migrations
run: |
uv run python manage.py makemigrations --dry-run --verbosity=3
uv run python manage.py makemigrations --check
- name: Run django collectstatic
run: uv run python manage.py collectstatic --noinput --no-post-process --verbosity=1
- name: Check Django setup
run: uv run python manage.py check
test-be:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
DATABASE_URL: postgres://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: postgres:17
env:
POSTGRES_USER: hypha
POSTGRES_PASSWORD: hypha
POSTGRES_DB: hypha
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
group: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install python dependencies
run: |
uv venv
uv sync --frozen --group translate
- name: Create static_compiled dir
run: mkdir hypha/static_compiled
- name: Run pytest
run: |
uv run pytest --splits 4 --group ${{ matrix.group }} --durations-path=.test_durations