Configure and build CMake projects on GitHub Actions
Go to file
Alfi Maulana dd78821b58
Merge pull request #24 from threeal/reword-workflow-desc
Reword Steps Description in Test Workflow
2023-01-14 17:03:22 +07:00
.github reword steps description in test.yml workflow 2023-01-14 17:00:53 +07:00
test merge file and configuration for test_c and test_cpp 2023-01-12 14:32:06 +07:00
.gitignore add a test project for testing this action 2023-01-06 15:23:09 +07:00
action.yml fix wording in the description 2023-01-13 22:25:13 +07:00
LICENSE initialize project with readme and license 2023-01-06 12:39:38 +07:00
README.md add license section in README.md 2023-01-14 15:55:48 +07:00

CMake Action

latest version license test status

Configure and build a CMake project on GitHub Actions.

Usage

For more information, see 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.
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.
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

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

- name: Configure and build this project
  uses: threeal/cmake-action@latest
  with:
    source-dir: submodules
    build-dir: submodules/build

Build Custom Targets

- 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

- name: Configure and build this project
  uses: threeal/cmake-action@latest
  with:
    generator: Ninja
    c-compiler: clang
    cxx-compiler: clang++

License

This project is licensed under the terms of the MIT License.

Copyright © 2023 Alfi Maulana