Skip to content

Commit d03238e

Browse files
committed
resolve merge conflicts with origin/master
2 parents e0e57ad + 090b566 commit d03238e

File tree

431 files changed

+11211
-64310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

431 files changed

+11211
-64310
lines changed

.csslintrc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,5 @@
55
"ids",
66
"order-alphabetical",
77
"overqualified-elements"
8-
],
9-
"exclude-list": [
10-
"oioioi/base/static/bootstrap-datetimepicker-oioioi",
11-
"oioioi/base/static/bootstrap-markdown",
12-
"oioioi/portals/static/portals/jqtree.css",
13-
"oioioi/timeline/static/jquery-ui"
148
]
159
}

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
/deployment/
2525
/venv*/
2626
/.idea/
27+
/.vscode/
28+
/.fleet/
29+
/dist_webpack/
30+
/node_modules/
2731

2832
# docker specific
2933

.github/workflows/cypress.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
timeout-minutes: 60
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
- name: Install `easy_toolbox.py` requirements
1818
run: |
1919
python -m pip install --upgrade pip

.github/workflows/doc.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v3
13-
- name: Set up Python 3.10
14-
uses: actions/setup-python@v4
12+
- uses: actions/checkout@v4
13+
- name: Set up Python 3.11
14+
uses: actions/setup-python@v5
1515
with:
16-
python-version: '3.10'
16+
python-version: '3.11'
1717

1818
- name: Install apt dependencies
1919
run: |

.github/workflows/nightly.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v3
15-
- name: Set up Python 3.10
16-
uses: actions/setup-python@v4
14+
- uses: actions/checkout@v4
15+
- name: Set up Python 3.11
16+
uses: actions/setup-python@v5
1717
with:
18-
python-version: '3.10'
18+
python-version: '3.11'
1919

2020
- name: Install apt dependencies
2121
run: |

.github/workflows/pytest.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
17-
- name: Set up Python 3.10
18-
uses: actions/setup-python@v4
16+
- uses: actions/checkout@v4
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v5
1919
with:
20-
python-version: '3.10'
20+
python-version: '3.11'
2121

2222
- name: Install apt dependencies
2323
run: |

.github/workflows/translations-download.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v3
20-
- name: Set up Python 3.10
21-
uses: actions/setup-python@v4
19+
- uses: actions/checkout@v4
20+
- name: Set up Python 3.11
21+
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.10'
23+
python-version: '3.11'
2424

2525
- name: Install apt dependencies
2626
run: |

.github/workflows/translations-upload.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v3
20-
- name: Set up Python 3.10
21-
uses: actions/setup-python@v4
19+
- uses: actions/checkout@v4
20+
- name: Set up Python 3.11
21+
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.10'
23+
python-version: '3.11'
2424

2525
- name: Install apt dependencies
2626
run: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@
2626
/.idea/
2727
/.vscode/
2828
/.fleet/
29+
/dist_webpack/
30+
/node_modules/

.jshintignore

Lines changed: 0 additions & 17 deletions
This file was deleted.

.jshintrc

Lines changed: 0 additions & 18 deletions
This file was deleted.

Dockerfile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10 AS base
1+
FROM python:3.11 AS base
22

33
ENV PYTHONUNBUFFERED 1
44

@@ -25,7 +25,9 @@ RUN apt-get update && \
2525
sox \
2626
flite \
2727
locales \
28-
python3-pip && \
28+
python3-pip \
29+
nodejs \
30+
npm && \
2931
apt-get clean
3032

3133
# This is oioioi user linux uid. Setting it is useful in development.
@@ -54,7 +56,7 @@ USER oioioi
5456
ENV PATH $PATH:/home/oioioi/.local/bin/
5557

5658
ENV BERKELEYDB_DIR /usr
57-
RUN pip3 install --user psycopg2-binary==2.8.6 twisted uwsgi
59+
RUN pip3 install --user psycopg2-binary twisted uwsgi
5860
RUN pip3 install --user bsddb3==6.2.7
5961

6062
WORKDIR /sio2/oioioi
@@ -64,16 +66,23 @@ RUN pip3 install -r requirements.txt --user filetracker[server]
6466
COPY --chown=oioioi:oioioi requirements_static.txt ./
6567
RUN pip3 install -r requirements_static.txt --user
6668

