diff --git a/.github/workflows/actions/linux/install/action.yml b/.github/workflows/actions/linux/install/action.yml new file mode 100644 index 0000000000..0ed637a850 --- /dev/null +++ b/.github/workflows/actions/linux/install/action.yml @@ -0,0 +1,75 @@ +# *************************************************************************** +# * 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: install +description: "Linux: install application" + +inputs: + builddir: + description: "Directory where build is stored" + 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 install" + required: false + +runs: + using: "composite" + steps: + - name: Install + id: install + shell: bash + run: | + sudo cmake --install ${{ inputs.builddir }} ${{ inputs.extraParameters }} >> ${{ inputs.logFile }} 2>> ${{ inputs.errorFile }} + - name: Write report + shell: bash + if: always() + run: | + if [ ${{ steps.install.outcome }} == 'success' ] + then + echo "
:heavy_check_mark: CMake install succeeded" >> ${{ inputs.reportFile }} + else + echo "
:fire: CMake install failed" >> ${{ inputs.reportFile }} + fi + echo "" >> ${{ inputs.reportFile }} + echo "Install Error Log (stderr output):" >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + cat ${{ inputs.errorFile }} >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + echo "Install Error Log (stdout output trimmed to the last 100 Lines):" >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + tail -n 100 ${{ inputs.logFile }} >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + echo "
">> ${{ inputs.reportFile }} + echo "" >> ${{ inputs.reportFile }} + # Print the Log to the console + cat ${{ inputs.errorFile }} + echo "::group::Install Log" + cat ${{ inputs.logFile }} + echo "::endgroup::" diff --git a/.github/workflows/sub_buildUbuntu2004.yml b/.github/workflows/sub_buildUbuntu2004.yml index 58e5ad3ac6..3a28aeef03 100644 --- a/.github/workflows/sub_buildUbuntu2004.yml +++ b/.github/workflows/sub_buildUbuntu2004.yml @@ -199,35 +199,12 @@ jobs: logFile: ${{ env.logdir }}TestGUIBuild.log reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: CMake Install - run: | - set +e - sudo cmake --install ${{ env.builddir }} >> ${{ env.logdir }}Install.log 2>> ${{ env.logdir }}InstallErrors.log - exitCode=$? - # Write the install report - if [ $exitCode -eq 0 ] - then - echo "
:heavy_check_mark: CMake install succeeded" >> ${{env.reportdir}}${{ env.reportfilename }} - else - echo "
:fire: CMake install failed" >> ${{env.reportdir}}${{ env.reportfilename }} - fi - echo "" >> ${{env.reportdir}}${{ env.reportfilename }} - echo "Install Error Log (stderr output):" >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - cat ${{ env.logdir }}InstallErrors.log >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - echo "Install Error Log (stdout output trimmed to the last 100 Lines):" >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - tail -n 100 ${{ env.logdir }}Install.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 }}InstallErrors.log - echo "::group::Install Log" - cat ${{ env.logdir }}Install.log - echo "::endgroup::" - # Exit the step with the exit code of the install - exit $exitCode + uses: ./.github/workflows/actions/linux/install + with: + builddir: ${{ env.builddir }} + logFile: ${{ env.logdir }}Install.log + errorFile: ${{ env.logdir }}InstallErrors.log + reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: FreeCAD CLI tests on install uses: ./.github/workflows/actions/runTests with: diff --git a/.github/workflows/sub_buildUbuntu2204.yml b/.github/workflows/sub_buildUbuntu2204.yml index 6655f63e64..3d9cfd3d76 100644 --- a/.github/workflows/sub_buildUbuntu2204.yml +++ b/.github/workflows/sub_buildUbuntu2204.yml @@ -208,35 +208,12 @@ jobs: logFile: ${{ env.logdir }}TestGUIBuild.log reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: CMake Install - run: | - set +e - sudo cmake --install ${{ env.builddir }} >> ${{ env.logdir }}Install.log 2>> ${{ env.logdir }}InstallErrors.log - exitCode=$? - # Write the install report - if [ $exitCode -eq 0 ] - then - echo "
:heavy_check_mark: CMake install succeeded" >> ${{env.reportdir}}${{ env.reportfilename }} - else - echo "
:fire: CMake install failed" >> ${{env.reportdir}}${{ env.reportfilename }} - fi - echo "" >> ${{env.reportdir}}${{ env.reportfilename }} - echo "Install Error Log (stderr output):" >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - cat ${{ env.logdir }}InstallErrors.log >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - echo "Install Error Log (stdout output trimmed to the last 100 Lines):" >> ${{env.reportdir}}${{ env.reportfilename }} - echo '```' >> ${{env.reportdir}}${{ env.reportfilename }} - tail -n 100 ${{ env.logdir }}Install.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 }}InstallErrors.log - echo "::group::Install Log" - cat ${{ env.logdir }}Install.log - echo "::endgroup::" - # Exit the step with the exit code of the install - exit $exitCode + uses: ./.github/workflows/actions/linux/install + with: + builddir: ${{ env.builddir }} + logFile: ${{ env.logdir }}Install.log + errorFile: ${{ env.logdir }}InstallErrors.log + reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: FreeCAD CLI tests on install uses: ./.github/workflows/actions/runTests with: