diff --git a/.github/workflows/actions/linux/configure/action.yml b/.github/workflows/actions/linux/configure/action.yml new file mode 100644 index 0000000000..7fba0b5cc7 --- /dev/null +++ b/.github/workflows/actions/linux/configure/action.yml @@ -0,0 +1,79 @@ +# *************************************************************************** +# * 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: configure +description: "Linux: configure CMake" + +inputs: + sourcedir: + description: "Directory where sources are stored" + required: false + default: ./ + builddir: + description: "Directory where build will happen" + required: true + logFile: + description: "Path for log file" + required: true + errorFile: + description: "Path to error file" + required: true + reportFile: + description: "Path for report file" + required: true + extraParameters: + description: "Extra parameters to CMake configure" + required: false + +runs: + using: "composite" + steps: + - name: Configure CMake + id: configure + shell: bash + run: | + cmake -S ${{ inputs.sourcedir }} -B ${{ inputs.builddir }} -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE ${{inputs.extraParameters }} > ${{ inputs.logFile }} 2> ${{ inputs.errorFile }} + - name: Write report + shell: bash + if: always() + run: | + if [ ${{ steps.configure.outcome }} == 'success' ] + then + echo "
:heavy_check_mark: CMake configure succeeded" >> ${{ inputs.reportFile }} + else + echo "
:fire: CMake configure failed" >> ${{ inputs.reportFile }} + fi + echo "" >> ${{ inputs.reportFile }} + echo "Configure Error Log (stderr output):" >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + cat ${{ inputs.errorFile }} >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + echo "Configure Log (stdout output):" >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + tail -n 60 ${{ inputs.logFile }} >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + echo "
">> ${{ inputs.reportFile }} + echo "" >> ${{ inputs.reportFile }} + # Print the Log to the console + cat ${{ inputs.errorFile }} + echo "::group::Configure Log" + cat ${{ inputs.logFile }} + echo "::endgroup::" diff --git a/.github/workflows/sub_buildUbuntu2004.yml b/.github/workflows/sub_buildUbuntu2004.yml index 140e95ae84..ce274c47a0 100644 --- a/.github/workflows/sub_buildUbuntu2004.yml +++ b/.github/workflows/sub_buildUbuntu2004.yml @@ -166,37 +166,12 @@ jobs: ccache -z ccache -p - name: CMake Configure - run: | - set +e - cmake \ - -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \ - -B ${{ env.builddir }} > ${{ env.logdir }}Cmake.log 2> ${{ env.logdir }}CmakeErrors.log - exitCode=$? - # Write the configure report - if [ $exitCode -eq 0 ] - then - echo "
:heavy_check_mark: CMake configure succeeded" >> ${{env.reportdir}}${{ env.reportfilename }} - else - echo "
:fire: CMake configure failed" >> ${{env.reportdir}}${{ env.reportfilename }} - fi - echo "" >> ${{env.reportdir}}${{ env.reportfilename }} - echo "Configure Error Log (stderr output):" >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - cat ${{ env.logdir }}CmakeErrors.log >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - echo "Configure Log (stdout output):" >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - tail -n 60 ${{ env.logdir }}Cmake.log >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - echo "
">> ${{env.reportdir}}${{ env.reportfilename }} - echo "" >> ${{env.reportdir}}${{ env.reportfilename }} - # Print the Log to the console - cat ${{ env.logdir }}CmakeErrors.log - echo "::group::Configure Log" - cat ${{ env.logdir }}Cmake.log - echo "::endgroup::" - # Exit the step with the exit code of the configure - exit $exitCode + uses: ./.github/workflows/actions/linux/configure + with: + builddir: ${{ env.builddir }} + logFile: ${{ env.logdir }}Cmake.log + errorFile: ${{ env.logdir }}CmakeErrors.log + reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: CMake Build run: | set +e diff --git a/.github/workflows/sub_buildUbuntu2204.yml b/.github/workflows/sub_buildUbuntu2204.yml index 5b15e0642e..6a1917af3e 100644 --- a/.github/workflows/sub_buildUbuntu2204.yml +++ b/.github/workflows/sub_buildUbuntu2204.yml @@ -175,37 +175,12 @@ jobs: ccache -z ccache -p - name: CMake Configure - run: | - set +e - cmake \ - -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \ - -B ${{ env.builddir }} > ${{ env.logdir }}Cmake.log 2> ${{ env.logdir }}CmakeErrors.log - exitCode=$? - # Write the configure report - if [ $exitCode -eq 0 ] - then - echo "
:heavy_check_mark: CMake configure succeeded" >> ${{env.reportdir}}${{ env.reportfilename }} - else - echo "
:fire: CMake configure failed" >> ${{env.reportdir}}${{ env.reportfilename }} - fi - echo "" >> ${{env.reportdir}}${{ env.reportfilename }} - echo "Configure Error Log (stderr output):" >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - cat ${{ env.logdir }}CmakeErrors.log >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - echo "Configure Log (stdout output):" >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - tail -n 60 ${{ env.logdir }}Cmake.log >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - echo "
">> ${{env.reportdir}}${{ env.reportfilename }} - echo "" >> ${{env.reportdir}}${{ env.reportfilename }} - # Print the Log to the console - cat ${{ env.logdir }}CmakeErrors.log - echo "::group::Configure Log" - cat ${{ env.logdir }}Cmake.log - echo "::endgroup::" - # Exit the step with the exit code of the configure - exit $exitCode + uses: ./.github/workflows/actions/linux/configure + with: + builddir: ${{ env.builddir }} + logFile: ${{ env.logdir }}Cmake.log + errorFile: ${{ env.logdir }}CmakeErrors.log + reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: CMake Build run: | set +e