mirror of
https://github.com/encounter/decomp.me.git
synced 2026-03-30 11:06:27 -07:00
270 lines
8.6 KiB
YAML
270 lines
8.6 KiB
YAML
name: PR
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
jobs:
|
|
full_test_and_build:
|
|
name: full test and build
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Install apt dependencies (initial)
|
|
run: |-
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
ca-certificates \
|
|
python-is-python3 \
|
|
python3 \
|
|
python3-pip \
|
|
python3.12-dev \
|
|
python3.12-venv \
|
|
software-properties-common
|
|
- name: Install apt dependencies (nsjail)
|
|
run: |-
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
autoconf \
|
|
bison \
|
|
flex \
|
|
g++ \
|
|
gcc \
|
|
git \
|
|
libnl-route-3-dev \
|
|
libprotobuf-dev \
|
|
libtool \
|
|
make \
|
|
pkg-config \
|
|
protobuf-compiler
|
|
- name: Install apt dependencies (decomp.me)
|
|
run: |-
|
|
sudo dpkg --add-architecture i386
|
|
sudo add-apt-repository -y ppa:stsp-0/dj64
|
|
sudo add-apt-repository -y ppa:dosemu2/ppa
|
|
sudo apt-get update
|
|
sudo apt-get install -y -o APT::Immediate-Configure=false \
|
|
binutils-aarch64-linux-gnu \
|
|
binutils-arm-none-eabi \
|
|
binutils-djgpp \
|
|
binutils-mingw-w64-i686 \
|
|
binutils-mips-linux-gnu \
|
|
binutils-powerpc-linux-gnu \
|
|
binutils-sh-elf \
|
|
curl \
|
|
dj64 \
|
|
dos2unix \
|
|
dosemu2 \
|
|
gcc-mips-linux-gnu \
|
|
git \
|
|
iptables \
|
|
libarchive-tools \
|
|
libc6-dev-i386 \
|
|
libdevmapper1.02.1 \
|
|
libgpgme11 \
|
|
libnl-route-3-200 \
|
|
libprotobuf-dev \
|
|
libtinfo6 \
|
|
netcat-traditional \
|
|
unzip \
|
|
wget \
|
|
wine
|
|
|
|
# NOTE: clang needs libtinfo5 which is not available on Ubuntu 24.04
|
|
- name: Install libtinfo5 for clang
|
|
run: |-
|
|
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb
|
|
sudo apt install ./libtinfo5_6.3-2ubuntu0.1_amd64.deb
|
|
|
|
- name: Install nsjail
|
|
run: |-
|
|
git clone --recursive --branch=3.4 https://github.com/google/nsjail
|
|
make -C nsjail
|
|
sudo cp nsjail/nsjail /usr/bin/
|
|
|
|
- name: Install mips PS2 binutils
|
|
run: |-
|
|
wget https://github.com/decompals/binutils-mips-ps2-decompals/releases/download/v0.4/binutils-mips-ps2-decompals-linux-x86-64.tar.gz
|
|
sudo tar xvzf binutils-mips-ps2-decompals-linux-x86-64.tar.gz -C /usr/bin mips-ps2-decompals-as mips-ps2-decompals-nm mips-ps2-decompals-objdump
|
|
|
|
- name: Install GC/Wii binutils
|
|
run: |-
|
|
curl -sSL https://github.com/encounter/gc-wii-binutils/releases/download/2.42-1/linux-`uname -m`.zip | \
|
|
sudo bsdtar -xvf- -C /usr/bin
|
|
sudo chmod +x /usr/bin/powerpc-eabi-*
|
|
|
|
- name: Install MSDOS binutils
|
|
run: |-
|
|
wget https://github.com/OmniBlade/binutils-gdb/releases/download/omf-build/omftools.tar.gz
|
|
sudo tar xvzf omftools.tar.gz -C /usr/bin jwasm
|
|
wget https://github.com/decompals/binutils-omf/releases/download/v0.3/omftools-linux-x86_64.tar.gz
|
|
sudo tar xvzf omftools-linux-x86_64.tar.gz -C /usr/bin omf-nm omf-objdump
|
|
|
|
- name: Install wibo
|
|
run: |-
|
|
wget https://github.com/decompals/wibo/releases/download/0.6.16/wibo && chmod +x wibo && sudo cp wibo /usr/bin/
|
|
|
|
- name: Install poetry
|
|
run: pipx install poetry
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: poetry
|
|
cache-dependency-path: backend/poetry.lock
|
|
- name: Install backend Python dependencies
|
|
run: cd backend && poetry install --no-root
|
|
|
|
- name: Download compilers
|
|
run: |-
|
|
cd backend
|
|
poetry run python3 compilers/download.py
|
|
- name: Download libraries
|
|
run: |-
|
|
cd backend
|
|
poetry run python3 libraries/download.py
|
|
|
|
- name: Run backend tests
|
|
run: |-
|
|
mkdir -p "${WINEPREFIX}"
|
|
wineboot --init
|
|
cd backend
|
|
poetry run python3 manage.py test
|
|
env:
|
|
SYSTEM_ENV: GITHUB_WORKFLOW
|
|
WINEPREFIX: /tmp/wine
|
|
TIMEOUT_SCALE_FACTOR: 10
|
|
|
|
- name: Migrate backend
|
|
run: cd backend && poetry run python3 ./manage.py migrate
|
|
|
|
- name: Start backend
|
|
run: cd backend && poetry run python3 ./manage.py runserver > /dev/null 2>&1 &
|
|
|
|
- name: Setup Node.js 20
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: yarn
|
|
cache-dependency-path: frontend/yarn.lock
|
|
- name: Install frontend dependencies
|
|
run: cd frontend && yarn --frozen-lockfile
|
|
- name: Build frontend
|
|
run: cd frontend && yarn build
|
|
|
|
backend_test_windows:
|
|
name: backend tests (windows)
|
|
runs-on: windows-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install poetry
|
|
run: pipx install poetry
|
|
- name: Setup Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: poetry
|
|
cache-dependency-path: backend/poetry.lock
|
|
- name: Install Poetry
|
|
run: pip install --user poetry
|
|
- run: cd backend && poetry install --no-root
|
|
- name: Run tests
|
|
run: |-
|
|
cd backend
|
|
poetry run python manage.py test
|
|
env:
|
|
SYSTEM_ENV: GITHUB_WORKFLOW
|
|
TIMEOUT_SCALE_FACTOR: 10
|
|
|
|
backend_test_docker:
|
|
name: backend tests (docker)
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Build decompme_backend image
|
|
run: |-
|
|
docker build backend -t decompme_backend
|
|
- name: Run tests
|
|
run: |-
|
|
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0
|
|
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
|
|
mkdir -p sandbox && chmod 777 sandbox
|
|
mkdir -p local_files && chmod 777 local_files
|
|
mkdir -p compilers && chmod 777 compilers
|
|
mkdir -p libraries && chmod 777 libraries
|
|
docker run \
|
|
-v $(pwd):/decomp.me \
|
|
-v $(pwd)/local_files:/local_files \
|
|
-v $(pwd)/compilers:/compilers \
|
|
-v $(pwd)/libraries:/libraries \
|
|
--security-opt apparmor=unconfined \
|
|
--security-opt seccomp=unconfined \
|
|
--cap-drop all \
|
|
--cap-add setuid \
|
|
--cap-add setgid \
|
|
--cap-add setfcap \
|
|
--tmpfs /sandbox/tmp:exec,uid=1000,gid=1000,size=64M,mode=0700 \
|
|
--entrypoint /bin/bash \
|
|
-e COMPILER_BASE_PATH=/compilers \
|
|
-e LIBRARY_BASE_PATH=/libraries \
|
|
-e WINEPREFIX=/tmp/wine \
|
|
-e LOCAL_FILE_DIR=/local_files \
|
|
-e USE_SANDBOX_JAIL=on \
|
|
-e SANDBOX_DISABLE_PROC=true \
|
|
-e TIMEOUT_SCALE_FACTOR=10 \
|
|
decompme_backend \
|
|
-c 'cd /decomp.me/backend && \
|
|
poetry install --no-root && \
|
|
poetry run compilers/download.py --compilers-dir ${COMPILER_BASE_PATH} && \
|
|
poetry run libraries/download.py --libraries-dir ${LIBRARY_BASE_PATH} && \
|
|
for r in wine/*.reg; do regedit $r; done && \
|
|
poetry run python manage.py test'
|
|
|
|
frontend_lint:
|
|
name: biome
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Node.js 20
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: yarn
|
|
cache-dependency-path: frontend/yarn.lock
|
|
- name: Install frontend dependencies
|
|
run: cd frontend && yarn --frozen-lockfile
|
|
- name: Run Biome
|
|
run: cd frontend && yarn lint
|
|
|
|
mypy:
|
|
name: mypy
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install poetry
|
|
run: pipx install poetry
|
|
- name: Setup Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: poetry
|
|
cache-dependency-path: backend/poetry.lock
|
|
- run: |-
|
|
cd backend
|
|
poetry install --no-root
|
|
poetry run mypy
|
|
|
|
black:
|
|
name: black
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: psf/black@stable
|
|
with:
|
|
src: "./backend"
|