CI: global refactoring of build/test CI
This commit is contained in:
42
.github/workflows/actions/linux/generateCacheKey/action.yml
vendored
Normal file
42
.github/workflows/actions/linux/generateCacheKey/action.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2023 0penBrain *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
name: generateCacheKey
|
||||
description: "Linux: generates a cache key taking into account distro and compiler"
|
||||
|
||||
inputs:
|
||||
compiler:
|
||||
description: "Binary name/path of compiler to be used"
|
||||
required: true
|
||||
outputs:
|
||||
cacheKey:
|
||||
description: "Cache key with distro and compiler version"
|
||||
value: ${{ steps.generateCacheKey.outputs.cacheKey }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- id: generateCacheKey
|
||||
shell: bash
|
||||
run: |
|
||||
cacheKey=$(lsb_release -ds | tr -d ' ')-$( basename ${{ inputs.compiler }})$(${{ inputs.compiler }} -dumpfullversion -dumpversion)
|
||||
echo "Generated cache key : $cacheKey"
|
||||
echo "cacheKey=$cacheKey" >> $GITHUB_OUTPUT
|
||||
64
.github/workflows/actions/runTests/action.yml
vendored
Normal file
64
.github/workflows/actions/runTests/action.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2023 0penBrain *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
name: generateCacheKey
|
||||
description: "Linux: run unit tests, generate log and report"
|
||||
|
||||
inputs:
|
||||
testDescription:
|
||||
description: "Test description text, will be used on report"
|
||||
required: true
|
||||
testCommand:
|
||||
description: "Test command to be ran"
|
||||
required: true
|
||||
logFile:
|
||||
description: "Path for log file"
|
||||
required: true
|
||||
reportFile:
|
||||
description: "Path for report file"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Run tests
|
||||
id: runTests
|
||||
shell: bash
|
||||
run: |
|
||||
stdbuf -oL -eL ${{ inputs.testCommand }} |& sed -E '/[[:blank:]]*\([[:digit:]]{1,3} %\)[[:blank:]]*/d' | tee ${{ inputs.logFile }}
|
||||
- name: Write report
|
||||
shell: bash
|
||||
if: always()
|
||||
run: |
|
||||
if [ ${{ steps.runTests.outcome }} == 'success' ]
|
||||
then
|
||||
echo "<details><summary>:heavy_check_mark: ${{ inputs.testDescription }} succeeded</summary>" >> ${{ inputs.reportFile}}
|
||||
else
|
||||
echo "<details><summary>:fire: ${{ inputs.testDescription }} failed</summary>" >> ${{ inputs.reportFile}}
|
||||
fi
|
||||
echo "" >> ${{ inputs.reportFile}}
|
||||
echo "Below is presented only the 20 last lines of the test log" >> ${{ inputs.reportFile}}
|
||||
echo "" >> ${{ inputs.reportFile}}
|
||||
echo '```' >> ${{ inputs.reportFile}}
|
||||
cat ${{ inputs.logFile }} | tail -n 20 >> ${{ inputs.reportFile}}
|
||||
echo '```' >> ${{ inputs.reportFile}}
|
||||
echo "</details>">> ${{ inputs.reportFile}}
|
||||
echo "" >> ${{ inputs.reportFile}}
|
||||
Reference in New Issue
Block a user