diff --git a/action-ceedling-unit-test/LICENSE b/action-ceedling-unit-test/LICENSE new file mode 100644 index 0000000..744610b --- /dev/null +++ b/action-ceedling-unit-test/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Simon Scurrell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/action-ceedling-unit-test/README.md b/action-ceedling-unit-test/README.md new file mode 100644 index 0000000..9e7ff52 --- /dev/null +++ b/action-ceedling-unit-test/README.md @@ -0,0 +1,30 @@ +## action-ceedling-unit-test +Github action for running unit tests using Ceedling + +## Inputs + +### `unit-test-path` + +**Required** Absolute path to the Ceedling project yaml file. + +## Example Usage +```yaml +name: Unit Tests +on: + push: + branches: + - 'master' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Run Unit Tests + uses: sjscymru/action-ceedling-unit-test@v1.0 + with: + unit-test-path: '${{ github.workspace }}/unit_tests' +``` diff --git a/action-ceedling-unit-test/action.yml b/action-ceedling-unit-test/action.yml new file mode 100644 index 0000000..92c8b54 --- /dev/null +++ b/action-ceedling-unit-test/action.yml @@ -0,0 +1,17 @@ +name: 'Run Ceedling Unit Tests' +description: 'Run the unit test using Ceedling framework' +inputs: + unit-test-path: # path to Ceedling project.yml file + description: 'Path to Ceedling project.yml file' + required: true + +runs: + using: 'composite' + steps: + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7.1' + - run: chmod +x ${{ github.action_path }}/entrypoint.sh + shell: bash + - run: ${{ github.action_path }}/entrypoint.sh ${{ inputs.unit-test-path }} + shell: bash diff --git a/action-ceedling-unit-test/entrypoint.sh b/action-ceedling-unit-test/entrypoint.sh new file mode 100644 index 0000000..f0d0fe7 --- /dev/null +++ b/action-ceedling-unit-test/entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Install dependencies +sudo apt-get update +sudo apt-get install -y coreutils gcc gcc-multilib gcovr valgrind libc-dev + +# Install ceedling +sudo gem install --force ceedling:0.31.1 + +# Navigate to unit tests +echo 'Attempting to run unit tests at location:' $1 +cd $1 + +# Run unit tests +# ceedling test:all +ceedling gcov:all utils:gcov