mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-23 19:38:41 +00:00
Compare commits
6 Commits
dd6b22258b
...
2dfe735c78
Author | SHA1 | Date | |
---|---|---|---|
2dfe735c78 | |||
678889ba4f | |||
e9ade3bf58 | |||
afda9290fa | |||
70d5b541de | |||
f39eef51e6 |
123
.drone.yml
123
.drone.yml
@ -1,123 +0,0 @@
|
|||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: Build Docker Image (s2oj-db)
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: tags
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:8}" > .tags
|
|
||||||
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: git.m.ac
|
|
||||||
repo: git.m.ac/baoshuo/s2oj-db
|
|
||||||
context: db
|
|
||||||
dockerfile: db/Dockerfile
|
|
||||||
username: baoshuo
|
|
||||||
password:
|
|
||||||
from_secret: GITMAC_SECRET
|
|
||||||
cache_from: git.m.ac/baoshuo/s2oj-db:latest
|
|
||||||
when:
|
|
||||||
event: push
|
|
||||||
branch: master
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: Build Docker Image (s2oj-judger)
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: tags
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:8}" > .tags
|
|
||||||
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: git.m.ac
|
|
||||||
repo: git.m.ac/baoshuo/s2oj-judger
|
|
||||||
context: judger
|
|
||||||
dockerfile: judger/Dockerfile
|
|
||||||
username: baoshuo
|
|
||||||
password:
|
|
||||||
from_secret: GITMAC_SECRET
|
|
||||||
cache_from: git.m.ac/baoshuo/s2oj-judger:latest
|
|
||||||
when:
|
|
||||||
event: push
|
|
||||||
branch: master
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: Build Docker Image (s2oj-remote-judger)
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: tags
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:8}" > .tags
|
|
||||||
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: git.m.ac
|
|
||||||
repo: git.m.ac/baoshuo/s2oj-remote-judger
|
|
||||||
context: remote_judger
|
|
||||||
dockerfile: remote_judger/Dockerfile
|
|
||||||
username: baoshuo
|
|
||||||
password:
|
|
||||||
from_secret: GITMAC_SECRET
|
|
||||||
cache_from: git.m.ac/baoshuo/s2oj-remote-judger:latest
|
|
||||||
when:
|
|
||||||
event: push
|
|
||||||
branch: master
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: Build Docker Image (s2oj-web)
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: tags
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:7}" > .tags
|
|
||||||
|
|
||||||
- name: version
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- sed -i "s/'s2oj-version' => 'dev'/'s2oj-version' => '${DRONE_COMMIT_SHA:0:7}'/g" web/app/.default-config.php
|
|
||||||
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: git.m.ac
|
|
||||||
repo: git.m.ac/baoshuo/s2oj-web
|
|
||||||
dockerfile: web/Dockerfile
|
|
||||||
username: baoshuo
|
|
||||||
password:
|
|
||||||
from_secret: GITMAC_SECRET
|
|
||||||
cache_from: git.m.ac/baoshuo/s2oj-web:latest
|
|
||||||
when:
|
|
||||||
event: push
|
|
||||||
branch: master
|
|
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
@ -10,9 +10,12 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ${{ startsWith(github.server_url, 'https://github.com') && 'ghcr.io' || 'git.m.ac' }}
|
||||||
IMAGE_BASENAME: ${{ github.repository }}
|
IMAGE_BASENAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Image
|
name: Build Image
|
||||||
|
@ -4,9 +4,11 @@ SHELL ["/bin/bash", "-c"]
|
|||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends gnupg ca-certificates apt-transport-https && \
|
apt-get install -y --no-install-recommends gnupg curl ca-certificates apt-transport-https && \
|
||||||
|
curl https://git.m.ac/api/packages/baoshuo/debian/repository.key -o /etc/apt/trusted.gpg.d/gitmac-baoshuo.asc && \
|
||||||
|
echo "deb https://git.m.ac/api/packages/baoshuo/debian all main" | tee -a /etc/apt/sources.list.d/gitmac-baoshuo.list && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
for pkg in vim ntp zip unzip curl wget build-essential fp-compiler python2.7 python3.10 python3-requests libseccomp-dev openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk tzdata; do \
|
for pkg in vim ntp zip unzip wget build-essential fp-compiler s2oj-gcc python2.7 python3.10 python3-requests libseccomp-dev openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk tzdata; do \
|
||||||
cnt=10 && \
|
cnt=10 && \
|
||||||
while ! apt-get install -y "$pkg"; do \
|
while ! apt-get install -y "$pkg"; do \
|
||||||
if [ $cnt -le 0 ]; then \
|
if [ $cnt -le 0 ]; then \
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#define UOJ_GCC "/usr/bin/gcc-11"
|
#define UOJ_GCC "/usr/local/bin/s2oj-gcc"
|
||||||
#define UOJ_GPLUSPLUS "/usr/bin/g++-11"
|
#define UOJ_GPLUSPLUS "/usr/local/bin/s2oj-g++"
|
||||||
#define UOJ_PYTHON2_7 "/usr/bin/python2.7"
|
#define UOJ_PYTHON2_7 "/usr/bin/python2.7"
|
||||||
#define UOJ_PYTHON3 "/usr/bin/python3.10"
|
#define UOJ_PYTHON3 "/usr/bin/python3.10"
|
||||||
#define UOJ_FPC "/usr/bin/fpc"
|
#define UOJ_FPC "/usr/bin/fpc"
|
||||||
|
@ -10,23 +10,23 @@ const logger = new Logger('remote/atcoder');
|
|||||||
|
|
||||||
const LANGS_MAP = {
|
const LANGS_MAP = {
|
||||||
C: {
|
C: {
|
||||||
name: 'C (GCC 9.2.1)',
|
name: 'C (GCC 12.2.0)',
|
||||||
id: 4001,
|
id: 5017,
|
||||||
comment: '//',
|
comment: '//',
|
||||||
},
|
},
|
||||||
'C++': {
|
'C++': {
|
||||||
name: 'C++ (GCC 9.2.1)',
|
name: 'C++ 20 (GCC 12.2.0)',
|
||||||
id: 4003,
|
id: 5001,
|
||||||
comment: '//',
|
comment: '//',
|
||||||
},
|
},
|
||||||
Pascal: {
|
Pascal: {
|
||||||
name: 'Pascal (FPC 3.0.4)',
|
name: 'Pascal (FPC 3.2.2)',
|
||||||
id: 4041,
|
id: 5041,
|
||||||
comment: '//',
|
comment: '//',
|
||||||
},
|
},
|
||||||
Python3: {
|
Python3: {
|
||||||
name: 'Python (3.8.2)',
|
name: 'Python (CPython 3.11.4)',
|
||||||
id: 4006,
|
id: 5055,
|
||||||
comment: '#',
|
comment: '#',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -193,9 +193,8 @@ export default class AtcoderProvider implements IBasicProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [contestId, problemId] = parseProblemId(id);
|
const [contestId, problemId] = parseProblemId(id);
|
||||||
const csrf = await this.getCsrfToken(
|
const referer = `/contests/${contestId}/tasks/${problemId}`;
|
||||||
`/contests/${contestId}/tasks/${problemId}`
|
const csrf = await this.getCsrfToken(referer);
|
||||||
);
|
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'Submitting',
|
'Submitting',
|
||||||
@ -208,11 +207,13 @@ export default class AtcoderProvider implements IBasicProvider {
|
|||||||
await next({ status: 'Submitting to AtCoder...' });
|
await next({ status: 'Submitting to AtCoder...' });
|
||||||
|
|
||||||
// TODO: check submit time to ensure submission
|
// TODO: check submit time to ensure submission
|
||||||
const res = await this.post(`/contests/${contestId}/submit`).send({
|
const res = await this.post(`/contests/${contestId}/submit`)
|
||||||
csrf_token: csrf,
|
.set('Referer', referer)
|
||||||
|
.send({
|
||||||
'data.TaskScreenName': problemId,
|
'data.TaskScreenName': problemId,
|
||||||
'data.LanguageId': programType.id,
|
'data.LanguageId': programType.id,
|
||||||
sourceCode: code,
|
sourceCode: code,
|
||||||
|
csrf_token: csrf,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
@ -233,7 +234,9 @@ export default class AtcoderProvider implements IBasicProvider {
|
|||||||
|
|
||||||
const { text: status, header: status_header } = await this.get(
|
const { text: status, header: status_header } = await this.get(
|
||||||
`/contests/${contestId}/submissions/me`
|
`/contests/${contestId}/submissions/me`
|
||||||
).retry(3);
|
)
|
||||||
|
.set('Referer', referer)
|
||||||
|
.retry(3);
|
||||||
|
|
||||||
if (status_header['set-cookie']) {
|
if (status_header['set-cookie']) {
|
||||||
this.cookie = status_header['set-cookie'];
|
this.cookie = status_header['set-cookie'];
|
||||||
|
@ -4,11 +4,13 @@ SHELL ["/bin/bash", "-c"]
|
|||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends gnupg ca-certificates apt-transport-https && \
|
apt-get install -y --no-install-recommends gnupg curl ca-certificates apt-transport-https && \
|
||||||
|
curl https://git.m.ac/api/packages/baoshuo/debian/repository.key -o /etc/apt/trusted.gpg.d/gitmac-baoshuo.asc && \
|
||||||
|
echo "deb https://git.m.ac/api/packages/baoshuo/debian all main" | tee -a /etc/apt/sources.list.d/gitmac-baoshuo.list && \
|
||||||
(echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu jammy main" | tee /etc/apt/sources.list.d/ondrej-php.list) && \
|
(echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu jammy main" | tee /etc/apt/sources.list.d/ondrej-php.list) && \
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C && \
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
for pkg in php7.4 php7.4-yaml php7.4-xml php7.4-dev php7.4-zip php7.4-mysql php7.4-mbstring php7.4-gd php7.4-curl php7.4-imagick libseccomp-dev git vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile php-pear mysql-client build-essential fp-compiler re2c libseccomp-dev libyaml-dev python2.7 python3.10 python3-requests openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk language-pack-zh-hans cron tzdata; do \
|
for pkg in php7.4 php7.4-yaml php7.4-xml php7.4-dev php7.4-zip php7.4-mysql php7.4-mbstring php7.4-gd php7.4-curl php7.4-imagick libseccomp-dev git vim ntp zip unzip wget apache2 libapache2-mod-xsendfile php-pear mysql-client build-essential s2oj-gcc fp-compiler re2c libseccomp-dev libyaml-dev python2.7 python3.10 python3-requests openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk language-pack-zh-hans cron tzdata; do \
|
||||||
cnt=10 && \
|
cnt=10 && \
|
||||||
while ! apt-get install -y "$pkg"; do \
|
while ! apt-get install -y "$pkg"; do \
|
||||||
if [ $cnt -le 0 ]; then \
|
if [ $cnt -le 0 ]; then \
|
||||||
|
Loading…
Reference in New Issue
Block a user