diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c15084..e51b54a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - name: Use this action uses: ./ - - name: Run build result + - name: Run the build result run: ${{ matrix.os == 'windows' && 'build\Debug\hello_world.exe' || 'build/hello_world' }} specified-dir-usage: @@ -33,7 +33,7 @@ jobs: source-dir: test build-dir: test/build - - name: Run build result + - name: Run the build result run: test/build/hello_world - name: Check if the default build directory does not exist @@ -75,7 +75,7 @@ jobs: cxx-compiler: clang++ args: -D CHECK_USING_CLANG=ON - - name: Run build result + - name: Run the build results run: build/test_c && build/test_cpp specified-generator-usage: @@ -93,5 +93,5 @@ jobs: source-dir: test generator: Ninja - - name: Run build result + - name: Run the build result run: build/hello_world diff --git a/README.md b/README.md index 1941a7e..e81da89 100644 --- a/README.md +++ b/README.md @@ -12,19 +12,21 @@ For more information, see [action.yml](./action.yml) and [GitHub Actions guide]( ### Inputs -> Note: All inputs are optional. - | Name | Value Type | Description | | --- | --- | --- | | `source-dir` | Path | Source directory of the CMake project. Defaults to current directory. | | `build-dir` | Path | Build directory of the CMake project. Defaults to `build` directory in current directory. | -| `targets` | Multiple strings | List of build targets. Could be specified more than one. Separate each target with a space or a new line. | +| `targets` | Multiple strings | List of build targets. | | `generator` | String | Build system generator of the CMake project. | | `c-compiler` | String | Preferred executable for compiling C language files. | -| `cxx-compiler` | String | Preferred executable for compiling CXX language files. | -| `c-flags` | Multiple strings | Additional flags passed when compiling C language files. Could be specified more than one. Separate each flag with a space or a new line. | -| `cxx-flags` | Multiple strings | Additional flags passed when compiling C++ language files. Could be specified more than one. Separate each flag with a space or a new line. | -| `args` | Multiple strings | Additional arguments passed during the CMake configuration. Could be specified more than one. Separate each target with a space or a new line. | +| `cxx-compiler` | String | Preferred executable for compiling C++ language files. | +| `c-flags` | Multiple strings | Additional flags passed when compiling C language files. | +| `cxx-flags` | Multiple strings | Additional flags passed when compiling C++ language files. | +| `args` | Multiple strings | Additional arguments passed during the CMake configuration. | + +> Note: Multiple strings mean that the input could be specified with more than one value. Separate each value with a space or a new line. + +> Note: All inputs are optional. ### Examples @@ -45,7 +47,7 @@ jobs: > Note: You can replace `@latest` with any version you like. -#### Using Different Directories +#### Specify the Source and the Build Directories ```yaml - name: Configure and build this project @@ -55,19 +57,21 @@ jobs: build-dir: submodules/build ``` -#### Build Custom Targets +#### Specify the Build Targets and Additional Options ```yaml - name: Configure and build this project uses: threeal/cmake-action@latest with: targets: hello_world_test fibonacci_test + c-flags: -Werror + cxx-flags: -Werror args: | + -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON - -DCMAKE_CXX_FLAGS='-Werror' ``` -#### Build Using Ninja and Clang +#### Using Ninja as the Generator and Clang as the Compiler ```yaml - name: Configure and build this project diff --git a/action.yml b/action.yml index 35b63a4..97eff0d 100644 --- a/action.yml +++ b/action.yml @@ -23,7 +23,7 @@ inputs: description: Preferred executable for compiling C language files required: false cxx-compiler: - description: Preferred executable for compiling CXX language files + description: Preferred executable for compiling C++ language files required: false c-flags: description: Additional flags passed when compiling C language files @@ -37,7 +37,7 @@ inputs: runs: using: composite steps: - - name: Process inputs + - name: Process the inputs id: process_inputs shell: bash run: | @@ -77,7 +77,7 @@ runs: *) choco install ninja ;; esac - - name: Configure CMake + - name: Configure the CMake project shell: bash run: cmake ${{ steps.process_inputs.outputs.cmake_args }}