diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml deleted file mode 100644 index 6ba288502a1..00000000000 --- a/.github/workflows/clang-format-check.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: clang-format - -on: - push: - branches: [ develop ] - pull_request: - branches: [ develop ] - -jobs: - formatting-check: - name: Formatting Check - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - path: - - 'src/EnergyPlus' - - 'tst/EnergyPlus/unit' - steps: - - uses: actions/checkout@v4 - - name: Run clang-format style check for C/C++ programs. - uses: jidicula/clang-format-action@v4.13.0 - with: - clang-format-version: '10' - check-path: ${{ matrix.path }} diff --git a/.github/workflows/code_integrity.yml b/.github/workflows/code_integrity.yml new file mode 100644 index 00000000000..66b61b5023b --- /dev/null +++ b/.github/workflows/code_integrity.yml @@ -0,0 +1,99 @@ +name: Checking Code Integrity + +on: [push, pull_request] + +jobs: + code_integrity_checks: + name: Code Integrity Checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run clang-format style check for C/C++ source code. + uses: jidicula/clang-format-action@v4.13.0 + if: always() + with: + clang-format-version: '10' + check-path: 'src/EnergyPlus' + + - name: Run clang-format style check for C/C++ unit test code. + uses: jidicula/clang-format-action@v4.13.0 + if: always() + with: + clang-format-version: '10' + check-path: 'tst/EnergyPlus/unit' + + - name: Custom Check + if: always() + run: ./scripts/dev/custom_check.sh . + + - name: Install cppcheck + if: always() + run: | + mkdir cppcheck + cd cppcheck + wget https://github.com/danmar/cppcheck/archive/2.10.tar.gz + tar xfz 2.10.tar.gz + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release ../cppcheck-2.10/ + make -j $(nproc) + sudo make install + cd .. + rm -Rf cppcheck + + - name: Cache cppcheck-build-directory + if: always() + id: cppcheckcache + uses: actions/cache@v4 + with: + path: .cppcheck-build-dir/ + key: cppcheckcache + + - name: cppcheck-build-directory not found + # If the build cache wasn't found in the cache + if: always() && steps.cppcheckcache.outputs.cache-hit != 'true' + run: mkdir .cppcheck-build-dir + + - name: cppcheck-build-directory was found + # If the build cache wasn't found in the cache + if: always() && steps.cppcheckcache.outputs.cache-hit == 'true' + run: ls .cppcheck-build-dir/ || true + + - name: Run CppCheck + id: cpp_check_run + if: always() + run: > + cppcheck --cppcheck-build-dir=.cppcheck-build-dir + -D__cppcheck__ -UEP_Count_Calls -DEP_NO_OPENGL -UGROUND_PLOT -DLINK_WITH_PYTHON -DMSVC_DEBUG -DSKYLINE_MATRIX_REMOVE_ZERO_COLUMNS -U_OPENMP -Ugeneratetestdata + -DEP_cache_GlycolSpecificHeat -DEP_cache_PsyTsatFnPb -UEP_nocache_Psychrometrics -UEP_psych_errors -UEP_psych_stats + --force + --std=c++17 + --inline-suppr + --suppress=cppcheckError + --suppress=unusedFunction:src/EnergyPlus/api/autosizing.cc + --suppress=unusedFunction:src/EnergyPlus/api/datatransfer.cc + --suppress=unusedFunction:src/EnergyPlus/api/func.cc + --suppress=unusedFunction:src/EnergyPlus/api/runtime.cc + --suppress=unusedFunction:src/EnergyPlus/api/state.cc + --suppress=unusedFunction:src/EnergyPlus/Psychrometrics.cc + --enable=all + -i EnergyPlus/DXCoils.cc + -i EnergyPlus/RefrigeratedCase.cc + -i EnergyPlus/SolarShading.cc + -j $(nproc) + --template='[{file}:{line}]:({severity}),[{id}],{message}' + --suppress="uninitvar:*" + ./src + 3>&1 1>&2 2>&3 | tee cppcheck.txt + + - name: Parse and colorize cppcheck + if: always() && steps.cpp_check_run.outcome == 'success' + run: python ./scripts/dev/colorize_cppcheck_results.py + + - name: Upload cppcheck results as artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: EnergyPlus-${{ github.sha }}-cppcheck_results.txt + path: cppcheck.txt diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml deleted file mode 100644 index ae66a455d10..00000000000 --- a/.github/workflows/cppcheck.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: CppCheck - -on: [push] - -env: - CPPCHECK_VERSION: '2.10' - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout EnergyPlus - uses: actions/checkout@v4 - - - name: Install cppcheck - shell: bash - run: | - mkdir cppcheck - cd cppcheck - wget https://github.com/danmar/cppcheck/archive/$CPPCHECK_VERSION.tar.gz - tar xfz $CPPCHECK_VERSION.tar.gz - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release ../cppcheck-$CPPCHECK_VERSION/ - make -j $(nproc) - sudo make install - cd .. - rm -Rf cppcheck - - - name: Cache cppcheck-build-directory - id: cppcheckcache - uses: actions/cache@v4 - with: - path: .cppcheck-build-dir/ - key: cppcheckcache - - - name: cppcheck-build-directory not found - # If the build cache wasn't found in the cache - if: steps.cppcheckcache.outputs.cache-hit != 'true' - run: | - mkdir .cppcheck-build-dir - - - name: cppcheck-build-directory was found - # If the build cache wasn't found in the cache - if: steps.cppcheckcache.outputs.cache-hit == 'true' - run: | - ls .cppcheck-build-dir/ || true - - - name: Run CppCheck - run: | - cppcheck --cppcheck-build-dir=.cppcheck-build-dir \ - -D__cppcheck__ -UEP_Count_Calls -DEP_NO_OPENGL -UGROUND_PLOT -DLINK_WITH_PYTHON -DMSVC_DEBUG -DSKYLINE_MATRIX_REMOVE_ZERO_COLUMNS -U_OPENMP -Ugeneratetestdata \ - -DEP_cache_GlycolSpecificHeat -DEP_cache_PsyTsatFnPb -UEP_nocache_Psychrometrics -UEP_psych_errors -UEP_psych_stats \ - --force \ - --std=c++17 \ - --inline-suppr \ - --suppress=cppcheckError \ - --suppress=unusedFunction:src/EnergyPlus/api/autosizing.cc \ - --suppress=unusedFunction:src/EnergyPlus/api/datatransfer.cc \ - --suppress=unusedFunction:src/EnergyPlus/api/func.cc \ - --suppress=unusedFunction:src/EnergyPlus/api/runtime.cc \ - --suppress=unusedFunction:src/EnergyPlus/api/state.cc \ - --suppress=unusedFunction:src/EnergyPlus/Psychrometrics.cc \ - --enable=all \ - -i EnergyPlus/DXCoils.cc \ - -i EnergyPlus/RefrigeratedCase.cc \ - -i EnergyPlus/SolarShading.cc \ - -j $(nproc) \ - --template='[{file}:{line}]:({severity}),[{id}],{message}' \ - --suppress="uninitvar:*" \ - ./src \ - 3>&1 1>&2 2>&3 | tee cppcheck.txt - - - name: Parse and colorize cppcheck - shell: bash - run: python ./scripts/dev/colorize_cppcheck_results.py - - - name: Upload cppcheck results as artifact - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: EnergyPlus-${{ github.sha }}-cppcheck_results.txt - path: cppcheck.txt diff --git a/.github/workflows/custom_check.yml b/.github/workflows/custom_check.yml deleted file mode 100644 index 5f2ba9e9457..00000000000 --- a/.github/workflows/custom_check.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Custom Check - -on: [push] - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - name: Custom Check - shell: bash - run: ./scripts/dev/custom_check.sh .