From fdd553096e40c9d0143d5b449eac1abda723f2a0 Mon Sep 17 00:00:00 2001 From: Florian Knigge Date: Mon, 21 Oct 2024 12:40:46 +0200 Subject: [PATCH 1/7] Add test workflow for github actions Building and running the test based on CMakeLists.txt --- .github/workflows/build+test.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/build+test.yml diff --git a/.github/workflows/build+test.yml b/.github/workflows/build+test.yml new file mode 100644 index 0000000..c60f3cf --- /dev/null +++ b/.github/workflows/build+test.yml @@ -0,0 +1,24 @@ +name: Build and test ccronexpr +on: + push: + branches: + - master + tags: + - test + - '[0-9]+.[0-9]+.[0-9]' + pull_request: + types: [opened, synchronize, labeled, reopened] + workflow_dispatch: + +jobs: + build_test: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Make build dir + run: mkdir -p "${{ github.workspace }}/build" + - name: Build with CMAKE + run: cmake --build "${{ github.workspace }}/build" --target ccronexpr + - name: Run test executable + run: "${{ github.workspace }}/build/ccronexpr" From 73e8463dea1696c3f0f6087c5a91bf5685ac3623 Mon Sep 17 00:00:00 2001 From: Florian Knigge Date: Mon, 21 Oct 2024 12:45:59 +0200 Subject: [PATCH 2/7] Add missing CMake configuration --- .github/workflows/build+test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build+test.yml b/.github/workflows/build+test.yml index c60f3cf..1fc1eff 100644 --- a/.github/workflows/build+test.yml +++ b/.github/workflows/build+test.yml @@ -19,6 +19,8 @@ jobs: - name: Make build dir run: mkdir -p "${{ github.workspace }}/build" - name: Build with CMAKE - run: cmake --build "${{ github.workspace }}/build" --target ccronexpr + run: | + cmake . + cmake --build "${{ github.workspace }}/build" --target ccronexpr - name: Run test executable run: "${{ github.workspace }}/build/ccronexpr" From 4979e671cb509c9ace22a512af4acf6d8ce6fc98 Mon Sep 17 00:00:00 2001 From: Florian Knigge Date: Mon, 21 Oct 2024 12:48:49 +0200 Subject: [PATCH 3/7] Find missing CMakeLists.txt --- .github/workflows/build+test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build+test.yml b/.github/workflows/build+test.yml index 1fc1eff..803fed3 100644 --- a/.github/workflows/build+test.yml +++ b/.github/workflows/build+test.yml @@ -20,7 +20,8 @@ jobs: run: mkdir -p "${{ github.workspace }}/build" - name: Build with CMAKE run: | - cmake . + ls ${{ github.workspace }} + cmake ${{ github.workspace }} cmake --build "${{ github.workspace }}/build" --target ccronexpr - name: Run test executable run: "${{ github.workspace }}/build/ccronexpr" From 38e474c44eafbd39ee508116fbd216830d51576e Mon Sep 17 00:00:00 2001 From: Florian Knigge Date: Mon, 21 Oct 2024 12:50:21 +0200 Subject: [PATCH 4/7] Add missing CMakeLists.txt --- .gitignore | 1 - CMakeLists.txt | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 95428ef..7e62b63 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ /nbproject /Makefile /cmake-build-debug/ -/CMakeLists.txt /.idea/ a.out diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b747b5f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.28) +project(ccronexpr C) + +set(CMAKE_C_STANDARD 11) + +include_directories(.) + +add_executable(ccronexpr + ccronexpr.c + ccronexpr.h + ccronexpr_test.c) From 12f2d4d2de6dd5a8acb52eb0dc9f0a7ce8178e72 Mon Sep 17 00:00:00 2001 From: Florian Knigge Date: Mon, 21 Oct 2024 12:50:30 +0200 Subject: [PATCH 5/7] Add missing CMakeLists.txt --- .github/workflows/build+test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build+test.yml b/.github/workflows/build+test.yml index 803fed3..1e0aebf 100644 --- a/.github/workflows/build+test.yml +++ b/.github/workflows/build+test.yml @@ -20,7 +20,6 @@ jobs: run: mkdir -p "${{ github.workspace }}/build" - name: Build with CMAKE run: | - ls ${{ github.workspace }} cmake ${{ github.workspace }} cmake --build "${{ github.workspace }}/build" --target ccronexpr - name: Run test executable From 469f688b2b594ecce6a89ec59615a11061c4e2d6 Mon Sep 17 00:00:00 2001 From: Florian Knigge Date: Mon, 21 Oct 2024 12:54:05 +0200 Subject: [PATCH 6/7] Add concurrency groups, build dir to configure command --- .github/workflows/build+test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build+test.yml b/.github/workflows/build+test.yml index 1e0aebf..43c6a17 100644 --- a/.github/workflows/build+test.yml +++ b/.github/workflows/build+test.yml @@ -10,6 +10,10 @@ on: types: [opened, synchronize, labeled, reopened] workflow_dispatch: +concurrency: + group: "${{ github.workflow }}-${{ github.ref_type == 'tag' && ( (github.ref_name == '0.0.0-test' && 'test') || 'master') || github.ref_name }}" + cancel-in-progress: ${{ github.ref_type == 'tag' || github.ref_name != 'master' }} + jobs: build_test: runs-on: ubuntu-latest @@ -20,7 +24,7 @@ jobs: run: mkdir -p "${{ github.workspace }}/build" - name: Build with CMAKE run: | - cmake ${{ github.workspace }} - cmake --build "${{ github.workspace }}/build" --target ccronexpr + cmake --build "${{ github.workspace }}/build" ${{ github.workspace }} + cmake --build "${{ github.workspace }}/build" --target ccronexpr ${{ github.workspace }} - name: Run test executable run: "${{ github.workspace }}/build/ccronexpr" From 0f347ce1f4f7568eb4ac962e8dbb9d8fc1e8edc8 Mon Sep 17 00:00:00 2001 From: Florian Knigge Date: Mon, 21 Oct 2024 12:59:27 +0200 Subject: [PATCH 7/7] Fix CMake option naming --- .github/workflows/build+test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build+test.yml b/.github/workflows/build+test.yml index 43c6a17..5111096 100644 --- a/.github/workflows/build+test.yml +++ b/.github/workflows/build+test.yml @@ -24,7 +24,7 @@ jobs: run: mkdir -p "${{ github.workspace }}/build" - name: Build with CMAKE run: | - cmake --build "${{ github.workspace }}/build" ${{ github.workspace }} - cmake --build "${{ github.workspace }}/build" --target ccronexpr ${{ github.workspace }} + cmake -B "${{ github.workspace }}/build" -S ${{ github.workspace }} + cmake --build "${{ github.workspace }}/build" --target ccronexpr - name: Run test executable run: "${{ github.workspace }}/build/ccronexpr"