From 4f3e895bf265b7ec17ecbb80c326b4d207387605 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Sun, 8 Jan 2023 14:05:26 +0700 Subject: [PATCH 1/3] merge workflow job for testing source and build dir input --- .github/workflows/test.yml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a79062..6c29376 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,27 +21,13 @@ jobs: - name: Run build result run: ${{ matrix.os == 'windows-latest' && 'build\Debug\hello_world.exe' || 'build/hello_world' }} - use-action-with-specified-source-dir: + use-action-with-specified-dir: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3.3.0 - - name: Use this action with specified source directory - uses: ./ - with: - source-dir: test - - - name: Run build result - run: build/hello_world - - use-action-with-specified-build-dir: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3.3.0 - - - name: Use this action with specified build directory + - name: Use this action with specified directory uses: ./ with: source-dir: test @@ -50,7 +36,7 @@ jobs: - name: Run build result run: test/build/hello_world - - name: Check if default build directory is not exist + - name: Check if the default build directory does not exist run: test ! -d build use-action-with-specified-compiler: From 44d52623ced599ea7cd602c61a113822c53dd445 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Sun, 8 Jan 2023 14:10:50 +0700 Subject: [PATCH 2/3] remove use action with additional args test (already tested on other job --- .github/workflows/test.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6c29376..4f1f6cc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,21 +72,3 @@ jobs: - name: Run build result run: build/${{ matrix.lang == 'C' && 'hello_world_c' || 'hello_world' }} - - use-action-with-additional-args: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3.3.0 - - - name: Use this action with build txt enabled - uses: ./ - with: - source-dir: test - args: -D BUILD_TXT=ON - - - name: Run build result - run: build/hello_world - - - name: Check if the txt result exist - run: cat build/hello_world.txt From 809b703d05a1b4446c456a7d524b3711ba2c2242 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Sun, 8 Jan 2023 14:11:25 +0700 Subject: [PATCH 3/3] remove option to build txt in the test project --- test/CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 27c7acd..8e4200e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,6 @@ project(test) option(BUILD_C "build hello world in C Language" OFF) option(BUILD_CXX "build hello world in CXX Language" ON) -option(BUILD_TXT "build hello world txt file" OFF) if(BUILD_C) add_executable(hello_world_c hello_world.c) @@ -12,10 +11,3 @@ endif() if(BUILD_CXX) add_executable(hello_world hello_world.cpp) endif() - -if(BUILD_TXT) - add_custom_target( - hello_world_txt ALL - COMMAND echo "Hello world!" >> ${CMAKE_CURRENT_BINARY_DIR}/hello_world.txt - ) -endif()