Skip to content

Commit

Permalink
Merge branch 'dev/user-profile' into dev/seonghyeon
Browse files Browse the repository at this point in the history
  • Loading branch information
st42597 authored Mar 23, 2022
2 parents e514025 + 7dd4222 commit 06dee64
Show file tree
Hide file tree
Showing 212 changed files with 13,897 additions and 1,020 deletions.
Binary file added .DS_Store
Binary file not shown.
29 changes: 18 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-20.04
# [Choice] Python version (https://github.com/microsoft/vscode-dev-containers/tree/main/containers/python-3)
ARG VARIANT=3.8-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}

# Install Node 16
ENV NODE_VERSION=16
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \
&& bash -c ". $HOME/.nvm/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& npm install -g typescript yarn"
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="16"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# Install packages from apt
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends vim python3-pip python3-setuptools
RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get -y install --no-install-recommends \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 xauth xvfb
7 changes: 6 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"forwardPorts": [10000],

"postCreateCommand": "./.devcontainer/postCreateCommand.sh",

Expand All @@ -14,10 +15,14 @@
"editorconfig.editorconfig",
"gruntfuggly.todo-tree",
"johnsoncodehk.volar",
"mhutchie.git-graph",
"ms-python.python",
"naumovs.color-highlight",
"oderwat.indent-rainbow",
"pkief.material-icon-theme",
"rangav.vscode-thunder-client"
]
],

// Connect as non-root user (https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user)
"remoteUser": "vscode"
}
26 changes: 23 additions & 3 deletions .devcontainer/docker-compose.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ services:
- DISABLE_HEARTBEAT=1
- JUDGE_SERVER_URL=http://judge-server-dev:8080
- JUDGE_SERVER_TOKEN=CHANGE_THIS

- DISPLAY=:14
- LIBGL_ALWAYS_INDIRECT=0
- CYPRESS_BASE_URL=http://localhost:8080
volumes_from:
- x11-bridge:rw
depends_on:
- x11-bridge
judge-server-dev:
image: skkunpc/judge-server
container_name: judge-server-dev
Expand All @@ -31,8 +37,7 @@ services:
- /tmp
volumes:
- ../backend/data/test_case:/test_case:ro
- ./judge-server/log:/log
- ./judge-server/run:/judger
- judger-data:/judger
environment:
- DISABLE_HEARTBEAT=1
- TOKEN=CHANGE_THIS
Expand All @@ -53,6 +58,21 @@ services:
volumes:
- redis-data:/data

x11-bridge:
image: jare/x11-bridge
volumes:
- "/tmp/.X11-unix:/tmp/.X11-unix:rw"
ports:
- "10000:10000"
restart: always
environment:
- MODE=tcp
- XPRA_HTML=yes
- DISPLAY=:14
- XPRA_TCP_PORT=10000
- XPRA_PASSWORD=CHANGE_THIS

volumes:
postgres-data: null
redis-data: null
judger-data: null
1 change: 1 addition & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ SysOptions.judge_server_token='$JUDGE_SERVER_TOKEN'

# Install Node packages
yarn --cwd /workspace/frontend install
yarn --cwd /workspace/frontend cypress install
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ indent_size = 2

[*.{py,sh,conf}]
indent_size = 4

[*.md]
trim_trailing_whitespace = false
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
- master

jobs:
build-image:
runs-on: ubuntu-18.04
build:
runs-on: ubuntu-latest

