Skip to content

Commit

Permalink
Upload asm dump to GitHub Pages (#997)
Browse files Browse the repository at this point in the history
Also clean up the CI scripts a bit.
  • Loading branch information
ribbanya authored Oct 29, 2023
1 parent 64eef34 commit d51e907
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 55 deletions.
36 changes: 34 additions & 2 deletions .github/packages/build-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
FROM ubuntu:latest AS build-linux
FROM rust:latest as build-rust
RUN git clone 'https://github.com/InusualZ/dadosod.git' \
&& cd dadosod \
&& cargo build -r

FROM ubuntu:latest AS linux-base
ARG WIBO_PATH="/usr/local/sbin/wibo"
COPY --from=ghcr.io/decompals/wibo:latest \
${WIBO_PATH} \
${WIBO_PATH}
COPY requirements.txt /tmp/
COPY --from=build-rust \
/dadosod/target/release/dadosod \
/usr/local/bin/dadosod
ARG DEVKITPRO=/opt/devkitpro
ARG DEVKITPPC=${DEVKITPRO}/devkitPPC
COPY --from=devkitpro/devkitppc:latest \
Expand All @@ -13,13 +22,36 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C
ENV MELEE_COMPILERS_URL="https://mega.nz/file/BU43wKxT#rVC11Rl7DPxfSn7V9Iu--8E7m7gc1gsJWtfVBbfmKwQ"
RUN chmod +x /usr/local/bin/setup.sh && setup.sh
VOLUME [ "/input", "/output" ]
ENV WINE=${WIBO_PATH}
ENV DEVKITPRO=${DEVKITPRO}
ENV DEVKITPPC=${DEVKITPPC}
ENV PATH="$DEVKITPRO/tools/bin:$PATH"
ENV PATH="$DEVKITPPC/bin:$PATH"
COPY .github/packages/build-linux/melee-mwcc /usr/local/bin
RUN chmod +x /usr/local/bin/melee-mwcc

FROM linux-base AS build-linux
ENV MAKE_FLAGS="GENERATE_MAP=1"
VOLUME [ "/input", "/output" ]
COPY .github/packages/build-linux/entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT entrypoint.sh

FROM linux-base AS gen-pages
VOLUME [ "/input", "/output" ]
COPY .github/packages/gen-pages/entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT entrypoint.sh

# TODO
FROM rust:latest AS check-issues
COPY .github/packages/check-issues/setup.sh /usr/local/bin
COPY . /input
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C
RUN chmod +x /usr/local/bin/setup.sh && setup.sh
RUN rm -rf /input
VOLUME [ "/input" ]
COPY .github/packages/check-issues/entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT entrypoint.sh
31 changes: 31 additions & 0 deletions .github/packages/build-linux/melee-mwcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail

mwcc_exe=/opt/mwcc_compiler/1.2.5n/mwcceppc.exe
mwcc_args=(
'-nowraplines'
'-msgstyle' 'gcc'
'-lang' 'c'
'-cwd' 'source'
'-Cpp_exceptions' 'off'
'-proc' 'gekko'
'-DGEKKO'
'-fp' 'hard'
'-fp_contract' 'on'
'-O4,p'
'-enum' 'int'
'-nodefaults'
'-inline' 'auto'
'-requireprotos'
'-warn' 'iserror'
'-i' 'src/melee'
'-i' 'src/melee/ft/chara'
'-I-'
'-i' 'src'
'-i' 'src/MSL'
'-i' 'src/Runtime'
'-i' 'src/sysdolphin'
'-c'
)

"$WINE" "$mwcc_exe" "${mwcc_args[@]}" "$@"
12 changes: 11 additions & 1 deletion .github/packages/build-linux/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@ set -e
apt update

apt install -y --no-install-recommends \
git \
doxygen \
python3-full \
python-is-python3 \
git \
make \
gcc \
libc6-dev \
python3-full \
python-is-python3 \
megatools \
libarchive-tools
libarchive-tools \

# Create and update Python venv
python -m venv --upgrade-deps /opt/venv
. /opt/venv/bin/activate
pip install --no-cache-dir -r /tmp/requirements.txt

# Install melee compiler
megadl --no-progress "$MELEE_COMPILERS_URL" --path - |
bsdtar -xvf- -C /tmp
mv /tmp/GC /tmp/mwcc_compiler
Expand Down
11 changes: 0 additions & 11 deletions .github/packages/check-issues/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions .github/packages/gen-pages/Dockerfile

This file was deleted.

12 changes: 12 additions & 0 deletions .github/packages/gen-pages/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set -e

git clone /input /tmp/input
cd /tmp/input
ln -s /opt/mwcc_compiler tools/

. /opt/venv/bin/activate
pip install --no-cache-dir -r requirements.txt
Expand All @@ -11,5 +12,16 @@ mkdir -p build/doxygen
doxygen Doxyfile
touch build/doxygen/html/.nojekyll
python tools/m2ctx/m2ctx.py -pqr
melee-mwcc build/ctx.c -v -o build/ctx.c.o
make -j"$(nproc)" WINE="$WINE" GENERATE_MAP=1 MAX_ERRORS=1
mkdir build/doxygen/html/dump
cp build/ssbm.us.1.2/GALE01.map build/doxygen/html/dump/
python tools/parse_map.py
dadosod dol build/ssbm.us.1.2/main.dol \
-m build/map.csv \
-o build/doxygen/html/dump
python tools/dump_tree.py \
build/doxygen/html/dump \
build/doxygen/html/dump/index.html
cp build/ctx.html build/doxygen/html/
cp -r build/doxygen/html/* /output
18 changes: 0 additions & 18 deletions .github/packages/gen-pages/setup.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
name: Publish package
env:
REGISTRY: ghcr.io
CONTAINERFILE: .github/packages/${{ matrix.target }}/Dockerfile
CONTAINERFILE: .github/packages/build-linux/Dockerfile
strategy:
matrix:
target: [ "build-linux", "gen-pages", "check-issues" ]
Expand Down
25 changes: 13 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
argcomplete==2.0.0
black==23.1.0
colorama==0.4.6
coverage==7.1.0
cxxfilt==0.3.0
argcomplete>=2.0.0
beautifulsoup4>=4.12.2
black>=23.1.0
colorama>=0.4.6
coverage>=7.1.0
cxxfilt>=0.3.0
GitPython>=3.1.32
graphviz==0.20.1
isort==5.12.0
humanfriendly==10.0
pcpp==1.30
pyelftools==0.29
graphviz>=0.20.1
isort>=5.12.0
humanfriendly>=10.0
pcpp>=1.30
pyelftools>=0.29
Pygments>=2.15.0
pyperclip==1.8.2
pyperclip>=1.8.2
python_Levenshtein>=0.20.9
watchdog==2.2.1
watchdog>=2.2.1
63 changes: 63 additions & 0 deletions tools/dump_tree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/python3
import argparse
from pathlib import Path
from typing import cast

from bs4 import BeautifulSoup, Tag


def generate_nested_html_list(directory_path):
root = Path(directory_path)

# Create a new BeautifulSoup object
soup = BeautifulSoup("<ul></ul>", "html.parser")
ul = cast(Tag, soup.ul)

# Iterate over the directory structure using a stack
stack = [(root, ul)]

while stack:
current_dir, current_ul = stack.pop()

# Iterate over the subdirectories and files in the current directory
for item in sorted(current_dir.iterdir()):
if item.is_dir():
# Create a new <li> element for the subdirectory
li = soup.new_tag("li")
li.string = item.name

# Create a new <ul> element for the subdirectory's contents
sub_ul = soup.new_tag("ul")

# Append the <li> and <ul> elements to the current <ul>
current_ul.append(li)
current_ul.append(sub_ul)

# Push the subdirectory and its <ul> element to the stack
stack.append((item, sub_ul))

else:
# Create a new <li> element for the file
li = soup.new_tag("li")
a = soup.new_tag("a")
a.attrs["href"] = str(item.relative_to(root))
a.attrs["target"] = "_blank"
a.string = item.name

# Append the <li> element to the current <ul>
li.append(a)
current_ul.append(li)

return soup.prettify()


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Generate nested HTML list from directory structure"
)
parser.add_argument("directory", type=Path, help="Path to the directory")
parser.add_argument("output_file", type=Path, help="Path to the output HTML file")
args = parser.parse_args()

html_list = generate_nested_html_list(args.directory)
args.output_file.write_text(html_list, encoding="utf-8")

0 comments on commit d51e907

Please sign in to comment.