69+
# Installing node dependencies
70+
ENV PATH $PATH:/sio2/oioioi/node_modules/.bin
71+
72+
COPY --chown=oioioi:oioioi package.json package-lock.json ./
73+
RUN npm ci
74+
6775
COPY --chown=oioioi:oioioi . /sio2/oioioi
6876

77+
RUN npm run build
6978
RUN oioioi-create-config /sio2/deployment
7079

7180
WORKDIR /sio2/deployment
7281

7382
RUN mkdir -p /sio2/deployment/logs/{supervisor,runserver}
7483

7584
# The stage below is independent of base and can be built in parallel to optimize build time.
76-
FROM python:3.10 AS development-sandboxes
85+
FROM python:3.11 AS development-sandboxes
7786

7887
ENV DOWNLOAD_DIR=/sio2/sandboxes
7988
ENV MANIFEST_URL=https://downloads.sio2project.mimuw.edu.pl/sandboxes/Manifest

INSTALL.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ First, ensure that all dependencies are installed:
1313
* latex packages (*texlive-latex-extra*, *texlive-fonts-recommended*, *tex-gyre*,
1414
*texlive-pstricks*, *lmodern*),
1515
* Berkeley DB library (Ubuntu package: *libdb-dev*)
16+
* Node.js and npm (Ubuntu packages: *nodejs*, *npm*),
1617

1718
It should be easier to begin with a separate folder at first::
1819

@@ -29,7 +30,9 @@ Then OIOIOI and its dependencies can be installed using the following commands::
2930
git clone git://github.com/sio2project/oioioi.git
3031
cd oioioi
3132
pip install -r requirements.txt
32-
33+
npm install
34+
npm run build
35+
3336
OIOIOI is a set of Django applications, therefore you need to create a folder with
3437
Django settings and other deployment configuration::
3538

UPGRADING.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,35 @@ Then run::
1212

1313
and restart the judging machines.
1414

15+
Fast Django Migration to 5.2 (Important for Large OIOIOI Instances)
16+
-----------------------------------
17+
18+
The following migrations require removing an index (created by the deprecated ``index_together``) and creating a new one:
19+
20+
* ``oi/migrations/0008_sync_indexes_state.py``
21+
* ``forum/migrations/0013_sync_indexes_state.py``
22+
* ``contests/migrations/0021_sync_indexes_state.py``
23+
24+
Since dropping and then creating an index takes a long time for instances with a very large number of submissions, you can speed this up as follows:
25+
26+
Because these indexes are in the database schema, you should mark these migrations (``0008_sync_indexes_state.py``, ``0021_sync_indexes_state.py``, ``0013_sync_indexes_state.py``) as fake.
27+
See the `django docs <https://docs.djangoproject.com/en/5.2/ref/django-admin/#cmdoption-migrate-fake>`_ for details.
28+
Then, rename the existing indexes created by ``IndexTogether`` to the corresponding names specified in these migrations.
29+
You can manually identify the indexes by checking which two fields they cover.
30+
31+
For example, an index named ``forum_post_thread_id_add_date_6d8ec21d_idx`` should be renamed to ``forum_post_thread__54acb8_idx``.
32+
Similarly, rename the other indexes so that the database state is correct, i.e., the database contains indexes with the names specified in the migrations.
33+
34+
After these steps, you will achieve a consistent database state without waiting a long time for the migrations to complete.
35+
36+
::
37+
38+
python manage.py migrate oi 0008 --fake
39+
40+
python manage.py migrate forum 0021 --fake
41+
42+
python manage.py migrate contests 0013 --fake
43+
1544
Changes in the deployment directory
1645
-----------------------------------
1746

conftest.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,20 @@ def pytest_collection_modifyitems(config, items):
3838

3939

4040
# Removing links column from html report
41-
@pytest.mark.optionalhook
41+
@pytest.hookimpl(optionalhook=True)
4242
def pytest_html_results_table_header(cells):
4343
cells.pop()
4444

4545

