From e1da79c8effa0e2285e8339577de5cce5f6477a7 Mon Sep 17 00:00:00 2001 From: Milan Sharma Mandigo-Stoba Date: Thu, 20 Aug 2026 11:30:17 -0700 Subject: [PATCH 1/3] migrate from travis ci to gha --- .github/workflows/cmake-multi-platform.yml | 68 ++++++++++++++++++++++ .travis.yml | 24 -------- README.md | 2 +- gpu.c | 4 ++ gpu.h | 6 +- main.c | 4 +- 6 files changed, 77 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/cmake-multi-platform.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml new file mode 100644 index 0000000..9e37a10 --- /dev/null +++ b/.github/workflows/cmake-multi-platform.yml @@ -0,0 +1,68 @@ +name: Build (ubuntu, macos) + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + matrix: + os: [ubuntu-latest, macos-latest] + # build_type: [Release] + c_compiler: [gcc, clang] + include: + - os: macos-latest + c_compiler: clang + cpp_compiler: clang++ + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + exclude: + - os: macos-latest + c_compiler: gcc + + steps: + - uses: actions/checkout@v7 + + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Install dependencies + run: | + ([[ $OSTYPE == 'darwin'* ]] && brew update && brew install sdl2 boost) || + ([[ $OSTYPE == 'linux'* ]] && sudo apt-get update && sudo apt-get install -y libsdl2-dev libboost-all-dev) + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + # -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} + + # - name: Test + # working-directory: ${{ steps.strings.outputs.build-output-dir }} + # # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + # # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + # run: ctest --build-config ${{ matrix.build_type }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3d7875c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -os: - - linux - - osx - -language: c - -compiler: - - gcc - -addons: - homebrew: - packages: - - sdl2 - - boost - update: true - apt: - packages: - - libsdl2-dev - - libboost-all-dev - - -script: - - cmake . - - cmake --build . diff --git a/README.md b/README.md index 31ffa04..0258fac 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # gbc_cpp GameBoy (eventually Color) Emulator in C(++) -[![Build Status](https://travis-ci.com/finagle29/gbc_cpp.svg?branch=master)](https://travis-ci.com/finagle29/gbc_cpp) +[![Build Status](https://github.com/finagle29/gbc_cpp/actions/workflows/cmake-multi-platform.yml/badge.svg)](https://github.com/finagle29/gbc_cpp/actions/workflows/cmake-multi-platform.yml) Use cmake to build. diff --git a/gpu.c b/gpu.c index dc1578d..08de24d 100644 --- a/gpu.c +++ b/gpu.c @@ -5,6 +5,10 @@ gpu_type gpu; +SDL_Window *window, *vram_w, *bg_w; +SDL_Renderer *renderer, *vram_r, *bg_r; +SDL_Texture *framebuffer, *framebuffer_tileset, *framebuffer_bgmap; + #define RGBA(r, g, b) (((((r << 8) | g) << 8) | b) << 8) | 0xFF bool show_tileset, show_bgmap; diff --git a/gpu.h b/gpu.h index e45183f..ab25f56 100644 --- a/gpu.h +++ b/gpu.h @@ -40,10 +40,8 @@ typedef struct } gpu_type; extern gpu_type gpu; - -SDL_Window *window, *vram_w, *bg_w; -SDL_Renderer *renderer, *vram_r, *bg_r; -SDL_Texture *framebuffer, *framebuffer_tileset, *framebuffer_bgmap; +extern SDL_Window *window, *vram_w, *bg_w; +extern bool show_tileset, show_bgmap; void setup(bool, bool); void cleanup(void); diff --git a/main.c b/main.c index 1321649..234adb1 100644 --- a/main.c +++ b/main.c @@ -12,8 +12,8 @@ #include "keys.h" #include "mmu.h" -extern bool show_tileset, show_bgmap; -extern SDL_Window *window, *vram_w, *bg_w; +// extern bool show_tileset, show_bgmap; +// extern SDL_Window *window, *vram_w, *bg_w; bool frame(void); From e23cf3c5e5d41351f643aa597455dd0a26237a02 Mon Sep 17 00:00:00 2001 From: Milan Roberson Date: Thu, 20 Aug 2026 12:18:06 -0700 Subject: [PATCH 2/3] rename workflow --- .github/workflows/{cmake-multi-platform.yml => build.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{cmake-multi-platform.yml => build.yml} (100%) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/build.yml similarity index 100% rename from .github/workflows/cmake-multi-platform.yml rename to .github/workflows/build.yml From 1a1725838c40bd8ede014be6f070c13544838097 Mon Sep 17 00:00:00 2001 From: Milan Roberson Date: Thu, 20 Aug 2026 12:18:42 -0700 Subject: [PATCH 3/3] update gha ci badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0258fac..cc18269 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # gbc_cpp GameBoy (eventually Color) Emulator in C(++) -[![Build Status](https://github.com/finagle29/gbc_cpp/actions/workflows/cmake-multi-platform.yml/badge.svg)](https://github.com/finagle29/gbc_cpp/actions/workflows/cmake-multi-platform.yml) +[![Build (ubuntu, macos)](https://github.com/finagle29/gbc_cpp/actions/workflows/build.yml/badge.svg)](https://github.com/finagle29/gbc_cpp/actions/workflows/build.yml) Use cmake to build.