From 9bc3bd6ba961041b1a5eeba4a865047219e4acd6 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 6 Jan 2023 21:27:00 +0700 Subject: [PATCH 1/3] add `source-dir` input and a step to process inputs --- action.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 28a082d..16f98c2 100644 --- a/action.yml +++ b/action.yml @@ -4,12 +4,23 @@ author: Alfi Maulana branding: color: gray-dark icon: terminal +inputs: + source-dir: + description: The source directory of CMake project + required: false + default: . runs: using: composite steps: + - name: Process inputs + shell: bash + run: | + CONFIGURE_ARGS="'${{ inputs.source-dir }}' -B build" + echo "CMAKE_CONFIGURE_ARGS=$CONFIGURE_ARGS" >> $GITHUB_ENV + - name: Configure CMake shell: bash - run: cmake . -B build + run: cmake ${{ env.CMAKE_CONFIGURE_ARGS }} - name: Build targets shell: bash From d008b5582a674ea9d814bd811b334d2cdc653185 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 6 Jan 2023 21:28:15 +0700 Subject: [PATCH 2/3] add test status badge in the `README.md` --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a4a2603..0be5739 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # CMake Action +[![test status](https://img.shields.io/github/actions/workflow/status/threeal/cmake-action/test.yml?label=test&branch=main)](https://github.com/threeal/cmake-action/actions/workflows/test.yml) + Configure and build [CMake](https://cmake.org/) project on [GitHub Actions](https://github.com/features/actions). From 69f2474e5ed6eafb968c1d0625750071bd491c76 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 6 Jan 2023 21:34:49 +0700 Subject: [PATCH 3/3] add workflow step to test this action with specified source dir --- .github/workflows/test.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f4e01e..16dba8b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,3 +17,17 @@ jobs: - name: Run build result run: ./build/hello_world + + use-action-with-specified-source-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