mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-03 21:33:42 +00:00 
			
		
		
		
	Merge pull request #36 from threeal/audit-code
Audit Documentations and Codes
This commit is contained in:
		
						commit
						20b9c20527
					
				
							
								
								
									
										38
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								README.md
									
									
									
									
									
								
							@ -4,7 +4,18 @@
 | 
				
			|||||||
[](./LICENSE)
 | 
					[](./LICENSE)
 | 
				
			||||||
[](https://github.com/threeal/cmake-action/actions/workflows/test.yml)
 | 
					[](https://github.com/threeal/cmake-action/actions/workflows/test.yml)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Configure and build a [CMake](https://cmake.org/) project on [GitHub Actions](https://github.com/features/actions).
 | 
					Configure, build, and test a [CMake](https://cmake.org/) project on [GitHub Actions](https://github.com/features/actions).
 | 
				
			||||||
 | 
					Use this action to simplify the workflow run of your CMake project.
 | 
				
			||||||
 | 
					This action will configure a build environment for your project using the `cmake` command,
 | 
				
			||||||
 | 
					  then it will build your project by running a `cmake --build` command,
 | 
				
			||||||
 | 
					  and last it could test your project using the `ctest` command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Features
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Configure and build a project using the [cmake](https://cmake.org/cmake/help/latest/manual/cmake.1.html) command.
 | 
				
			||||||
 | 
					- Optionally test a project using the [ctest](https://cmake.org/cmake/help/latest/manual/ctest.1.html) command.
 | 
				
			||||||
 | 
					- Auto-detect and install required dependencies.
 | 
				
			||||||
 | 
					- Specify multiple CMake options directly from the Action inputs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -15,7 +26,7 @@ For more information, see [action.yml](./action.yml) and [GitHub Actions guide](
 | 
				
			|||||||
| 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 inside the source directory. |
 | 
				
			||||||
| `targets` | Multiple strings | List of build targets. |
 | 
					| `targets` | Multiple strings | List of build targets. |
 | 
				
			||||||
| `run-test` | `true` or `false` | If enabled, run testing using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). Defaults to `false`. |
 | 
					| `run-test` | `true` or `false` | If enabled, run testing using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). Defaults to `false`. |
 | 
				
			||||||
| `generator` | String | Build system generator of the CMake project. |
 | 
					| `generator` | String | Build system generator of the CMake project. |
 | 
				
			||||||
@ -47,7 +58,7 @@ jobs:
 | 
				
			|||||||
        uses: threeal/cmake-action@latest
 | 
					        uses: threeal/cmake-action@latest
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> Note: You can replace `@latest` with any version you like.
 | 
					> Note: You can replace `@latest` with any version you like. See [this](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsuses).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Specify the Source and the Build Directories
 | 
					#### Specify the Source and the Build Directories
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -56,21 +67,26 @@ jobs:
 | 
				
			|||||||
  uses: threeal/cmake-action@latest
 | 
					  uses: threeal/cmake-action@latest
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    source-dir: submodules
 | 
					    source-dir: submodules
 | 
				
			||||||
    build-dir: submodules/build
 | 
					    build-dir: submodules/out
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Specify the Build Targets and Additional Options
 | 
					#### Specify the Build Targets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```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_mars hello_sun
 | 
				
			||||||
    c-flags: -Werror
 | 
					```
 | 
				
			||||||
    cxx-flags: -Werror
 | 
					
 | 
				
			||||||
    args: |
 | 
					#### Run Unit Tests After Build
 | 
				
			||||||
      -DCMAKE_BUILD_TYPE=Debug
 | 
					
 | 
				
			||||||
      -DBUILD_TESTING=ON
 | 
					```yaml
 | 
				
			||||||
 | 
					- name: Configure, build, and test this project
 | 
				
			||||||
 | 
					  uses: threeal/cmake-action@latest
 | 
				
			||||||
 | 
					  with:
 | 
				
			||||||
 | 
					    args: -DBUILD_TESTING=ON
 | 
				
			||||||
 | 
					    run-test: true
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Using Ninja as the Generator and Clang as the Compiler
 | 
					#### Using Ninja as the Generator and Clang as the Compiler
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
name: CMake Action
 | 
					name: CMake Action
 | 
				
			||||||
description: Configure and build a CMake project
 | 
					description: Configure, build, and test a CMake project
 | 
				
			||||||
author: Alfi Maulana
 | 
					author: Alfi Maulana
 | 
				
			||||||
branding:
 | 
					branding:
 | 
				
			||||||
  color: gray-dark
 | 
					  color: gray-dark
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user