From 77d50db1bf83ab62f00bfc068c1be45629037064 Mon Sep 17 00:00:00 2001
From: 0penBrain <48731257+0penBrain@users.noreply.github.com>
Date: Fri, 24 Feb 2023 19:27:19 +0100
Subject: [PATCH] CI: Install dependencies + run Cmake before Cpp lints (needed
for Clang tools)
+ Reorganize tests in logical order
---
.github/workflows/sub_lint.yml | 215 ++++++++++++++++++++++-----------
1 file changed, 145 insertions(+), 70 deletions(-)
diff --git a/.github/workflows/sub_lint.yml b/.github/workflows/sub_lint.yml
index 09efdd4df3..83738ba26b 100644
--- a/.github/workflows/sub_lint.yml
+++ b/.github/workflows/sub_lint.yml
@@ -204,6 +204,7 @@ jobs:
mkdir -p ${{ env.fixesdir }}
mkdir -p ${{ env.reportdir }}
echo "reportFile=${{ env.reportfilename }}" >> $GITHUB_OUTPUT
+ # Run generic lints
- name: Check for non Unix line ending
if: inputs.checkLineendings && always()
continue-on-error: ${{ inputs.lineendingsFailSilent }}
@@ -304,76 +305,7 @@ jobs:
echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
# Exit the step with appropriate code
[ $tabErrors -eq 0 ]
- - name: Check old Qt string-based connections (https://wiki.qt.io/New_Signal_Slot_Syntax)
- if: inputs.checkQtConnections && inputs.changedCppFiles != '' && always()
- continue-on-error: ${{ inputs.qtConnectionsFailSilent }}
- run: |
- qtconnectionSyntax=0
- exclude="*[.md,.log,.ts,.git]"
- # Check all files for QT string-based connections
- for file in ${{ inputs.changedFiles }} #TODO does this makes sense in Python files ?
- do
- grep -nIHE --exclude="$exclude" $' SIGNAL| SLOT' $file | sed -e "s/$/ <--Consider using Functor-Based Connections/" >> ${{ env.logdir }}qtConnections.log || true #TODO seems to trigger false positives
- done
- # Write the Log to the console with the Problem Matchers
- if [ -f ${{ env.logdir }}qtConnections.log ]; then
- echo "::add-matcher::${{ runner.workspace }}/FreeCAD/.github/problemMatcher/grepMatcherWarning.json"
- cat ${{ env.logdir }}qtConnections.log
- echo "::remove-matcher owner=grepMatcher-warning::"
- qtconnectionSyntax=$(wc -l < ${{ env.logdir }}qtConnections.log)
- fi
- echo "Found $qtconnectionSyntax QT string-based connections"
- # Write the report
- if [ $qtconnectionSyntax -gt 0 ]; then
- echo ":information_source: Found $qtconnectionSyntax QT string-based connections :arrow_right: consider using QT functor-Based Connections
" >> ${{env.reportdir}}${{ env.reportfilename }}
- echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
- # documentation link
- echo "For more information see: https://wiki.qt.io/New_Signal_Slot_Syntax or https://github.com/FreeCAD/FreeCAD/issues/6166" >> ${{env.reportdir}}${{ env.reportfilename }}
- echo '```' >> ${{env.reportdir}}${{ env.reportfilename }}
- cat ${{ env.logdir }}qtConnections.log >> ${{env.reportdir}}${{ env.reportfilename }}
- echo '```' >> ${{env.reportdir}}${{ env.reportfilename }}
- echo " " >> ${{env.reportdir}}${{ env.reportfilename }}
- else
- echo ":heavy_check_mark: No string-based connections found " >> ${{env.reportdir}}${{ env.reportfilename }}
- fi
- echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
- # Exit the step with appropriate code
- [ $qtconnectionSyntax -eq 0 ]
- - name: Cpplint
- if: inputs.checkCpplint && inputs.changedCppFiles != '' && always()
- continue-on-error: ${{ inputs.cpplintFailSilent }}
- run: |
- cpplintErrors=0
- pip install cpplint
- # Run cpplint
- for file in ${{ inputs.changedCppFiles }}
- do
- cpplint --filter=${{ inputs.cpplintFilters }} --linelength=${{ inputs.cpplintLineLength }} $file &>> ${{ env.logdir }}cpplint.log || true
- done
- # If cpplint has run successfully, write the Log to the console with the Problem Matchers
- if [ ${{ env.logdir }}cpplint.log ]
- then
- echo "::add-matcher::${{ runner.workspace }}/FreeCAD/.github/problemMatcher/cpplint.json"
- cat ${{ env.logdir }}cpplint.log
- echo "::remove-matcher owner=cpplint::"
- cpplintErrors=$(grep -nIHE "\[[0-9]\]$" ${{ env.logdir }}cpplint.log | wc -l ) || true
- fi
- echo "Found $cpplintErrors cpplint errors"
- # Write the report
- if [ $cpplintErrors -gt 0 ]
- then
- echo ":warning: CppLint found $cpplintErrors errors / warnings
" >> ${{env.reportdir}}${{ env.reportfilename }}
- else
- echo ":heavy_check_mark: No cpplint errors found
" >> ${{env.reportdir}}${{ env.reportfilename }}
- fi
- echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
- echo '```' >> ${{env.reportdir}}${{ env.reportfilename }}
- cat ${{ env.logdir }}cpplint.log >> ${{env.reportdir}}${{ env.reportfilename }}
- echo '```' >> ${{env.reportdir}}${{ env.reportfilename }}
- echo " " >> ${{env.reportdir}}${{ env.reportfilename }}
- echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
- # Exit the step with appropriate code
- [ $cpplintErrors -eq 0 ]
+ # Run Python lints
- name: Pylint
if: inputs.checkPylint && inputs.changedPythonFiles != '' && always()
continue-on-error: ${{ inputs.pylintFailSilent }}
@@ -470,6 +402,149 @@ jobs:
echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
# Exit the step with appropriate code
[ $exitCode -eq 0 ]
+ # Run C++ lints
+ - name: Install FreeCAD dependencies
+ if: inputs.changedCppFiles != '' && always()
+ run: |
+ sudo apt-get update -qq
+ sudo apt-get install -y --no-install-recommends \
+ doxygen \
+ graphviz \
+ imagemagick \
+ libboost-date-time-dev \
+ libboost-dev \
+ libboost-filesystem-dev \
+ libboost-graph-dev \
+ libboost-iostreams-dev \
+ libboost-program-options-dev \
+ libboost-python-dev \
+ libboost-regex-dev \
+ libboost-serialization-dev \
+ libboost-thread-dev \
+ libcoin-dev \
+ libeigen3-dev \
+ libgts-bin \
+ libgts-dev \
+ libkdtree++-dev \
+ libmedc-dev \
+ libocct-data-exchange-dev \
+ libocct-ocaf-dev \
+ libocct-visualization-dev \
+ libopencv-dev \
+ libproj-dev \
+ libpyside2-dev \
+ libqt5opengl5-dev \
+ libqt5svg5-dev \
+ libqt5x11extras5-dev \
+ libqt5xmlpatterns5-dev \
+ libshiboken2-dev \
+ libspnav-dev \
+ libvtk7-dev \
+ libx11-dev \
+ libxerces-c-dev \
+ libzipios++-dev \
+ netgen \
+ netgen-headers \
+ occt-draw \
+ pyqt5-dev-tools \
+ pyside2-tools \
+ python3-dev \
+ python3-git \
+ python3-markdown \
+ python3-matplotlib \
+ python3-packaging \
+ python3-pivy \
+ python3-ply \
+ python3-pyside2.qtcore \
+ python3-pyside2.qtgui \
+ python3-pyside2.qtnetwork \
+ python3-pyside2.qtsvg \
+ python3-pyside2.qtwebengine \
+ python3-pyside2.qtwebenginecore \
+ python3-pyside2.qtwebenginewidgets \
+ python3-pyside2.qtwebchannel \
+ python3-pyside2.qtwidgets \
+ qtbase5-dev \
+ qttools5-dev \
+ qtwebengine5-dev \
+ shiboken2 \
+ swig \
+ ccache \
+ xvfb
+ - name: Run CMake # This is needed for Clang tools to work correctly
+ if: inputs.changedCppFiles != '' && always()
+ run: |
+ mkdir build && cmake -S ./ -B ./build/ -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE
+ - name: Check old Qt string-based connections (https://wiki.qt.io/New_Signal_Slot_Syntax)
+ if: inputs.checkQtConnections && inputs.changedCppFiles != '' && always()
+ continue-on-error: ${{ inputs.qtConnectionsFailSilent }}
+ run: |
+ qtconnectionSyntax=0
+ exclude="*[.md,.log,.ts,.git]"
+ # Check all files for QT string-based connections
+ for file in ${{ inputs.changedFiles }} #TODO does this makes sense in Python files ?
+ do
+ grep -nIHE --exclude="$exclude" $' SIGNAL| SLOT' $file | sed -e "s/$/ <--Consider using Functor-Based Connections/" >> ${{ env.logdir }}qtConnections.log || true #TODO seems to trigger false positives
+ done
+ # Write the Log to the console with the Problem Matchers
+ if [ -f ${{ env.logdir }}qtConnections.log ]; then
+ echo "::add-matcher::${{ runner.workspace }}/FreeCAD/.github/problemMatcher/grepMatcherWarning.json"
+ cat ${{ env.logdir }}qtConnections.log
+ echo "::remove-matcher owner=grepMatcher-warning::"
+ qtconnectionSyntax=$(wc -l < ${{ env.logdir }}qtConnections.log)
+ fi
+ echo "Found $qtconnectionSyntax QT string-based connections"
+ # Write the report
+ if [ $qtconnectionSyntax -gt 0 ]; then
+ echo ":information_source: Found $qtconnectionSyntax QT string-based connections :arrow_right: consider using QT functor-Based Connections
" >> ${{env.reportdir}}${{ env.reportfilename }}
+ echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
+ # documentation link
+ echo "For more information see: https://wiki.qt.io/New_Signal_Slot_Syntax or https://github.com/FreeCAD/FreeCAD/issues/6166" >> ${{env.reportdir}}${{ env.reportfilename }}
+ echo '```' >> ${{env.reportdir}}${{ env.reportfilename }}
+ cat ${{ env.logdir }}qtConnections.log >> ${{env.reportdir}}${{ env.reportfilename }}
+ echo '```' >> ${{env.reportdir}}${{ env.reportfilename }}
+ echo " " >> ${{env.reportdir}}${{ env.reportfilename }}
+ else
+ echo ":heavy_check_mark: No string-based connections found " >> ${{env.reportdir}}${{ env.reportfilename }}
+ fi
+ echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
+ # Exit the step with appropriate code
+ [ $qtconnectionSyntax -eq 0 ]
+ - name: Cpplint
+ if: inputs.checkCpplint && inputs.changedCppFiles != '' && always()
+ continue-on-error: ${{ inputs.cpplintFailSilent }}
+ run: |
+ cpplintErrors=0
+ pip install cpplint
+ # Run cpplint
+ for file in ${{ inputs.changedCppFiles }}
+ do
+ cpplint --filter=${{ inputs.cpplintFilters }} --linelength=${{ inputs.cpplintLineLength }} $file &>> ${{ env.logdir }}cpplint.log || true
+ done
+ # If cpplint has run successfully, write the Log to the console with the Problem Matchers
+ if [ ${{ env.logdir }}cpplint.log ]
+ then
+ echo "::add-matcher::${{ runner.workspace }}/FreeCAD/.github/problemMatcher/cpplint.json"
+ cat ${{ env.logdir }}cpplint.log
+ echo "::remove-matcher owner=cpplint::"
+ cpplintErrors=$(grep -nIHE "\[[0-9]\]$" ${{ env.logdir }}cpplint.log | wc -l ) || true
+ fi
+ echo "Found $cpplintErrors cpplint errors"
+ # Write the report
+ if [ $cpplintErrors -gt 0 ]
+ then
+ echo ":warning: CppLint found $cpplintErrors errors / warnings
" >> ${{env.reportdir}}${{ env.reportfilename }}
+ else
+ echo ":heavy_check_mark: No cpplint errors found
" >> ${{env.reportdir}}${{ env.reportfilename }}
+ fi
+ echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
+ echo '```' >> ${{env.reportdir}}${{ env.reportfilename }}
+ cat ${{ env.logdir }}cpplint.log >> ${{env.reportdir}}${{ env.reportfilename }}
+ echo '```' >> ${{env.reportdir}}${{ env.reportfilename }}
+ echo " " >> ${{env.reportdir}}${{ env.reportfilename }}
+ echo "" >> ${{env.reportdir}}${{ env.reportfilename }}
+ # Exit the step with appropriate code
+ [ $cpplintErrors -eq 0 ]
- name: Clang-format
if: inputs.checkClangFormat && inputs.changedCppFiles != '' && always()
continue-on-error: ${{ inputs.clangFormatFailSilent }}