mirror of
https://github.com/threeal/cmake-action.git
synced 2025-04-21 11:01:20 +00:00
feat: add shell
action input
This commit is contained in:
parent
93a6d71ae6
commit
0325477980
13
.github/workflows/test.yml
vendored
13
.github/workflows/test.yml
vendored
@ -132,3 +132,16 @@ jobs:
|
||||
build-args: --target test_c --target test_cpp
|
||||
run-test: true
|
||||
test-args: -R test
|
||||
|
||||
specified-shell:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v3.5.3
|
||||
|
||||
- name: Use the action with specified shell
|
||||
uses: ./
|
||||
with:
|
||||
shell: bash
|
||||
source-dir: test
|
||||
run-build: true
|
||||
|
16
action.yml
16
action.yml
@ -5,6 +5,9 @@ branding:
|
||||
color: gray-dark
|
||||
icon: terminal
|
||||
inputs:
|
||||
shell:
|
||||
description: The shell to be used to run the commands
|
||||
required: false
|
||||
source-dir:
|
||||
description: The source directory of the CMake project
|
||||
required: false
|
||||
@ -57,6 +60,13 @@ runs:
|
||||
id: process-inputs
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -n '${{ inputs.shell }}' ]; then
|
||||
SHELL='${{ inputs.shell }}'
|
||||
else
|
||||
SHELL='${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}'
|
||||
fi
|
||||
echo "shell=$SHELL" >> $GITHUB_OUTPUT
|
||||
|
||||
SOURCE_DIR="."
|
||||
if [ -n '${{ inputs.source-dir }}' ]; then
|
||||
SOURCE_DIR="${{ inputs.source-dir }}"
|
||||
@ -121,15 +131,15 @@ runs:
|
||||
esac
|
||||
|
||||
- name: Configure the CMake project
|
||||
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
|
||||
shell: ${{ steps.process-inputs.outputs.shell }}
|
||||
run: cmake ${{ steps.process-inputs.outputs.cmake-args }}
|
||||
|
||||
- name: Build targets
|
||||
if: inputs.run-build != 'false' || inputs.run-test != 'false'
|
||||
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
|
||||
shell: ${{ steps.process-inputs.outputs.shell }}
|
||||
run: cmake ${{ steps.process-inputs.outputs.cmake-build-args }}
|
||||
|
||||
- name: Run tests
|
||||
if: inputs.run-test != 'false'
|
||||
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
|
||||
shell: ${{ steps.process-inputs.outputs.shell }}
|
||||
run: ctest ${{ steps.process-inputs.outputs.cmake-test-args }}
|
||||
|
Loading…
Reference in New Issue
Block a user