Merge pull request #26 from threeal/audit-code

Audit Wording in the Code
This commit is contained in:
Alfi Maulana 2023-01-14 19:56:24 +07:00 committed by GitHub
commit 894b72b287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 18 deletions

View File

@ -18,7 +18,7 @@ jobs:
- name: Use this action - name: Use this action
uses: ./ uses: ./
- name: Run build result - name: Run the build result
run: ${{ matrix.os == 'windows' && 'build\Debug\hello_world.exe' || 'build/hello_world' }} run: ${{ matrix.os == 'windows' && 'build\Debug\hello_world.exe' || 'build/hello_world' }}
specified-dir-usage: specified-dir-usage:
@ -33,7 +33,7 @@ jobs:
source-dir: test source-dir: test
build-dir: test/build build-dir: test/build
- name: Run build result - name: Run the build result
run: test/build/hello_world run: test/build/hello_world
- name: Check if the default build directory does not exist - name: Check if the default build directory does not exist
@ -75,7 +75,7 @@ jobs:
cxx-compiler: clang++ cxx-compiler: clang++
args: -D CHECK_USING_CLANG=ON args: -D CHECK_USING_CLANG=ON
- name: Run build result - name: Run the build results
run: build/test_c && build/test_cpp run: build/test_c && build/test_cpp
specified-generator-usage: specified-generator-usage:
@ -93,5 +93,5 @@ jobs:
source-dir: test source-dir: test
generator: Ninja generator: Ninja
- name: Run build result - name: Run the build result
run: build/hello_world run: build/hello_world

View File

@ -12,19 +12,21 @@ For more information, see [action.yml](./action.yml) and [GitHub Actions guide](
### Inputs ### Inputs
> Note: All inputs are optional.
| Name | Value Type | Description | | Name | Value Type | Description |
| --- | --- | --- | | --- | --- | --- |
| `source-dir` | Path | Source directory of the CMake project. Defaults to current directory. | | `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. | | `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. | | `generator` | String | Build system generator of the CMake project. |
| `c-compiler` | String | Preferred executable for compiling C language files. | | `c-compiler` | String | Preferred executable for compiling C language files. |
| `cxx-compiler` | String | Preferred executable for compiling CXX language files. | | `cxx-compiler` | String | Preferred executable for compiling C++ 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. | | `c-flags` | Multiple strings | Additional flags passed when compiling C language files. |
| `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. | | `cxx-flags` | Multiple strings | Additional flags passed when compiling C++ language files. |
| `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. | | `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 ### Examples
@ -45,7 +47,7 @@ jobs:
> Note: You can replace `@latest` with any version you like. > Note: You can replace `@latest` with any version you like.
#### Using Different Directories #### Specify the Source and the Build Directories
```yaml ```yaml
- name: Configure and build this project - name: Configure and build this project
@ -55,19 +57,21 @@ jobs:
build-dir: submodules/build build-dir: submodules/build
``` ```
#### Build Custom Targets #### Specify the Build Targets and Additional Options
```yaml ```yaml
- name: Configure and build this project - name: Configure and build this project
uses: threeal/cmake-action@latest uses: threeal/cmake-action@latest
with: with:
targets: hello_world_test fibonacci_test targets: hello_world_test fibonacci_test
c-flags: -Werror
cxx-flags: -Werror
args: | args: |
-DCMAKE_BUILD_TYPE=Debug
-DBUILD_TESTING=ON -DBUILD_TESTING=ON
-DCMAKE_CXX_FLAGS='-Werror'
``` ```
#### Build Using Ninja and Clang #### Using Ninja as the Generator and Clang as the Compiler
```yaml ```yaml
- name: Configure and build this project - name: Configure and build this project

View File

@ -23,7 +23,7 @@ inputs:
description: Preferred executable for compiling C language files description: Preferred executable for compiling C language files
required: false required: false
cxx-compiler: cxx-compiler:
description: Preferred executable for compiling CXX language files description: Preferred executable for compiling C++ language files
required: false required: false
c-flags: c-flags:
description: Additional flags passed when compiling C language files description: Additional flags passed when compiling C language files
@ -37,7 +37,7 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
- name: Process inputs - name: Process the inputs
id: process_inputs id: process_inputs
shell: bash shell: bash
run: | run: |
@ -77,7 +77,7 @@ runs:
*) choco install ninja ;; *) choco install ninja ;;
esac esac
- name: Configure CMake - name: Configure the CMake project
shell: bash shell: bash
run: cmake ${{ steps.process_inputs.outputs.cmake_args }} run: cmake ${{ steps.process_inputs.outputs.cmake_args }}