Skip to content
Open
71 changes: 71 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: C/C++ CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-22.04

steps:
# Step 1: Checkout Code
- name: Checkout Code
uses: actions/checkout@v4

# Step 2: Install GCC 11.4.0 and Base Dependencies
- name: Install GCC 11.4.0 and Base Dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common wget \
build-essential cmake make
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11
gcc --version

# Step 3: Install SDL2
- name: Install SDL2 Dependency
run: |
sudo apt-get update && sudo apt-get install -y libsdl2-dev

# Step 4: Install SDL2 Mixer
- name: Install SDL Mixer Dependency
run: |
sudo apt-get update
sudo apt-get install -y libopusfile-dev libxmp-dev fluidsynth libfluidsynth-dev \
wavpack libwavpack-dev libsdl2-mixer-dev

# Step 5: Install SDL2 TTF
- name: Install SDL2 TTF Dependency
run: |
sudo apt-get update
sudo apt-get install -y libfreetype6-dev
mkdir -p dependencies
cd dependencies
wget https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.24.0/SDL2_ttf-2.24.0.tar.gz
tar -xzf SDL2_ttf-2.24.0.tar.gz
cd SDL2_ttf-2.24.0
mkdir build && cd build
cmake ..
make
sudo make install

# Step 6: Build Project
- name: Build Project
run: |
mkdir -p build
cd build
cmake -DSDL2_mixer_DIR=/usr/lib/x86_64-linux-gnu/cmake/SDL2_mixer ..
make

# # Step 7: Run Tests
# - name: Run Tests
# run: |
# ./scripts/run_tests.sh
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.16)

# Set the project name and version
project(engine VERSION 1.0 LANGUAGES CXX)
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,13 @@ You have to install LLVM for formatting your code. Refer to [this](https://llvm.

- (**PROBABLY ONLY FOR WSL USERS**)When SDL library tries to popup a textbox or etc. via using xServer over windows, it fails and gets a core dump fail. To fix this, you need to install the correct GUI package for your wsl. It is most probably gets fixed with ```sudo apt install zenity ``` but it may depend on the linux version and distribution you are currently using. For further questions, go and search it on Google, Stackoverflow or ask ChatGPT. Don't bother me.
- In systems other than Ubuntu 22.04LTS, some building problems might occur (for example, i could not build Logger class because i had to include each C++ standard library by hand, such as **`#include <array>`** **`#include <unordered_map>`**). If you know how to fix it, please feel free to contribute to this file.


### ** Test `Action` on local
In order to test the project on local computer before you push, you can use [`act`](https://github.com/nektos/act) module. This module uses the Docker API to either pull or build the necessary images, as defined in your workflow files and finally determines the execution path baseed on the dependencies that were defined.
Please look at the [act user guide](https://nektosact.com/) for more documentation.

```bash
curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | bash
act .github/workflows/c-cpp.yml
```
2 changes: 2 additions & 0 deletions include/CollisionManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <cmath>
#include <memory>
#include <vector>
#include <unordered_map>

namespace game::engine
{
class CollisionManager
Expand Down
2 changes: 2 additions & 0 deletions include/Logger.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#pragma once
#include <array>
#include <iostream>
#include <mutex>
#include <sstream>
#include <string>
#include <type_traits>
namespace utils
{
class Logger
Expand Down
Loading