-
Notifications
You must be signed in to change notification settings - Fork 119
243 lines (231 loc) · 8.59 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
name: PR
on:
push:
branches:
- main
pull_request:
jobs:
full_test_and_build:
name: full test and build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: poetry
cache-dependency-path: backend/poetry.lock
- name: Install backend Python dependencies
run: cd backend && poetry install --no-root
- name: Install apt dependencies (initial)
run: |-
sudo dpkg --add-architecture i386
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update -qq
sudo apt-get install -yqq --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386 wine
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update -qq
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo apt-get install \
binutils-aarch64-linux-gnu \
binutils-arm-none-eabi \
binutils-djgpp \
binutils-mips-linux-gnu \
binutils-powerpc-linux-gnu \
binutils-sh-elf \
binutils-mingw-w64-i686 \
dos2unix \
libarchive-tools \
libprotobuf-dev \
libnl-route-3-dev \
libncurses5 \
protobuf-compiler
- name: Install msdos assembler
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 omf-nm omf-objdump
- 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 apt dependencies (cached)
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: docker-ce docker-ce-cli containerd.io docker-compose-plugin binutils-aarch64-linux-gnu binutils-mips-linux-gnu binutils-powerpc-linux-gnu binutils-sh-elf dos2unix libprotobuf-dev libnl-route-3-dev libncurses5 protobuf-compiler wine software-properties-common
version: 1.0
- name: Install DOSEMU
run: |-
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 dj64 dosemu2
- name: Install nsjail
run: |-
git clone --recursive --branch=3.1 https://github.com/google/nsjail
make -C nsjail
sudo cp nsjail/nsjail /usr/bin/
- 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: Cache compilers
uses: actions/cache@v4
with:
path: backend/compilers/download_cache
key: ${{ runner.os }}-compilers-${{ hashFiles('backend/compilers/compilers.*.yaml') }}
- 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: Install wibo
run: |-
wget https://github.com/decompals/wibo/releases/download/0.6.12/wibo && chmod +x wibo && sudo cp wibo /usr/bin/
- 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.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
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-latest
steps:
- uses: actions/checkout@v4
- name: Build decompme_backend image
run: |-
docker build backend \
-t decompme_backend \
--build-arg ENABLE_MSDOS_SUPPORT=YES \
--build-arg ENABLE_GC_WII_SUPPORT=YES \
--build-arg ENABLE_PS2_SUPPORT=YES \
--build-arg ENABLE_SATURN_SUPPORT=YES \
--build-arg ENABLE_DREAMCAST_SUPPORT=YES \
--build-arg ENABLE_WIN32_SUPPORT=YES
- name: Run tests
run: |-
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 \
--tmpfs /dev/shm:exec,uid=1000,gid=1000,size=64M,mode=0700 \
--security-opt apparmor=unconfined \
--security-opt seccomp=unconfined \
--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} && \
poetry run python manage.py test'
frontend_lint:
name: eslint & stylelint
runs-on: ubuntu-latest
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
- run: cd frontend && yarn lint
mypy:
name: mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: poetry
cache-dependency-path: backend/poetry.lock
- run: |-
cd backend
poetry install --no-root
poetry run mypy
black:
name: black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
src: "./backend"