Skip to content

Commit

Permalink
add website building flow to build yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbruv committed Jun 29, 2024
1 parent 7569940 commit 284bad1
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 43 deletions.
125 changes: 82 additions & 43 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,85 @@ jobs:
version: [GQPE78]

steps:
# Checkout the repository (shallow clone)
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

# Set Git config
- name: Git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

# Copy the original files to the workspace
- name: Prepare
run: cp -R /orig .

# Build the project
- name: Build
run: |
python configure.py --wrapper wibo --map --version ${{ matrix.version }} \
--binutils /binutils --compilers /compilers
ninja all_source build/${{ matrix.version }}/progress.json
# Upload progress if we're on the main branch
- name: Upload progress
# If you're using a different branch, change this to match
if: github.ref == 'refs/heads/main'
continue-on-error: true
env:
# Replace with your project slug
PROGRESS_SLUG: bfbb
# Set the API key in your repository secrets
PROGRESS_API_KEY: ${{ secrets.PROGRESS_API_KEY }}
run: |
python tools/upload_progress.py -b https://progress.decomp.club/ \
-p $PROGRESS_SLUG -v ${{ matrix.version }} \
build/${{ matrix.version }}/progress.json
# Upload map files
- name: Upload map
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.version }}_maps
path: build/${{ matrix.version }}/**/*.MAP
# Checkout the repository (shallow clone)
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Checkout Website
if: github.ref == 'refs/heads/main'
uses: actions/checkout@v4
with:
repository: bfbbdecomp/website
path: website

# Set Git config
- name: Git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

# Copy the original files to the workspace
- name: Prepare
run: cp -R /orig .

- name: Download objdiff CLI
if: github.ref == 'refs/heads/main'
run: |
python tools/download_tool.py --tag v2.0.0-alpha.5 objdiff-cli objdiff-cli
# Build the project
- name: Build
run: |
python configure.py --wrapper wibo --map --version ${{ matrix.version }} \
--binutils /binutils --compilers /compilers
ninja all_source build/${{ matrix.version }}/progress.json
# Upload progress if we're on the main branch
- name: Upload progress
# If you're using a different branch, change this to match
if: github.ref == 'refs/heads/main'
continue-on-error: true
env:
# Replace with your project slug
PROGRESS_SLUG: bfbb
# Set the API key in your repository secrets
PROGRESS_API_KEY: ${{ secrets.PROGRESS_API_KEY }}
run: |
python tools/upload_progress.py -b https://progress.decomp.club/ \
-p $PROGRESS_SLUG -v ${{ matrix.version }} \
build/${{ matrix.version }}/progress.json
# Upload map files
- name: Upload map
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.version }}_maps
path: build/${{ matrix.version }}/**/*.MAP

- name: Generate Progress Report
if: github.ref == 'refs/heads/main'
run: |
./objdiff-cli report generate -o website/progress.json
- name: Parse Progress
if: github.ref == 'refs/heads/main'
run: |
cd website
python progress.py progress.json json/
- name: Build Website
if: github.ref == 'refs/heads/main'
run: |
cd website
npm install
npm run build
- name: Deploy Website
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: website/dist # The folder the action should deploy.
clean: true
single-commit: true
15 changes: 15 additions & 0 deletions tools/download_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,28 @@ def wibo_url(tag: str) -> str:
repo = "https://github.com/decompals/wibo"
return f"{repo}/releases/download/{tag}/wibo"

def objdiffcli_url(tag: str) -> str:
uname = platform.uname()
suffix = ""
system = uname.system.lower()
if system == "darwin":
system = "macos"
elif system == "windows":
suffix = ".exe"
arch = uname.machine.lower()
if arch == "amd64":
arch = "x86_64"

repo = "https://github.com/encounter/objdiff"
return f"{repo}/releases/download/{tag}/objdiff-cli-{system}-{arch}{suffix}"

TOOLS: Dict[str, Callable[[str], str]] = {
"binutils": binutils_url,
"compilers": compilers_url,
"dtk": dtk_url,
"sjiswrap": sjiswrap_url,
"wibo": wibo_url,
"objdiff-cli": objdiffcli_url
}


Expand Down

0 comments on commit 284bad1

Please sign in to comment.