Skip to content

Commit

Permalink
Bring progress site back from the dead (#1258)
Browse files Browse the repository at this point in the history
Co-authored-by: FluentCoding <[email protected]>
  • Loading branch information
ribbanya and FluentCoding authored Feb 20, 2024
1 parent 221e90a commit 91747e7
Show file tree
Hide file tree
Showing 35 changed files with 5,022 additions and 20 deletions.
7 changes: 5 additions & 2 deletions .github/packages/build-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ COPY --from=ghcr.io/decompals/wibo:latest \
COPY requirements.txt /tmp/
ARG DEVKITPRO=/opt/devkitpro
ARG DEVKITPPC=${DEVKITPRO}/devkitPPC
COPY .github/packages/build-linux/setup.sh /usr/local/bin
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C
ENV MELEE_COMPILERS_URL='https://files.decomp.dev/compilers_latest.zip'
ENV BINUTILS_URL='https://github.com/encounter/gc-wii-binutils/releases/download/2.42-0/linux-x86_64.zip'
RUN setup.sh
ENV WINE=${WIBO_PATH}
ENV DEVKITPRO=${DEVKITPRO}
ENV DEVKITPPC=${DEVKITPPC}
Expand All @@ -23,11 +21,16 @@ FROM linux-base AS linux-rw
VOLUME [ "/input", "/output" ]

FROM linux-rw AS build-linux
COPY .github/packages/build-linux/setup.sh /usr/local/bin
RUN setup.sh
ENV MAKE_FLAGS="GENERATE_MAP=1"
COPY .github/packages/build-linux/entrypoint.sh /usr/local/bin
ENTRYPOINT entrypoint.sh

FROM linux-rw AS gen-pages
COPY .github/packages/gen-pages/setup.sh /usr/local/bin
COPY tools/progress-site/package*.json /tmp
RUN setup.sh
COPY .github/packages/gen-pages/entrypoint.sh /usr/local/bin
ENTRYPOINT entrypoint.sh

Expand Down
21 changes: 7 additions & 14 deletions .github/packages/build-linux/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@ set -euox pipefail
apt update

apt install -y --no-install-recommends \
git \
doxygen \
python3-full \
python-is-python3 \
git \
make \
ca-certificates \
curl \
gcc \
git \
libarchive-tools \
libc6-dev \
python3-full \
make \
python-is-python3 \
curl \
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
python3-minimal

# Install melee compiler
curl -L "$MELEE_COMPILERS_URL" |
Expand All @@ -43,3 +35,4 @@ apt remove -y \
apt autoremove -y
apt clean
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/*
37 changes: 36 additions & 1 deletion .github/packages/gen-pages/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
set -euox pipefail

git clone /input /tmp/input
cd /tmp/input
Expand All @@ -20,3 +20,38 @@ cp -R build/doxygen/html/* /output
python tools/m2ctx/m2ctx.py -pqr
melee-mwcc build/ctx.c -v -o build/ctx.o
cp build/ctx.html /output/

# Progress site
cd /tmp/input/tools/progress-site

src='/opt/assets/progress'
static='static/extern'
lib='src/lib/extern'

# assets
for file in "$src"/*; do
if [[ $(basename "$file") == 'favicon.png' ]]; then
dst="$static"
else
dst="$lib"
fi
cp "$file" "$dst"
done

# progress
# BUG race condition between `build-melee` and `gen-pages`.
progress_url='https://progress.decomp.club/data/melee/GALE01?format=json&mode=all'
curl -s -L "$progress_url" -o "$lib/progress.json"

# install
cp -R /opt/node_modules .
export npm_config_cache='npm-cache'
npm install \
--no-audit \
--no-progress \
--prefer-offline

# build
npm run build
find build -type f -name '.gitkeep' -delete
mv build /output/progress
64 changes: 64 additions & 0 deletions .github/packages/gen-pages/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
set -euox pipefail

apt update

function install {
apt install -y --no-install-recommends "${@}"
}

install curl ca-certificates

curl -L https://deb.nodesource.com/setup_20.x | bash -

install \
doxygen \
git \
libarchive-tools \
nodejs \
python-is-python3 \
python3-full

# Acquire external assets
git clone --no-checkout --depth=1 \
'https://github.com/doldecomp/assets.git' \
/tmp/assets
pushd /tmp/assets
git sparse-checkout init --cone
git sparse-checkout set melee
git checkout
mv melee /opt/assets
popd

# Acquire fonts
fonts_url='https://media.fontsgeek.com/download/zip/a/-/a-otf-folk-pro_WeXVg.zip'
curl -L "$fonts_url" |
bsdtar -xvf- -C /tmp
mv '/tmp/A-OTF Folk Pro/A-OTF Folk Pro M/A-OTF Folk Pro M.otf' \
'/opt/assets/progress'

# Install progress site node modules
pushd /tmp
npm install --no-audit --no-progress
mv node_modules /opt
popd

# 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 (for checking ctx.c)
curl -L "$MELEE_COMPILERS_URL" |
bsdtar -xvf- -C /tmp
mv /tmp/GC /tmp/mwcc_compiler
mv /tmp/mwcc_compiler /opt

# Clean up
apt remove -y \
libarchive-tools
apt autoremove -y
apt clean
npm cache clean --force
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/*
6 changes: 3 additions & 3 deletions .github/workflows/publish-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ jobs:
- name: Checkout Melee repository
uses: actions/checkout@v3

- name: Set up GitHub Pages
uses: actions/configure-pages@v4

- name: Log into container registry
uses: docker/login-action@v2
with:
Expand All @@ -57,6 +54,9 @@ jobs:
--volume "${{ env.OUTPUT }}:/output" \
${{ env.REGISTRY }}/${{ env.IMAGE }}
- name: Set up GitHub Pages
uses: actions/configure-pages@v4

- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
13 changes: 13 additions & 0 deletions tools/progress-site/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
31 changes: 31 additions & 0 deletions tools/progress-site/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/** @type { import("eslint").Linter.Config } */
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
]
};
13 changes: 13 additions & 0 deletions tools/progress-site/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**/extern/*
!**/extern/.gitkeep

.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions tools/progress-site/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
4 changes: 4 additions & 0 deletions tools/progress-site/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
8 changes: 8 additions & 0 deletions tools/progress-site/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
Loading

0 comments on commit 91747e7

Please sign in to comment.