From b27c94e5bdce756943635d70aecf244094991de4 Mon Sep 17 00:00:00 2001 From: Rickey Fehr Date: Thu, 11 Sep 2025 12:46:18 -0700 Subject: [PATCH 1/3] Add docker support Add docker support via a docker compose file with included instructions. --- README.md | 11 +++++++++++ docker-compose.yml | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 7e54e5d..ca41fbe 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,17 @@ This **tech-demo/proof of concept** is strictly limited in content to a minimal (D-Pad: Navigation) # **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-** Video Tutorial: https://youtu.be/72Zzo1VDYzQ?si=UDmEdbST1Cx1zZV2 ### With `Git` (not required) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9adc15c --- /dev/null +++ b/docker-compose.yml @@ -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)"] From 074f1956aaa38eede697c3ab7e40dac55955b843 Mon Sep 17 00:00:00 2001 From: Rickey Fehr Date: Sun, 14 Sep 2025 13:06:41 -0700 Subject: [PATCH 2/3] Update Github Actions CI to use Docker Compose --- .github/workflows/build_ci_workflow.yml | 51 +++++-------------------- 1 file changed, 10 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build_ci_workflow.yml b/.github/workflows/build_ci_workflow.yml index 6a3cdc0..45b2760 100644 --- a/.github/workflows/build_ci_workflow.yml +++ b/.github/workflows/build_ci_workflow.yml @@ -2,11 +2,12 @@ name: Build CI on: push: - branches: + branches: - main pull_request: branches: - main + workflow_dispatch: jobs: build: @@ -15,47 +16,15 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - - name: Set devkitPro environment variables - 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 - with: - path: /home/runner/devkitpro - # Using a manual key version suffix - v{num}, if changes are made that make the - # 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) - if: steps.cache-devkitpro.outputs.cache-hit != 'true' + - name: Export UID/GID for Compose run: | - sudo apt update - wget https://apt.devkitpro.org/install-devkitpro-pacman - chmod +x install-devkitpro-pacman - sudo ./install-devkitpro-pacman - mkdir -p "$DEVKITPRO" - sudo dkp-pacman -Sy --noconfirm gba-dev - # Copy from installed directory to cacheable directory - sudo cp -r /opt/devkitpro "/home/runner" - sudo chown -R $USER:$USER "/home/runner/devkitpro" - - name: Save devkitPro to cache - if: steps.cache-devkitpro.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: /home/runner/devkitpro - key: devkitpro-${{ runner.os }}-v1 + echo "UID=$(id -u)" >> "$GITHUB_ENV" + echo "GID=$(id -g)" >> "$GITHUB_ENV" - name: Build the project - run: | - make + run: docker compose -f docker-compose.yml run --rm balatro sh -c "make -j$(nproc)" + + - name: Compose down + if: always() + run: docker compose -f docker-compose.yml down -v || true From 5b76cbfad0aff0d443bd605dc597316e07ad14d6 Mon Sep 17 00:00:00 2001 From: Rickey Fehr Date: Sun, 14 Sep 2025 13:25:57 -0700 Subject: [PATCH 3/3] Add cache for docker compose container --- .github/workflows/build_ci_workflow.yml | 35 +++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_ci_workflow.yml b/.github/workflows/build_ci_workflow.yml index 45b2760..cf270ee 100644 --- a/.github/workflows/build_ci_workflow.yml +++ b/.github/workflows/build_ci_workflow.yml @@ -8,15 +8,44 @@ on: branches: - main workflow_dispatch: + inputs: + clear_cache: + description: 'Clear docker cache before running' + type: boolean + default: false jobs: build: runs-on: ubuntu-latest - steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Get docker image cache + uses: actions/cache@v4 + with: + path: /tmp/docker-cache + key: docker-images-${{ hashFiles('docker-compose.yml') }} + + - name: Clear docker cache (if requested) + if: github.event.inputs.clear_cache == 'true' + run: | + echo "Clearing Docker cache..." + rm -rf /tmp/docker-cache + echo "Docker cache cleared" + + - name: Load or pull images + run: | + if [ -f /tmp/docker-cache/balatro.tar ]; then + echo "Loading Image" + docker load -i /tmp/docker-cache/balatro.tar + else + echo "Pulling Image" + docker compose pull balatro + mkdir -p /tmp/docker-cache + docker save $(docker compose config | grep image: | awk '{print $2}') -o /tmp/docker-cache/balatro.tar + fi + - name: Export UID/GID for Compose run: | echo "UID=$(id -u)" >> "$GITHUB_ENV" @@ -24,7 +53,3 @@ jobs: - name: Build the project run: docker compose -f docker-compose.yml run --rm balatro sh -c "make -j$(nproc)" - - - name: Compose down - if: always() - run: docker compose -f docker-compose.yml down -v || true