This commit is contained in:
Nan
2025-09-15 21:46:48 +02:00
3 changed files with 53 additions and 40 deletions
+34 -40
View File
@@ -2,60 +2,54 @@ name: Build CI
on: on:
push: push:
branches: branches:
- main - main
pull_request: pull_request:
branches: branches:
- main - main
workflow_dispatch:
inputs:
clear_cache:
description: 'Clear docker cache before running'
type: boolean
default: false
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set devkitPro environment variables - name: Get docker image cache
run: |
# Installing to home directory to avoid permission denied on caching
echo "DEVKITPRO=/home/runner/devkitpro" >> $GITHUB_ENV
echo "DEVKITARM=/home/runner/devkitpro/devkitARM" >> $GITHUB_ENV
export PATH=$DEVKITARM/bin:$DEVKITPRO/tools/bin:$PATH
# Caching to avoid excessive request to the devkitpro server from a runner because they
# eventually block and result in permission denied 403.
# If that happens it takes like 2 hours until you can make requests again
- name: Cache devkitPro toolchain
id: cache-devkitpro
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: /home/runner/devkitpro path: /tmp/docker-cache
# Using a manual key version suffix - v{num}, if changes are made that make the key: docker-images-${{ hashFiles('docker-compose.yml') }}
# cache stale and require a refresh, just bump the version number so there's
# a cache miss. The key needs to match in the "Save devkitPro to cache" stage
# so you need to bump the number there too...
key: devkitpro-${{ runner.os }}-v1
- name: Set up devkitARM (if not cached) - name: Clear docker cache (if requested)
if: steps.cache-devkitpro.outputs.cache-hit != 'true' if: github.event.inputs.clear_cache == 'true'
run: | run: |
sudo apt update echo "Clearing Docker cache..."
wget https://apt.devkitpro.org/install-devkitpro-pacman rm -rf /tmp/docker-cache
chmod +x install-devkitpro-pacman echo "Docker cache cleared"
sudo ./install-devkitpro-pacman
mkdir -p "$DEVKITPRO" - name: Load or pull images
sudo dkp-pacman -Sy --noconfirm gba-dev run: |
# Copy from installed directory to cacheable directory if [ -f /tmp/docker-cache/balatro.tar ]; then
sudo cp -r /opt/devkitpro "/home/runner" echo "Loading Image"
sudo chown -R $USER:$USER "/home/runner/devkitpro" docker load -i /tmp/docker-cache/balatro.tar
- name: Save devkitPro to cache else
if: steps.cache-devkitpro.outputs.cache-hit != 'true' echo "Pulling Image"
uses: actions/cache/save@v4 docker compose pull balatro
with: mkdir -p /tmp/docker-cache
path: /home/runner/devkitpro docker save $(docker compose config | grep image: | awk '{print $2}') -o /tmp/docker-cache/balatro.tar
key: devkitpro-${{ runner.os }}-v1 fi
- name: Export UID/GID for Compose
run: |
echo "UID=$(id -u)" >> "$GITHUB_ENV"
echo "GID=$(id -g)" >> "$GITHUB_ENV"
- name: Build the project - name: Build the project
run: | run: docker compose -f docker-compose.yml run --rm balatro sh -c "make -j$(nproc)"
make
+11
View File
@@ -39,6 +39,17 @@ This **tech-demo/proof of concept** is strictly limited in content to a minimal
(D-Pad: Navigation) (D-Pad: Navigation)
# **Build Instructions:** # **Build Instructions:**
## **-Docker-**
A docker compose file is provided to build this project.
1.) Install [docker desktop](https://docs.docker.com/compose/install/).
2.) Open a terminal to this projects directory:
- On **linux** run `UID=$(id -u) GID=$(id -g) docker compose up`
- On **windows** run `docker compose up`
Docker will build the project and the ROM will be in the same location as step 7 describes below.
## **-Windows-** ## **-Windows-**
Video Tutorial: https://youtu.be/72Zzo1VDYzQ?si=UDmEdbST1Cx1zZV2 Video Tutorial: https://youtu.be/72Zzo1VDYzQ?si=UDmEdbST1Cx1zZV2
### With `Git` (not required) ### With `Git` (not required)
+8
View File
@@ -0,0 +1,8 @@
services:
balatro:
image: devkitpro/devkitarm:latest
working_dir: /balatro
volumes:
- ./:/balatro
user: "${UID-1000}:${GID-1000}"
command: ["sh", "-c", "make -j$(nproc)"]