Skip to content

Commit

Permalink
Merge branch 'main' into wine-b-gone
Browse files Browse the repository at this point in the history
  • Loading branch information
ethteck committed Dec 1, 2023
2 parents cdf9e66 + b336445 commit cb27696
Show file tree
Hide file tree
Showing 97 changed files with 4,517 additions and 5,843 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ GITHUB_CLIENT_SECRET=
FRONTEND_USE_IMAGE_PROXY=true
FRONTEND_PWA=off
SESSION_COOKIE_AGE=7776000
PYTHONPATH=backend
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
uses: actions/cache@v3
with:
path: backend/compilers/download_cache
key: ${{ runner.os }}-compilers-${{ hashFiles('backend/compilers/download.py') }}
key: ${{ runner.os }}-compilers-${{ hashFiles('backend/compilers/compilers.*.yaml') }}
- name: Download compilers
run: |-
cd backend
Expand All @@ -87,7 +87,7 @@ jobs:
poetry run python3 libraries/download.py
- name: Install wibo
run: |-
wget https://github.com/decompals/wibo/releases/download/0.6.8/wibo && chmod +x wibo && sudo cp wibo /usr/bin/
wget https://github.com/decompals/wibo/releases/download/0.6.10/wibo && chmod +x wibo && sudo cp wibo /usr/bin/
- name: Run backend tests
run: |-
Expand Down Expand Up @@ -153,9 +153,10 @@ jobs:
run: |-
docker build backend \
-t decompme_backend \
--build-arg ENABLE_GC_WII_SUPPORT=YES \
--build-arg ENABLE_MSDOS_SUPPORT=YES \
--build-arg ENABLE_PS2_SUPPORT=YES \
--build-arg ENABLE_SATURN_SUPPORT=YES \
--build-arg ENABLE_MSDOS_SUPPORT=YES
--build-arg ENABLE_WIN9X_SUPPORT=YES
- name: Run tests
run: |-
mkdir -p sandbox && chmod 777 sandbox
Expand Down
11 changes: 3 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,9 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-python.black-formatter",
},
"mypy.configFile": "backend/mypy.ini",
"mypy.runUsingActiveInterpreter": true,
"mypy.targets": [
"backend/coreapp",
"backend/decompme"
],
"typescript.tsdk": "frontend/node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"python.linting.mypyEnabled": true,
"python.linting.enabled": true
"mypy-type-checker.args": [
"--config-file=backend/mypy.ini"
]
}
18 changes: 7 additions & 11 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,25 @@ RUN curl -sSL https://install.python-poetry.org/ | \

COPY --from=nsjail /nsjail/nsjail /bin/nsjail

COPY --from=ghcr.io/decompals/wibo:0.6.8 /usr/local/sbin/wibo /usr/bin/
COPY --from=ghcr.io/decompals/wibo:0.6.10 /usr/local/sbin/wibo /usr/bin/

RUN add-apt-repository -y ppa:dosemu2/ppa && \
apt-get update && \
apt-get install -y dosemu2

# windows compilers need i386 wine

ARG ENABLE_MSDOS_SUPPORT
ARG ENABLE_NDS_ARM9_SUPPORT
ARG ENABLE_PS2_SUPPORT
ARG ENABLE_WIN9X_SUPPORT
RUN if [ "${ENABLE_MSDOS_SUPPORT}" = "YES" ] || \
[ "${ENABLE_NDS_ARM9_SUPPORT}" = "YES" ] || \
[ "${ENABLE_PS2_SUPPORT}" = "YES" ] || \
[ "${ENABLE_WIN9X_SUPPORT}" = "YES" ]; then \
dpkg --add-architecture i386 && apt-get update && \
apt-get install -y -o APT::Immediate-Configure=false \
wine; \
fi

ARG ENABLE_SATURN_SUPPORT
# install dosemu2 for saturn
RUN if [ "${ENABLE_SATURN_SUPPORT}" = "YES" ]; then \
add-apt-repository -y ppa:dosemu2/ppa && \
apt-get update && \
apt-get install -y dosemu2; \
fi

