From 7cff9b0cd1165b8acfb672f76a192cd7e1bae457 Mon Sep 17 00:00:00 2001 From: GregoireW <24318548+GregoireW@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:35:58 +0200 Subject: [PATCH] CI --- .github/workflows/build.yaml | 42 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 32 ++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..34a63f1 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,42 @@ +name: simple build and test + +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install cmake libcyaml-dev libjson-c-dev libevent-dev lcov -y + + - name: Create makefile + run: | + cmake -S . -B $(pwd)/cmake-build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="--coverage" -DCMAKE_EXE_LINKER_FLAGS="--coverage" + + - name: Build + run: | + cmake --build $(pwd)/cmake-build --config Release + + #- name: Run tests + # run: | + # exec test + # + + #- name: Generate coverage report + # run: | + # cd $(pwd)/cmake-build + # lcov --capture --directory . --output-file coverage.info + # lcov --remove coverage.info '/usr/*' --output-file coverage.info + # lcov --list coverage.info diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..7793fdd --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: simple build and test + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install cmake libcyaml-dev libjson-c-dev libevent-dev -y + + - name: Create makefile + run: | + cmake -S . -B $(pwd)/cmake-build -DCMAKE_BUILD_TYPE=Release + + - name: Build + run: | + cmake --build $(pwd)/cmake-build --config Release + + - name: Upload release asset + env: + GH_TOKEN: ${{ github.token }} + run: | + mv $(pwd)/cmake-build/caster $(pwd)/cmake-build/caster-linux-x64 + gh release upload ${{github.event.release.tag_name}} $(pwd)/cmake-build/caster-linux-x64 +