diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 0000000..5448de1 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,53 @@ +--- +on: [push] + +name: Build + +jobs: + format: + name: Format + runs-on: ubuntu-22.04 + steps: + - name: Check out the code + uses: actions/checkout@v4 + - name: Install clang-format + run: | + sudo apt-get update + sudo apt-get -y install clang-format + - name: Check the code's formatting + run: clang-format --dry-run src/*.h src/*.cpp 2>&1 | tee fmt.log; [ ! -s fmt.log ] + + lint: + name: Lint + runs-on: ubuntu-22.04 + steps: + - name: Check out the code + uses: actions/checkout@v4 + - name: Install clang-tidy and the toolchain + run: | + sudo apt-get update + sudo apt-get -y install clang-tidy cmake freeglut3-dev libglew-dev libglm-dev + - name: Set up the build environment + run: cmake -S . -B cmake-build-debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - name: Have clang-tidy lint for errors + run: clang-tidy -p cmake-build-debug src/*.cpp src/*.h --warnings-as-errors='*' + + build: + name: Build + runs-on: ubuntu-22.04 + steps: + - name: Check out the code + uses: actions/checkout@v4 + - name: Install the toolchain + run: | + sudo apt-get update + sudo apt-get -y install cmake freeglut3-dev libglew-dev libglm-dev + - name: Set up the build environment + run: cmake -S . -B cmake-build-debug + - name: Compile the code + run: cmake --build cmake-build-debug + - name: Save executable + uses: forgejo/upload-artifact@v4 + with: + name: bin.zip + path: cmake-build-debug/perlin-shadows diff --git a/CMakeLists.txt b/CMakeLists.txt index ff2abe3..93e5e18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.27) +cmake_minimum_required(VERSION 3.22) project(perlin-shadows) set(CMAKE_CXX_STANDARD 14) @@ -36,4 +36,4 @@ file(READ src/shadow.frag SHADOW_FRAG) file(READ src/shadow.geom SHADOW_GEOM) configure_file(src/point_light.in.h src/point_light.h @ONLY) -target_include_directories(perlin-shadows PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/src") \ No newline at end of file +target_include_directories(perlin-shadows PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/src")