CI: factorize CMake install step in Linux builds

This commit is contained in:
0penBrain
2023-02-12 21:20:54 +01:00
parent 5d2e3af349
commit e49677b6b5
3 changed files with 87 additions and 58 deletions

View File

@@ -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 "<details><summary>:heavy_check_mark: CMake install succeeded</summary>" >> ${{ inputs.reportFile }}
else
echo "<details><summary>:fire: CMake install failed</summary>" >> ${{ 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 "</details>">> ${{ inputs.reportFile }}
echo "" >> ${{ inputs.reportFile }}
# Print the Log to the console
cat ${{ inputs.errorFile }}
echo "::group::Install Log"
cat ${{ inputs.logFile }}
echo "::endgroup::"

View File

@@ -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 "<details><summary>:heavy_check_mark: CMake install succeeded</summary>" >> ${{env.reportdir}}${{ env.reportfilename }}
else
echo "<details><summary>:fire: CMake install failed</summary>" >> ${{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 "</details>">> ${{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:

View File

@@ -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 "<details><summary>:heavy_check_mark: CMake install succeeded</summary>" >> ${{env.reportdir}}${{ env.reportfilename }}
else
echo "<details><summary>:fire: CMake install failed</summary>" >> ${{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 "</details>">> ${{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: