Save the input recording, even if Butterscotch aborted or segfaulted #212
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build-glfw-linux-x86_64: | |
| name: Build (GLFW/Linux x86_64) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=short)" >> $GITHUB_OUTPUT | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y cmake libglfw3-dev | |
| - name: Configure | |
| run: cmake -B build -DPLATFORM=glfw -DCMAKE_BUILD_TYPE=Release "-DBUTTERSCOTCH_COMMIT_HASH=${{ steps.commit-info.outputs.hash }}" "-DBUTTERSCOTCH_COMMIT_DATE=${{ steps.commit-info.outputs.date }}" | |
| - name: Build | |
| run: cmake --build build -j$(nproc) | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-glfw-linux-x86_64 | |
| path: build/butterscotch | |
| build-glfw-windows-x86_64: | |
| name: Build (GLFW/Windows x86_64) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=short)" >> $GITHUB_OUTPUT | |
| - name: Install MinGW and dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake mingw-w64 | |
| - name: Build GLFW for MinGW | |
| run: | | |
| git clone https://github.com/glfw/glfw.git /tmp/glfw | |
| git -C /tmp/glfw checkout fdd14e65b1c29e4e6df875fb5669ec00d6793531 | |
| cmake -B /tmp/glfw/build -S /tmp/glfw \ | |
| -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/mingw-w64.cmake \ | |
| -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 \ | |
| -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF | |
| make -C /tmp/glfw/build -j$(nproc) | |
| sudo make -C /tmp/glfw/build install | |
| - name: Configure | |
| run: cmake -B build -DCMAKE_TOOLCHAIN_FILE=cmake/mingw-w64.cmake -DPLATFORM=glfw -DCMAKE_BUILD_TYPE=Release "-DBUTTERSCOTCH_COMMIT_HASH=${{ steps.commit-info.outputs.hash }}" "-DBUTTERSCOTCH_COMMIT_DATE=${{ steps.commit-info.outputs.date }}" | |
| - name: Build | |
| run: cmake --build build -j$(nproc) | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-glfw-windows-x86_64 | |
| path: build/butterscotch.exe | |
| build-glfw-linux-x86: | |
| name: Build (GLFW/Linux x86) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=short)" >> $GITHUB_OUTPUT | |
| - name: Install 32-bit toolchain and dependencies | |
| run: | | |
| sudo dpkg --add-architecture i386 | |
| sudo apt-get update | |
| sudo apt-get install -y cmake gcc-multilib g++-multilib pkg-config libbz2-dev:i386 libx11-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libgl-dev:i386 | |
| - name: Build GLFW (32-bit) | |
| run: | | |
| git clone https://github.com/glfw/glfw.git /tmp/glfw | |
| git -C /tmp/glfw checkout fdd14e65b1c29e4e6df875fb5669ec00d6793531 | |
| cmake -B /tmp/glfw/build -S /tmp/glfw \ | |
| -DCMAKE_C_FLAGS=-m32 \ | |
| -DCMAKE_INSTALL_PREFIX=/usr/local/glfw-x86 \ | |
| -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_WAYLAND=OFF | |
| make -C /tmp/glfw/build -j$(nproc) | |
| sudo make -C /tmp/glfw/build install | |
| - name: Configure | |
| run: | | |
| export PKG_CONFIG_PATH=/usr/local/glfw-x86/lib/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig | |
| cmake -B build -DPLATFORM=glfw -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-m32 -DCMAKE_EXE_LINKER_FLAGS=-m32 "-DBUTTERSCOTCH_COMMIT_HASH=${{ steps.commit-info.outputs.hash }}" "-DBUTTERSCOTCH_COMMIT_DATE=${{ steps.commit-info.outputs.date }}" | |
| - name: Build | |
| run: cmake --build build -j$(nproc) | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-glfw-linux-x86 | |
| path: build/butterscotch | |
| build-glfw-windows-x86: | |
| name: Build (GLFW/Windows x86) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=short)" >> $GITHUB_OUTPUT | |
| - name: Install MinGW and dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake mingw-w64 | |
| - name: Build GLFW for MinGW (32-bit) | |
| run: | | |
| git clone https://github.com/glfw/glfw.git /tmp/glfw | |
| git -C /tmp/glfw checkout fdd14e65b1c29e4e6df875fb5669ec00d6793531 | |
| cmake -B /tmp/glfw/build -S /tmp/glfw \ | |
| -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/mingw-w64-i686.cmake \ | |
| -DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32 \ | |
| -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF | |
| make -C /tmp/glfw/build -j$(nproc) | |
| sudo make -C /tmp/glfw/build install | |
| - name: Configure | |
| run: cmake -B build -DCMAKE_TOOLCHAIN_FILE=cmake/mingw-w64-i686.cmake -DPLATFORM=glfw -DCMAKE_BUILD_TYPE=Release "-DBUTTERSCOTCH_COMMIT_HASH=${{ steps.commit-info.outputs.hash }}" "-DBUTTERSCOTCH_COMMIT_DATE=${{ steps.commit-info.outputs.date }}" | |
| - name: Build | |
| run: cmake --build build -j$(nproc) | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-glfw-windows-x86 | |
| path: build/butterscotch.exe | |
| build-ps2: | |
| name: Build (PS2) | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ps2dev/ps2dev:latest | |
| steps: | |
| - name: Install build tools | |
| run: apk add --no-cache cmake make gmp-dev mpfr-dev mpc1-dev git | |
| - uses: actions/checkout@v4 | |
| # Yeah, the safe.directory is needed because "fatal: detected dubious ownership in repository at '/__w/Butterscotch/Butterscotch'" | |
| - name: Get commit info | |
| id: commit-info | |
| run: | | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "date=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT | |
| - name: Configure | |
| run: cmake -B build -DCMAKE_TOOLCHAIN_FILE=$PS2SDK/ps2dev.cmake -DPLATFORM=ps2 -DCMAKE_BUILD_TYPE=Release "-DBUTTERSCOTCH_COMMIT_HASH=${{ steps.commit-info.outputs.hash }}" "-DBUTTERSCOTCH_COMMIT_DATE=${{ steps.commit-info.outputs.date }}" | |
| - name: Build | |
| run: | | |
| cmake --build build -j$(nproc) | |
| cp build/butterscotch build/butterscotch.elf | |
| - name: Check executeLoop I-Cache fit | |
| run: | | |
| # Extract executeLoop function size from the ELF symbol table | |
| # nm -S prints: address size type name | |
| echo "Getting executeLoop size from ELF symbol table..." | |
| SYMBOL_LINE=$(mips64r5900el-ps2-elf-nm -S build/butterscotch.elf | grep ' executeLoop$' || true) | |
| if [ -z "$SYMBOL_LINE" ]; then | |
| echo "::error::Could not find executeLoop symbol in ELF (is it stripped?)" | |
| exit 1 | |
| fi | |
| # Size is the second hex field | |
| SIZE_HEX=$(echo "$SYMBOL_LINE" | awk '{print $2}') | |
| SIZE_DEC=$((16#$SIZE_HEX)) | |
| LIMIT=16384 | |
| if [ "$SIZE_DEC" -gt "$LIMIT" ]; then | |
| echo "::error::executeLoop is $SIZE_DEC bytes, exceeding the PS2 16 KB I-Cache ($LIMIT bytes) by $((SIZE_DEC - LIMIT)) bytes" | |
| echo "| Function | Size | Limit | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|------|-------|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| \`executeLoop\` | $SIZE_DEC bytes | $LIMIT bytes (16 KB) | **EXCEEDED** by $((SIZE_DEC - LIMIT)) bytes |" >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi | |
| echo "| Function | Size | Limit | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|------|-------|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| \`executeLoop\` | $SIZE_DEC bytes | $LIMIT bytes (16 KB) | $((LIMIT - SIZE_DEC)) bytes remaining |" >> $GITHUB_STEP_SUMMARY | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: butterscotch-ps2 | |
| path: build/butterscotch.elf |