-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c0821ad
Showing
693 changed files
with
299,087 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cover 97% |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
COMPRESS_OUTPUT_DIR = 'cache' | ||
STATICFILES_FINDERS += ('compressor.finders.CompressorFinder',) | ||
STATIC_ROOT = os.path.join(BASE_DIR, 'static') | ||
|
||
CACHES = { | ||
'default': { | ||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' | ||
} | ||
} | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.mysql', | ||
'NAME': 'dmoj', | ||
'USER': 'root', | ||
'PASSWORD': 'root', | ||
'HOST': 'localhost', | ||
'PORT': '3306', | ||
'OPTIONS': { | ||
'charset': 'utf8mb4', | ||
}, | ||
}, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
application-import-names = dmoj,judge,django_ace | ||
import-order-style = pycharm | ||
enable-extensions = G | ||
ignore = | ||
# line break occurred after a binary operator | ||
W504, | ||
# allow only generator_stop and annotations future imports | ||
FI10,FI11,FI12,FI13,FI14,FI15,FI16,FI17,FI18,FI55,FI58, | ||
# missing trailing comma in Python 2 only | ||
C814, | ||
per-file-ignores = | ||
# F401: unused imports, ignore in all __init__.py | ||
# F403: import * | ||
./*/__init__.py:F401,F403 | ||
# F405: name comes from import * | ||
./judge/management/commands/runmoss.py:F403,F405 | ||
# E501: line too long, ignore in migrations | ||
./judge/migrations/*.py:E501 | ||
exclude = | ||
# belongs to the user | ||
./dmoj/local_settings.py, | ||
# belongs to the user | ||
./dmoj/local_urls.py, | ||
# is actually a fragment to be included by settings.py | ||
./.ci.settings.py, | ||
fc_* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
- OS: [e.g. iOS] | ||
- Browser [e.g. chrome, safari] | ||
- Version [e.g. 22] | ||
|
||
**Smartphone (please complete the following information):** | ||
- Device: [e.g. iPhone6] | ||
- OS: [e.g. iOS8.1] | ||
- Browser [e.g. stock browser, safari] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Description | ||
|
||
_Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context._ | ||
|
||
_Please remove options that are not relevant_ | ||
Type of change: bug fix, new feature, refactor, or something else? | ||
|
||
## What | ||
|
||
What does the PR do? | ||
|
||
## Why | ||
|
||
Why this PR is needed? | ||
|
||
Fixes # (issue) | ||
|
||
# How Has This Been Tested? | ||
|
||
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration | ||
|
||
- [ ] Test A | ||
- [ ] Test B | ||
|
||
# Checklist | ||
|
||
_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._ | ||
|
||
- [ ] I have explained the purpose of this PR. | ||
- [ ] I have performed a self-review of my own code | ||
- [ ] I have commented my code, particularly in hard-to-understand areas | ||
- [ ] I have made corresponding changes to the README/documentation | ||
- [ ] Any dependent changes have been merged and published in downstream modules | ||
- [ ] Informed of breaking changes, testing and migrations (if applicable). | ||
- [ ] Attached screenshots (if applicable). | ||
|
||
By submitting this pull request, I confirm that my contribution is made under the terms of the AGPL-3.0 License. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: build | ||
on: [push, pull_request] | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install flake8 | ||
run: pip install flake8 flake8-import-order flake8-future-import flake8-commas flake8-logging-format flake8-quotes | ||
- name: Lint with flake8 | ||
run: | | ||
flake8 --version | ||
flake8 | ||
unit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Cache pip | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: pip-${{ runner.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('requirements.txt') }} | ||
- name: Install unit test dependencies | ||
run: | | ||
pip install wheel | ||
pip install -r requirements.txt | ||
pip install coverage | ||
cp .ci.settings.py dmoj/local_settings.py | ||
- name: Start MySQL | ||
run: sudo systemctl start mysql.service | ||
- name: Run unit tests | ||
run: coverage run --source=. manage.py test judge | ||
- name: Generate coverage report | ||
run: coverage xml | ||
styles: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.x' | ||
- name: Install npm packages | ||
run: npm ci | ||
- name: Build style.css | ||
run: ./make_style.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: caniuse | ||
on: | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
jobs: | ||
caniuse: | ||
if: github.repository == 'DMOJ/online-judge' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download Can I use... data | ||
run: | | ||
curl -s https://raw.githubusercontent.com/Fyrd/caniuse/master/data.json | python3 -m json.tool > resources/caniuse.json | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.REPO_SCOPED_TOKEN }} | ||
author: dmoj-build <[email protected]> | ||
committer: dmoj-build <[email protected]> | ||
title: Import latest Can I use... data | ||
commit-message: Import latest Can I use... data | ||
body: This PR has been auto-generated to pull in the latest copy of Can I use... `data.json` from [upstream](https://github.com/Fyrd/caniuse/blob/master/data.json). | ||
labels: compat | ||
reviewers: Xyene, quantum5 | ||
branch: update-caniuse |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: compilemessages | ||
on: | ||
push: | ||
paths: | ||
- 'locale/**' | ||
pull_request: | ||
paths: | ||
- 'locale/**' | ||
jobs: | ||
compilemessages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Checkout submodules | ||
run: | | ||
git submodule init | ||
git submodule update | ||
- name: Install requirements | ||
run: | | ||
sudo apt-get install gettext | ||
pip install -r requirements.txt | ||
pip install pymysql | ||
- name: Check .po file validity | ||
run: | | ||
fail=0 | ||
while read -r file; do | ||
if ! msgfmt --check-format "$file"; then | ||
fail=$((fail + 1)) | ||
fi | ||
done < <(find locale -name '*.po') | ||
exit "$fail" | ||
shell: bash | ||
- name: Compile messages | ||
run: | | ||
echo "STATIC_ROOT = '/tmp'" > dmoj/local_settings.py | ||
python manage.py compilemessages |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: updatemessages | ||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
jobs: | ||
updatemessages: | ||
if: github.repository == 'DMOJ/online-judge' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Checkout submodules | ||
run: | | ||
git submodule init | ||
git submodule update | ||
- name: Install requirements | ||
run: | | ||
sudo apt-get install gettext | ||
curl -O https://artifacts.crowdin.com/repo/deb/crowdin.deb | ||
sudo dpkg -i crowdin.deb | ||
pip install -r requirements.txt | ||
pip install pymysql | ||
- name: Update English source strings | ||
run: | | ||
echo "STATIC_ROOT = '/tmp'" > dmoj/local_settings.py | ||
python manage.py makemessages -l en -e py,html,txt | ||
python manage.py makemessages -l en -d djangojs | ||
- name: Download strings from Crowdin | ||
env: | ||
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} | ||
run: | | ||
cat > crowdin.yaml <<EOF | ||
project_identifier: dmoj | ||
files: | ||
- source: /locale/en/LC_MESSAGES/django.po | ||
translation: /locale/%two_letters_code%/LC_MESSAGES/django.po | ||
languages_mapping: | ||
two_letters_code: | ||
zh-CN: zh_Hans | ||
zh-TW: zh_Hant | ||
sr-CS: sr_Latn | ||
- source: /locale/en/LC_MESSAGES/djangojs.po | ||
translation: /locale/%two_letters_code%/LC_MESSAGES/djangojs.po | ||
languages_mapping: | ||
two_letters_code: | ||
zh-CN: zh_Hans | ||
zh-TW: zh_Hant | ||
sr-CS: sr_Latn | ||
EOF | ||
echo "api_key: ${CROWDIN_API_TOKEN}" >> crowdin.yaml | ||
crowdin download | ||
rm crowdin.yaml | ||
- name: Cleanup | ||
run: | | ||
rm -rf src/ | ||
git add locale | ||
git checkout . | ||
git clean -fd | ||
git reset | ||
- name: Remove useless changes | ||
run: | | ||
set -eu | ||
i18n_head=$(git rev-parse --verify -q origin/update-i18n || echo "HEAD") | ||
echo "Comparing against: $i18n_head" | ||
changed=0 | ||
while IFS= read -r -d $'\0' file; do | ||
if git diff -s --exit-code "$file"; then | ||
continue | ||
fi | ||
if git diff "$i18n_head" -- "$file" | tail -n +5 2>/dev/null | grep -qP '^[-+](?!"PO-Revision-Date:|"POT-Creation-Date:)'; then | ||
echo "Changed: $file" | ||
changed=1 | ||
else | ||
echo "No material change: $file" | ||
git checkout "$i18n_head" -- "$file" > /dev/null 2>&1 | ||
fi | ||
done < <(git ls-files -z 'locale/*/LC_MESSAGES/*.po') | ||
if [ "$changed" = 0 ]; then | ||
git reset --hard "$i18n_head" | ||
fi | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.REPO_SCOPED_TOKEN }} | ||
author: dmoj-build <[email protected]> | ||
committer: dmoj-build <[email protected]> | ||
commit-message: 'i18n: update translations from Crowdin' | ||
title: Update translations from Crowdin | ||
body: This PR has been auto-generated to pull in latest translations from [Crowdin](https://translate.dmoj.ca). | ||
labels: i18n, enhancement | ||
reviewers: Xyene, quantum5 | ||
branch: update-i18n |
Oops, something went wrong.