steps:
- name: Checkout to repository
Expand All @@ -20,11 +20,11 @@ jobs:
uses: docker/login-action@v1
with:
registry: ghcr.io
username: dotoleeoak
password: ${{ secrets.CR_PAT }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push container image
uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/skku-npc/coding-platform:latest
tags: ghcr.io/skkuding/coding-platform:latest
7 changes: 4 additions & 3 deletions .github/workflows/test-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
# Triggers the workflow on push or pull request events but only for the master branch
pull_request:
paths:
- 'backend/**'
- "backend/**"
- ".github/workflows/test-backend.yml"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -22,8 +23,8 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: '3.7.10' # using SemVer's version range syntax
architecture: 'x64'
python-version: "3.8.10" # using SemVer's version range syntax
architecture: "x64"

- uses: actions/cache@v2
with:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ on:
pull_request:
paths:
- "frontend/**"
- ".github/workflows/test-frontend.yml"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-18.04
env:
working-directory: ./frontend

Expand All @@ -22,7 +23,7 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: '14'
node-version: "14"

- name: Cache Node modules
id: cache-yarn
Expand All @@ -43,7 +44,7 @@ jobs:
- name: Check styles
working-directory: ${{ env.working-directory }}
run: yarn lint --no-fix

- name: Build production files
working-directory: ${{ env.working-directory }}
run: yarn build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,6 @@ typings/

# devcontainer
.devcontainer/data

# MacOS file
.DS_Store
49 changes: 36 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/backend/manage.py",
"args": [
"runserver"
],
"django": true
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Vue.js: Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/frontend/src",
"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
},
{
"name": "Vue.js: Edge",
"type": "msedge",
"request": "launch",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/frontend/src",
"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/backend/manage.py",
"args": [
"runserver",
"--noreload"
],
"django": true
}
]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN yarn install && \
yarn build

# Deploy Stage
FROM python:3.7-alpine3.13
FROM python:3.8.12-alpine3.15

ENV OJ_ENV production
ENV NODE_ENV production
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020-present skkuding

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# SKKU Coding Platform

![issues](https://img.shields.io/github/issues/skku-npc/skku-coding-platform)
![docker](https://img.shields.io/docker/cloud/automated/skkunpc/coding-platform)
![checks](https://img.shields.io/github/checks-status/skku-npc/skku-coding-platform/master)
![python](https://img.shields.io/badge/Python-3.7.10-blue)
![django](https://img.shields.io/badge/Django-3.2.4-darkgreen)
![issues](https://img.shields.io/github/issues/skkuding/skku-coding-platform)
[![build status](https://github.com/skkuding/skku-coding-platform/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/skkuding/skku-coding-platform/actions/workflows/build.yml)
![python](https://img.shields.io/badge/Python-3.8.10-blue)
![django](https://img.shields.io/badge/Django-3.2.12-darkgreen)
![vue](https://img.shields.io/badge/Vue-2.6.11-green)

[QingdaoU OJ](https://github.com/QingdaoU/OnlineJudge)를 기반으로 제작한 성균관대학교 Online Judge 시스템입니다.
Expand All @@ -13,7 +12,7 @@
Docker를 설치하고, docker compose를 실행합니다.

```shell
> git clone https://github.com/skku-npc/skku-coding-platform.git
> git clone https://github.com/skkuding/skku-coding-platform.git
> cd skku-coding-platform
> docker-compose up -d
```
Expand All @@ -23,7 +22,7 @@ Docker를 설치하고, docker compose를 실행합니다.

## Documentation 📚
Wiki를 참고해주세요.
https://github.com/skku-npc/skku-coding-platform/wiki
https://github.com/skkuding/skku-coding-platform/wiki

### 운영진
박민서 [@minseo999](https://github.com/minseo999)
Expand Down
Binary file added backend/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions backend/account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def can_mgmt_all_problem(self):
def is_contest_admin(self, contest):
return self.is_authenticated and (contest.created_by == self or self.admin_type == AdminType.SUPER_ADMIN)

def is_assignment_admin(self, assignment):
return self.is_authenticated and (assignment.created_by == self or self.admin_type == AdminType.SUPER_ADMIN)

class Meta:
db_table = "user"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.4 on 2021-10-30 06:35
# Generated by Django 3.2.5 on 2021-12-26 05:58

from django.db import migrations, models

Expand Down
Empty file added backend/assignment/__init__.py
Empty file.
38 changes: 38 additions & 0 deletions backend/assignment/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 2.2.24 on 2021-07-30 13:44

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import utils.models


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('course', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='Assignment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.TextField()),
('content', utils.models.RichTextField()),
('start_time', models.DateTimeField()),
('end_time', models.DateTimeField()),
('create_time', models.DateTimeField(auto_now_add=True)),
('last_update_time', models.DateTimeField(auto_now=True)),
('visible', models.BooleanField(default=True)),
('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='course.Course')),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'assignment',
'ordering': ('-start_time',),
},
),
]
18 changes: 18 additions & 0 deletions backend/assignment/migrations/0002_alter_assignment_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.5 on 2021-12-26 05:58

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('assignment', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='assignment',
name='id',
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
),
]
Empty file.
Loading

0 comments on commit 06dee64

Please sign in to comment.