From 354e9a5b996836bc6ccba179dd014cb737ad9bb9 Mon Sep 17 00:00:00 2001 From: klemek Date: Wed, 13 May 2026 16:17:08 +0200 Subject: [PATCH] ci: add proper ci --- .github/workflows/build.yml | 74 +++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 52 -------------------------- .github/workflows/lint.yml | 44 ++++++++++++++++++++++ .gitignore | 3 +- Makefile.am | 4 +- Makefile.dev | 40 ++++++++++---------- README.md | 3 +- configure.ac | 4 +- src/shaders.c | 3 +- 9 files changed, 146 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..3c0355f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,74 @@ +name: Clang Build CI + +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_dispatch: + push: + paths: + - '.github/workflows/build.yml' + - 'src/*.c' + - 'src/*.h' + - 'configure.ac' + - 'Makefile.am' + +env: + GCC_ARGS: src/*.c src/*.h -lglfw -lGL -lm -lasound -Iinclude hashmap.c/hashmap.c log.c/src/log.c -DGLFW_INCLUDE_NONE -DGLFW_NATIVE_INCLUDE_NONE + GCC_ARGS_VIDEO: -DGLFW_EXPOSE_NATIVE_EGL -DVIDEO_IN + PACKAGES: "libglfw3-dev libgl-dev libasound2-dev" + PACKAGES_VIDEO: "libv4l-dev" + TARGET: forge + TEST_ARGS: "--help" + +jobs: + build-release: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES $PACKAGES_VIDEO + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: aclocal + run: aclocal + - name: autoconf + run: autoconf + - name: automake + run: automake --add-missing + - name: configure + run: ./configure + - name: make + run: make + - name: make distcheck + run: make distcheck + + run-no-video: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: gcc + run: mkdir -p build && gcc $GCC_ARGS -o build/$TARGET + - name: run program + run: ./build/$TARGET $TEST_ARGS + + run-video: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES $PACKAGES_VIDEO + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: gcc + run: mkdir -p build && gcc $GCC_ARGS $GCC_ARGS_VIDEO -o build/$TARGET + - name: run program + run: ./build/$TARGET $TEST_ARGS diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index a4aa176..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: C-lang CI - -on: - push: - branches: ["master"] - pull_request: - branches: ["master"] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: install libs - run: sudo apt install -y libglfw3-dev libgl-dev libv4l-dev libasound2-dev libbsd-dev - - name: gcc - run: mkdir -p build && gcc -v -Wall -Wextra -Werror -Wno-format-truncation src/*.c src/*.h -lglfw -lGL -lm -lasound -lbsd -Iinclude hashmap.c/hashmap.c log.c/src/log.c -DGLFW_INCLUDE_NONE -DGLFW_EXPOSE_NATIVE_EGL -DGLFW_NATIVE_INCLUDE_NONE -DVIDEO_IN - - build-no-video: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: install libs - run: sudo apt install -y libglfw3-dev libgl-dev libasound2-dev libbsd-dev - - name: gcc - run: mkdir -p build && gcc -v -Werror src/*.c src/*.h -lglfw -lGL -lm -lasound -lbsd -Iinclude hashmap.c/hashmap.c log.c/src/log.c -DGLFW_INCLUDE_NONE -DGLFW_EXPOSE_NATIVE_EGL -DGLFW_NATIVE_INCLUDE_NONE - - build-release: - needs: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: install libs - run: sudo apt install -y libglfw3-dev libgl-dev libv4l-dev libasound2-dev libbsd-dev - - name: aclocal - run: aclocal - - name: autoconf - run: autoconf - - name: automake - run: automake --add-missing - - name: configure - run: ./configure - - name: make - run: make - - name: make distcheck - run: make distcheck diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..36b1f0e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,44 @@ +name: Clang Lint CI + +concurrency: + group: lint-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_dispatch: + push: + paths: + - '.github/workflows/lint.yml' + - 'src/*.c' + - 'src/*.h' + +env: + GCC_ARGS: src/*.c src/*.h -lglfw -lGL -lm -lasound -Iinclude hashmap.c/hashmap.c log.c/src/log.c -DGLFW_INCLUDE_NONE -DGLFW_NATIVE_INCLUDE_NONE + GCC_ARGS_VIDEO: -DGLFW_EXPOSE_NATIVE_EGL -DVIDEO_IN + PACKAGES: "libglfw3-dev libgl-dev libasound2-dev" + PACKAGES_VIDEO: "libv4l-dev" + +jobs: + lint-no-video: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: gcc + run: gcc -Wall -Wextra -Werror -Wno-format-truncation -Wno-unused-parameter $GCC_ARGS + + lint-video: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES $PACKAGES_VIDEO + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: gcc + run: gcc -Wall -Wextra -Werror -Wno-format-truncation $GCC_ARGS $GCC_ARGS_VIDEO diff --git a/.gitignore b/.gitignore index a689f8a..3ca9a57 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ confdeps.* conftest.* *.txt error.glsl -draft/ \ No newline at end of file +draft/ +*.gch diff --git a/Makefile.am b/Makefile.am index c9504f1..59e4e3c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,9 @@ AUTOMAKE_OPTIONS = foreign subdir-objects -Wall bin_PROGRAMS = forge forge_SOURCES = src/args.c src/arr.c src/config_file.c src/file.c src/forge.c src/main.c src/midi.c src/project.c src/rand.c src/shaders.c src/shared.c src/state.c src/string.c src/tempo.c src/timer.c src/video.c src/window.c $(top_srcdir)/include/glad/gl.h $(top_srcdir)/include/glad/egl.h $(top_srcdir)/hashmap.c/hashmap.c $(top_srcdir)/log.c/src/log.c forge_CFLAGS = -Ofast -march=native -flto -funroll-loops -fprefetch-loop-arrays -fno-exceptions -fopenmp -I$(top_srcdir)/include -DGLFW_INCLUDE_NONE -DGLFW_EXPOSE_NATIVE_EGL -DGLFW_NATIVE_INCLUDE_NONE -DLOG_USE_COLOR -DVIDEO_IN -DDATADIR=\"$(datadir)/$(PACKAGE)\" -forge_LDADD = -lm -lGL -lglfw -lasound -lbsd +forge_LDADD = -lm -lGL -lglfw -lasound include_HEADERS = src/args.h src/arr.h src/config.h src/config_file.h src/constants.h src/file.h src/forge.h src/main.h src/midi.h src/project.h src/rand.h src/shaders.h src/shared.h src/state.h src/string.h src/tempo.h src/timer.h src/types.h src/video.h src/window.h $(top_srcdir)/include/glad/gl.h $(top_srcdir)/include/glad/egl.h $(top_srcdir)/include/linmath.h $(top_srcdir)/include/hashmap.h $(top_srcdir)/include/log.h EXTRA_DIST = default/forge_project.cfg default/frag1.glsl default/frag10.glsl default/frag2.glsl default/frag3.glsl default/frag4.glsl default/frag5.glsl default/frag6.glsl default/frag7.glsl default/frag8.glsl default/frag9.glsl default/inc_cp437.glsl default/inc_debug.glsl default/inc_functions.glsl default/inc_fx.glsl default/inc_magic.glsl default/inc_rand.glsl default/inc_res.glsl default/inc_sentences.glsl default/inc_src.glsl default/inc_template.glsl default/inc_time.glsl default/inc_yuyv.glsl confdir = $(prefix)/share/$(PACKAGE) -conf_DATA = default/forge_project.cfg default/frag1.glsl default/frag10.glsl default/frag2.glsl default/frag3.glsl default/frag4.glsl default/frag5.glsl default/frag6.glsl default/frag7.glsl default/frag8.glsl default/frag9.glsl default/inc_cp437.glsl default/inc_debug.glsl default/inc_functions.glsl default/inc_fx.glsl default/inc_magic.glsl default/inc_rand.glsl default/inc_res.glsl default/inc_sentences.glsl default/inc_src.glsl default/inc_template.glsl default/inc_time.glsl default/inc_yuyv.glsl \ No newline at end of file +conf_DATA = default/forge_project.cfg default/frag1.glsl default/frag10.glsl default/frag2.glsl default/frag3.glsl default/frag4.glsl default/frag5.glsl default/frag6.glsl default/frag7.glsl default/frag8.glsl default/frag9.glsl default/inc_cp437.glsl default/inc_debug.glsl default/inc_functions.glsl default/inc_fx.glsl default/inc_magic.glsl default/inc_rand.glsl default/inc_res.glsl default/inc_sentences.glsl default/inc_src.glsl default/inc_template.glsl default/inc_time.glsl default/inc_yuyv.glsl diff --git a/Makefile.dev b/Makefile.dev index e01931c..3b10e1e 100644 --- a/Makefile.dev +++ b/Makefile.dev @@ -14,7 +14,7 @@ build: -Iinclude \ hashmap.c/hashmap.c \ log.c/src/log.c \ - -lm -lGL -lglfw -lasound -lbsd \ + -lm -lGL -lglfw -lasound \ -Wall -Wextra \ -Wno-format-truncation \ -DGLFW_INCLUDE_NONE \ @@ -25,6 +25,24 @@ build: -o build/$(TARGET) \ -g -Og +.PHONY: build-no-video +build-no-video: + @mkdir -p build + gcc \ + src/*.h src/*.c \ + -Iinclude \ + hashmap.c/hashmap.c \ + log.c/src/log.c \ + -lm -lGL -lglfw -lasound \ + -Wall -Wextra \ + -Wno-format-truncation \ + -Wno-unused-parameter \ + -DGLFW_INCLUDE_NONE \ + -DGLFW_NATIVE_INCLUDE_NONE \ + -DLOG_USE_COLOR \ + -o build/$(TARGET) \ + -g -Og + .PHONY: format format: clang-format -i src/* @@ -50,25 +68,7 @@ valgrind: build .PHONY: clean-release clean-release: - @rm -rf \ - autom4te.cache \ - aclocal.m4 \ - compile \ - config.* \ - configure \ - configure~ \ - depcomp \ - **/.deps \ - **/**/.deps \ - $(TARGET) \ - $(TARGET)-*.tar.gz \ - $(TARGET)-*.pkg.tar.zst \ - install-sh \ - Makefile \ - Makefile.in \ - missing \ - src/.* \ - src/*.o + git clone -f -x .PHONY: test-release test-release: clean clean-release diff --git a/README.md b/README.md index 0e5c728..d528a45 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![GitHub Release](https://img.shields.io/github/v/release/klemek/forge-steel?style=flat-square)](https://github.com/klemek/forge-steel/releases) [![GitHub Release Date](https://img.shields.io/github/release-date/klemek/forge-steel?style=flat-square)](https://github.com/klemek/forge-steel/releases) [![GitHub last commit](https://img.shields.io/github/last-commit/klemek/forge?style=flat-square)](https://github.com/klemek/forge-steel/commits/master/) [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/klemek/forge-steel/ci.yml?style=flat-square)](https://github.com/klemek/forge-steel/actions/workflows/ci.yml) [![Sonar Quality Gate](https://img.shields.io/sonar/quality_gate/klemek_forge-steel?server=https%3A%2F%2Fsonarcloud.io&style=flat-square)](https://sonarcloud.io/summary/new_code?id=klemek_forge-steel) ![LOC](https://img.shields.io/badge/LOC-3.8k-blue?style=flat-square) +[![](https://git.klemek.fr/klemek/forge-steel/actions/workflows/lint.yml/badge.svg?branch=main&style=flat-square)](https://git.klemek.fr/klemek/forge-steel/actions?workflow=lint.yml) [![](https://git.klemek.fr/klemek/forge-steel/actions/workflows/build.yml/badge.svg?branch=main&style=flat-square)](https://git.klemek.fr/klemek/forge-steel/actions?workflow=build.yml) # F.O.R.G.E. (Steel) @@ -116,7 +116,6 @@ Here's a quick rundown of the process: | libGL | libgl-dev | extra/libglvnd | | libasound | libasound2-dev | extra/alsa-lib | | libv4l2 | libv4l-dev | extra/v4l-utils | -| libbsd | libbsd-dev | extra/libbsd | ### From release diff --git a/configure.ac b/configure.ac index b66fece..abd3ab2 100644 --- a/configure.ac +++ b/configure.ac @@ -23,8 +23,6 @@ AC_CHECK_HEADERS([string.h]) AC_CHECK_HEADERS([time.h]) AC_CHECK_HEADERS([unistd.h]) -AC_CHECK_HEADERS([bsd/string.h]) - AC_CHECK_HEADERS([linux/videodev2.h]) AC_CHECK_HEADERS([alsa/rawmidi.h]) @@ -33,4 +31,4 @@ AC_CHECK_HEADERS([GLFW/glfw3.h]) AC_CHECK_HEADERS([GLFW/glfw3native.h]) AC_CONFIG_FILES([Makefile]) -AC_OUTPUT \ No newline at end of file +AC_OUTPUT diff --git a/src/shaders.c b/src/shaders.c index 72df2f0..cb6ff87 100644 --- a/src/shaders.c +++ b/src/shaders.c @@ -48,6 +48,7 @@ bool check_glerror(ShaderProgram *program, const char *context) { } bool check_eglerror_ro(const char *context) { +#ifdef VIDEO_IN unsigned int code; code = eglGetError(); @@ -56,7 +57,7 @@ bool check_eglerror_ro(const char *context) { log_warn("EGL Error: %04x (%s)", code, context); return true; } - +#endif /* VIDEO_IN */ return false; }