# msdos specific
RUN if [ "${ENABLE_MSDOS_SUPPORT}" = "YES" ]; then \
wget "https://github.com/OmniBlade/binutils-gdb/releases/download/omf-build/omftools.tar.gz" && \
Expand Down Expand Up @@ -127,7 +121,9 @@ ARG ENABLE_GC_WII_SUPPORT
ARG ENABLE_MACOSX_SUPPORT
ARG ENABLE_N3DS_SUPPORT
ARG ENABLE_N64_SUPPORT
ARG ENABLE_NDS_ARM9_SUPPORT
ARG ENABLE_PS1_SUPPORT
ARG ENABLE_SATURN_SUPPORT
ARG ENABLE_SWITCH_SUPPORT

ENV ENABLE_GBA_SUPPORT=${ENABLE_GBA_SUPPORT}
Expand Down
1 change: 1 addition & 0 deletions backend/compilers/compilers.linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ ps1:
- psyq4.4
- psyq4.5
- psyq4.6
- gcc2.5.7-psx
- gcc2.6.3-psx
- gcc2.6.0-mipsel
- gcc2.6.3-mipsel
Expand Down
36 changes: 5 additions & 31 deletions backend/coreapp/admin.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,21 @@
import shutil

from django.contrib import admin

from django.db.models.query import QuerySet

from coreapp.middleware import Request

from .models.github import GitHubRepo, GitHubRepoBusyException, GitHubUser

from .models.course import Course, CourseChapter, CourseScenario
from .models.github import GitHubUser
from .models.preset import Preset
from .models.profile import Profile
from .models.project import Project, ProjectFunction, ProjectImportConfig, ProjectMember
from .models.project import Project, ProjectMember
from .models.scratch import Asm, Assembly, CompilerConfig, Scratch
from .models.course import Course, CourseChapter, CourseScenario


class GitHubRepoAdmin(admin.ModelAdmin[GitHubRepo]):
actions = ["pull", "reclone"]

def pull(self, request: Request, queryset: QuerySet[GitHubRepo]) -> None:
for repo in queryset.all():
repo.pull()

def reclone(self, request: Request, queryset: QuerySet[GitHubRepo]) -> None:
for repo in queryset.all():
if repo.is_pulling:
raise GitHubRepoBusyException()

repo.last_pulled = None
shutil.rmtree(repo.get_dir())
repo.pull()


admin.site.register(Profile)
admin.site.register(GitHubUser)
admin.site.register(Asm)
admin.site.register(Assembly)
admin.site.register(Scratch)
admin.site.register(CompilerConfig)
admin.site.register(Preset)
admin.site.register(Project)
admin.site.register(ProjectFunction)
admin.site.register(ProjectMember)
admin.site.register(ProjectImportConfig)
admin.site.register(GitHubRepo, GitHubRepoAdmin)
admin.site.register(Course)
admin.site.register(CourseChapter)
admin.site.register(CourseScenario)
11 changes: 3 additions & 8 deletions backend/coreapp/compiler_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import re
import subprocess
from dataclasses import dataclass
from platform import uname
import time

from typing import (
Expand All @@ -26,7 +25,7 @@
import coreapp.util as util

from .error import AssemblyError, CompilationError
from .libraries import LIBRARY_BASE_PATH, Library
from .libraries import Library
from .models.scratch import Asm, Assembly
from .sandbox import Sandbox

Expand All @@ -49,12 +48,8 @@ def lru_cache(maxsize: int = 128, typed: bool = False) -> Callable[[F], F]:
else:
PATH = os.environ["PATH"]

WIBO: str
if "microsoft" in uname().release.lower() and not settings.USE_SANDBOX_JAIL:
logger.info("WSL detected & nsjail disabled: wibo not required.")
WIBO = ""
else:
WIBO = "wibo"
WINE = "wine"
WIBO = "wibo"


@dataclass
Expand Down
Loading

0 comments on commit cb27696

Please sign in to comment.