From 6eb10c8bde652faacb19c216d26a16d1747454dd Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 13 Jan 2023 22:16:56 +0700 Subject: [PATCH] add example usage in `README.md` --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README.md b/README.md index 8a65f37..9a92c7a 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,55 @@ For more information, see [action.yml](./action.yml) and [GitHub Actions guide]( | `c-compiler` | String | Preferred executable for compiling C language files. | | `cxx-compiler` | String | Preferred executable for compiling CXX 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. | + +### Examples + +```yaml +name: build +on: + push: +jobs: + build-project: + runs-on: ubuntu-latest + steps: + - name: Check out this repository + uses: actions/checkout@v3.3.0 + + - name: Configure and build this project + uses: threeal/cmake-action@latest +``` + +> Note: You can replace `@latest` with any version you like. + +#### Using Different Directories + +```yaml +- name: Configure and build this project + uses: threeal/cmake-action@latest + with: + source-dir: submodules + build-dir: submodules/build +``` + +#### Build Custom Targets + +```yaml +- name: Configure and build this project + uses: threeal/cmake-action@latest + with: + targets: hello_world_test fibonacci_test + args: | + -DBUILD_TESTING=ON + -DCMAKE_CXX_FLAGS='-Werror' +``` + +#### Build Using Ninja and Clang + +```yaml +- name: Configure and build this project + uses: threeal/cmake-action@latest + with: + generator: Ninja + c-compiler: clang + cxx-compiler: clang++ +```