4646
# Removing links column from html report
47-
@pytest.mark.optionalhook
47+
@pytest.hookimpl(optionalhook=True)
4848
def pytest_html_results_table_row(report, cells):
4949
cells.pop()
50+
51+
@pytest.fixture()
52+
def require_migrations_flag(request):
53+
config = request.config
54+
nomigrations_enabled_flag = config.getoption("nomigrations")
55+
56+
if nomigrations_enabled_flag:
57+
pytest.skip("Test requires the --migrations flag to run.")

docker-compose-dev.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ x-common-envs: &common-envs
55

66
services:
77
db:
8-
image: library/postgres:12.2
8+
image: library/postgres:14.17
99
environment:
1010
POSTGRES_USER: "oioioi"
1111
POSTGRES_PASSWORD: "password"
@@ -40,6 +40,9 @@ services:
4040
# - "7887:7887"
4141
volumes:
4242
- .:/sio2/oioioi
43+
# use docker's node_modules and dist_webpack instead of the host ones
44+
- node_modules-dev:/sio2/oioioi/node_modules
45+
- dist_webpack-dev:/sio2/oioioi/dist_webpack
4346
- filetracker-data-dev:/sio2/deployment/media
4447
# - ./deployment:/sio2/deployment
4548
stop_grace_period: 3m
@@ -68,3 +71,5 @@ services:
6871
volumes:
6972
postgress-data-dev:
7073
filetracker-data-dev:
74+
node_modules-dev:
75+
dist_webpack-dev:

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ x-common-envs: &common-envs
55

66
services:
77
db:
8-
image: library/postgres:12.2
8+
image: library/postgres:14.17
99
environment:
1010
POSTGRES_USER: "oioioi"
1111
POSTGRES_PASSWORD: "password"

easy_toolbox.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
("up", "Run all SIO2 containers", "up -d"),
2828
("down", "Stop and remove all SIO2 containers", "down"),
2929
("wipe", "Stop all SIO2 containers and DESTROY all data", "down -v", True),
30-
("run", "Run server", "{exec} web python3 manage.py runserver 0.0.0.0:8000"),
30+
("run", "Run django server and webpack",
31+
'{exec} web conc -n js,py -c yellow,green -k "npm --prefix ../oioioi run -s watch" "python3 manage.py runserver 0.0.0.0:8000"'),
3132
("stop", "Stop all SIO2 containers", "stop"),
3233
("bash", "Open command prompt on web container.", "{exec} web bash"),
3334
("exec", "Run a command in the web container.", "{exec} web {extra_args}"),
@@ -42,6 +43,8 @@
4243
"{exec} 'web' ../oioioi/test.sh oioioi/problems --cov-report term --cov-report xml:coverage.xml --cov=oioioi {extra_args}"),
4344
("cypress-apply-settings", "Apply settings for CyPress.",
4445
'{exec} web bash -c "echo CAPTCHA_TEST_MODE=True >> settings.py"'),
46+
("npm", "Run npm command.", "{exec} web npm --prefix ../oioioi {extra_args}"),
47+
("eslint", "Run javascript linter.", "{exec} web npm --prefix ../oioioi run lint"),
4548
]
4649

4750
longest_command_arg = max([len(command[0]) for command in RAW_COMMANDS])

eslint.config.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { defineConfig } from "eslint/config";
2+
import globals from "globals";
3+
import js from "@eslint/js";
4+
5+
6+
export default defineConfig([
7+
{
8+
files: ["oioioi/**/*.js"],
9+
ignores: [
10+
"**/*.min.js",
11+
"oioioi/liveranking/**",
12+
"oioioi/notifications/server/**",
13+
],
14+
languageOptions: {
15+
globals: {
16+
...globals.browser,
17+
$: "readonly",
18+
jQuery: "readonly",
19+
Cookies: "readonly",
20+
Highcharts: "readonly",
21+
22+
django: "readonly",
23+
gettext: "readonly",
24+
ngettext: "readonly",
25+
interpolate: "readonly",
26+
27+
oioioi_base_url: "readonly",
28+
}
29+
},
30+
plugins: { js },
31+
extends: ["js/recommended"]
32+
},
33+
]);

0 commit comments

Comments
 (0)