Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add build-config Action Input #25

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,31 @@ jobs:
fail-fast: false
matrix:
os: [windows, ubuntu, macos]
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
with:
path: ctest-action
sparse-checkout: |
test
action.yaml
sparse-checkout-cone-mode: false

- name: Prepare Sample Project
run: mv ctest-action/test/* .

- name: Configure and Build Project
uses: threeal/cmake-action@v1.3.0
with:
run-build: true
generator: Ninja

- name: Test Project
uses: ./ctest-action

test-action-with-build-config:
name: Test Action With Build Config
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
Expand All @@ -33,4 +58,4 @@ jobs:
- name: Test Project
uses: ./ctest-action
with:
args: ${{ matrix.os == 'windows' && '-C Debug' || '' }}
build-config: Debug
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For more information, refer to [action.yml](./action.yml) and the [GitHub Action

| Name | Value Type | Description |
| --- | --- | --- |
| `build-config` | string | Choose the configuration to test. |
| `args` | Multiple strings | Additional arguments to pass during the CTest run. |

> **Note**: Multiple strings mean that the input can be specified with more than one value. Separate each value with a space or a new line.
Expand Down
4 changes: 3 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ branding:
icon: terminal
color: gray-dark
inputs:
build-config:
description: Choose the configuration to test
args:
description: Additional arguments to pass during the CTest run
runs:
using: composite
steps:
- name: Test the CMake project
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: ctest --test-dir build --output-on-failure --no-tests=error ${{ inputs.args }}
run: ctest --test-dir build --output-on-failure --no-tests=error ${{ inputs.build-config && '-C' }} ${{ inputs.build-config }} ${{ inputs.args }}