diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 413c98a..77e7683 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 @@ -33,4 +58,4 @@ jobs: - name: Test Project uses: ./ctest-action with: - args: ${{ matrix.os == 'windows' && '-C Debug' || '' }} + build-config: Debug diff --git a/README.md b/README.md index 6dc4691..461093e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/action.yaml b/action.yaml index cc4f5e0..5af32e3 100644 --- a/action.yaml +++ b/action.yaml @@ -5,6 +5,8 @@ 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: @@ -12,4 +14,4 @@ runs: 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 }}