From d6400171363192f1bc5dad65c3f96523b22be524 Mon Sep 17 00:00:00 2001 From: klemek Date: Wed, 13 May 2026 16:30:09 +0200 Subject: [PATCH] ci: proper CI --- .github/workflows/build.yml | 74 +++++++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 44 ++++++++++++++++++++++ README.md | 2 +- 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.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/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/README.md b/README.md index 7741d16..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)