From 9586d63efabc09c61245c554dac5bbd66d420fe1 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Tue, 4 Jun 2024 11:52:16 +0100 Subject: [PATCH 01/26] Trying to add code coverage reporting to CI --- .github/workflows/main.yml | 4 ++++ docker/platypus/Dockerfile | 7 +++++-- upload-coverage.sh | 11 +++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 upload-coverage.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2792d3b3..07a29e32 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,3 +28,7 @@ jobs: --build-arg build_git_sha=${PRCOMMITSHA:-$GITHUB_SHA} \ --build-arg build_git_repo=${PRREPOSITORY:-$GITHUB_REPOSITORY} \ docker/platypus + - name: UploadCoverage + run: | + ci_env=`bsah <(curl -s https://codecov.io/env)` + docker run $ci_env -e CI=true ci-platypus-ubuntu:latest bash opt/platypus/upload-coverage.sh diff --git a/docker/platypus/Dockerfile b/docker/platypus/Dockerfile index 86ebd142..327c7455 100644 --- a/docker/platypus/Dockerfile +++ b/docker/platypus/Dockerfile @@ -12,6 +12,9 @@ ARG build_git_repo=aurora-multiphysics/platypus # By default we install everything under /opt ARG WORKDIR=opt +# By default, build without code coverage flags +ARG coverage=false + # Get Platypus with Hephaestus RUN cd /$WORKDIR && \ git clone https://github.com/$build_git_repo && \ @@ -32,8 +35,8 @@ RUN cd /$WORKDIR/platypus/contrib/hephaestus/build && \ # Build Platypus RUN cd /$WORKDIR/platypus && \ - make -j$compile_cores + make -j$compile_cores coverage=$coverage # Test Platypus RUN cd /$WORKDIR/platypus && \ - make test + make test linkcoverage=$coverage diff --git a/upload-coverage.sh b/upload-coverage.sh new file mode 100644 index 00000000..3cee8b60 --- /dev/null +++ b/upload-coverage.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import +curl -Os https://cli.codecov.io/latest/linux/codecov +curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM +curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig +gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM + +shasum -a 256 -c codecov.SHA256SUM +sudo chmod +x codecov +./codecov --verbose upload-process --fail-on-error From f4c9da6c2cbd79ae910462dd70869194bbe9ef19 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Tue, 4 Jun 2024 13:22:20 +0100 Subject: [PATCH 02/26] Fixed typo in CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 07a29e32..0aaa5fbc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,5 +30,5 @@ jobs: docker/platypus - name: UploadCoverage run: | - ci_env=`bsah <(curl -s https://codecov.io/env)` + ci_env=`bash <(curl -s https://codecov.io/env)` docker run $ci_env -e CI=true ci-platypus-ubuntu:latest bash opt/platypus/upload-coverage.sh From 3c12cef26862c9d79f09965a3a2e202932e3b5e8 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Tue, 4 Jun 2024 13:52:59 +0100 Subject: [PATCH 03/26] Fix coverage upload script --- upload-coverage.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/upload-coverage.sh b/upload-coverage.sh index 3cee8b60..ffbc082e 100644 --- a/upload-coverage.sh +++ b/upload-coverage.sh @@ -7,5 +7,6 @@ curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM shasum -a 256 -c codecov.SHA256SUM -sudo chmod +x codecov +chmod +x codecov + ./codecov --verbose upload-process --fail-on-error From bd1a37274094c7163001ef8c452a556b39c21673 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Tue, 4 Jun 2024 14:35:46 +0100 Subject: [PATCH 04/26] Trying to fix coverage upload --- upload-coverage.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/upload-coverage.sh b/upload-coverage.sh index ffbc082e..6e4b09b8 100644 --- a/upload-coverage.sh +++ b/upload-coverage.sh @@ -9,4 +9,5 @@ gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM shasum -a 256 -c codecov.SHA256SUM chmod +x codecov -./codecov --verbose upload-process --fail-on-error +cd /opt/platypus +./codecov --verbose From ecda8723c556155c073edb3520327d861c244085 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Tue, 4 Jun 2024 14:55:30 +0100 Subject: [PATCH 05/26] More attempts at fixing --- upload-coverage.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/upload-coverage.sh b/upload-coverage.sh index 6e4b09b8..23e4b2ce 100644 --- a/upload-coverage.sh +++ b/upload-coverage.sh @@ -1,5 +1,7 @@ #!/bin/bash +cd /opt/platypus + curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import curl -Os https://cli.codecov.io/latest/linux/codecov curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM @@ -9,5 +11,4 @@ gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM shasum -a 256 -c codecov.SHA256SUM chmod +x codecov -cd /opt/platypus ./codecov --verbose From 317946dbc4fd2a0529706fe18b4b41621726169f Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Tue, 4 Jun 2024 15:25:32 +0100 Subject: [PATCH 06/26] Trying to use old approach to upload codecov --- upload-coverage.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/upload-coverage.sh b/upload-coverage.sh index 23e4b2ce..664c8915 100644 --- a/upload-coverage.sh +++ b/upload-coverage.sh @@ -2,13 +2,4 @@ cd /opt/platypus -curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import -curl -Os https://cli.codecov.io/latest/linux/codecov -curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM -curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig -gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM - -shasum -a 256 -c codecov.SHA256SUM -chmod +x codecov - -./codecov --verbose +bash <(curl -s https://codecov.io/bash) From 513af5d697b51287c29b7b26d2921c85f5b66aa3 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Wed, 5 Jun 2024 16:03:28 +0100 Subject: [PATCH 07/26] Added support for clang-format linting --- .github/workflows/lint.yml | 36 +++++++++++++++++++ include/base/PlatypusApp.h | 1 - include/problem/MFEMProblem.h | 11 +++--- .../ElementVectorL2Difference.C | 6 ++-- 4 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..65ed6650 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,36 @@ +name: Lint + +on: + push: + branches: + - main + pull_request: + branches: + - main + +permissions: { } + +jobs: + build: + name: Lint + runs-on: ubuntu-latest + + permissions: + contents: read + packages: read + # To report GitHub Actions status checks + statuses: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # super-linter needs the full git history to get the + # list of files that changed across commits + fetch-depth: 0 + + - name: Super-linter + uses: super-linter/super-linter/slim@v6.6.0 + env: + # To report GitHub Actions status checks + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/include/base/PlatypusApp.h b/include/base/PlatypusApp.h index 15b1e2e4..bfa1962b 100644 --- a/include/base/PlatypusApp.h +++ b/include/base/PlatypusApp.h @@ -14,4 +14,3 @@ class PlatypusApp : public MooseApp static void registerAll(Factory & f, ActionFactory & af, Syntax & s); static void associateSyntax(Syntax & syntax, ActionFactory & action_factory); }; - diff --git a/include/problem/MFEMProblem.h b/include/problem/MFEMProblem.h index dee49f69..1be63adc 100644 --- a/include/problem/MFEMProblem.h +++ b/include/problem/MFEMProblem.h @@ -147,7 +147,8 @@ class MFEMProblem : public ExternalProblem void setMOOSEElementalVarData(MooseVariableFieldBase & moose_variable); /** - * Template method for adding kernels. We can only add kernels using equation system problem builders. + * Template method for adding kernels. We can only add kernels using equation system problem + * builders. */ template void addKernel(std::string var_name, std::shared_ptr> kernel) @@ -156,13 +157,15 @@ class MFEMProblem : public ExternalProblem EquationSystemProblemBuilderInterface * eqn_system_problem_builder{nullptr}; - if ((eqn_system_problem_builder = dynamic_cast(mfem_problem_builder.get()))) + if ((eqn_system_problem_builder = + dynamic_cast(mfem_problem_builder.get()))) { eqn_system_problem_builder->AddKernel(std::move(var_name), std::move(kernel)); } - else + else { - mooseError("Cannot add kernel with name '" + var_name + "' because there is no equation system."); + mooseError("Cannot add kernel with name '" + var_name + + "' because there is no equation system."); } } diff --git a/src/postprocessors/ElementVectorL2Difference.C b/src/postprocessors/ElementVectorL2Difference.C index a2b70acb..7a47903f 100644 --- a/src/postprocessors/ElementVectorL2Difference.C +++ b/src/postprocessors/ElementVectorL2Difference.C @@ -47,13 +47,15 @@ ElementVectorL2Difference::computeQpIntegral() return difference_vector.norm_sq(); // dot product of difference vector. } -void ElementVectorL2Difference::checkVectorVariables() const +void +ElementVectorL2Difference::checkVectorVariables() const { auto & coupled_vector_variables = getCoupledVectorMooseVars(); if (coupled_vector_variables.size() != 2) { - mooseError("There are ", coupled_vector_variables.size(), " coupled vector variables. Expected 2."); + mooseError( + "There are ", coupled_vector_variables.size(), " coupled vector variables. Expected 2."); } auto first = coupled_vector_variables[0]; From f6e0bb45c191b46a818213f3eab1566aaf6dc6e8 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Wed, 5 Jun 2024 16:03:43 +0100 Subject: [PATCH 08/26] Another attempt to upload coverage data --- upload-coverage.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/upload-coverage.sh b/upload-coverage.sh index 664c8915..fbff8588 100644 --- a/upload-coverage.sh +++ b/upload-coverage.sh @@ -2,4 +2,9 @@ cd /opt/platypus +for filename in `find src -name "*.C"`; +do + gcov -n -o . $filename > /dev/null; +done + bash <(curl -s https://codecov.io/bash) From 0f1a51bdb1e17d6039f9eb095d47b6225b61205d Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Wed, 5 Jun 2024 16:03:58 +0100 Subject: [PATCH 09/26] Add a couple initial badges to the README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 76ce82bc..ea27f3e1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ Platypus ===== +![build](https://github.com/aurora-multiphysics/platypus/actions/workflows/main.yml/badge.svg?branch=main) +[![GitHub License](https://img.shields.io/github/license/aurora-multiphysics/platypus)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) + Platypus is a MOOSE-based application created to enable custom MOOSE problems to be set up and solved using the [MFEM](https://github.com/mfem/mfem) finite element library as an alternative backend to libMesh. It is based off of the MOOSE electromagnetics app [Apollo](https://github.com/aurora-multiphysics/apollo) that uses MFEM for solving electromagnetics problems in a variety of formulations. Platypus is under active development and is being updated frequently. From afd9035e067e7fc7c8b90f99900e18c5691b88ab Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 16:27:15 +0100 Subject: [PATCH 10/26] Applied shellcheck linting --- .gitlab-ci.yml | 140 ------------------------ scripts/build-platypus-csd3-cclake.sh | 72 ++++++------ scripts/build-platypus-csd3-sapphire.sh | 88 +++++++-------- scripts/install-format-hook.sh | 4 +- scripts/upload-coverage.sh | 10 ++ upload-coverage.sh | 10 -- 6 files changed, 92 insertions(+), 232 deletions(-) delete mode 100644 .gitlab-ci.yml mode change 100644 => 100755 scripts/build-platypus-csd3-cclake.sh mode change 100644 => 100755 scripts/build-platypus-csd3-sapphire.sh create mode 100755 scripts/upload-coverage.sh delete mode 100644 upload-coverage.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 333b21d8..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,140 +0,0 @@ -image: ubuntu:latest - -variables: - GIT_SUBMODULE_STRATEGY: recursive - -stages: - - build - - test - - quality - - security - - deploy - -# Build the software, along with all tests -build: - stage: build - script: - - mkdir build - - cd build - - cmake .. - - make -j - - cd .. - artifacts: - paths: - - build/ - - bin/ - - lib/ - expire_in: 1 day - -# Run tests - -.template: &coverage_template - stage: test - before_script: - - apt install gcovr - - cd build - - cmake .. -DBUILD_TYPE=TEST - - make -j -# after_script: -# - make gcovr - coverage: '/^lines: (\d+.\d+)%/' - - -unit_tests: - <<: *coverage_template - script: - - ../bin/unit_tests - - make gcovr - - mv gcovr unit_test_coverage - artifacts: - paths: - - build/unit_test_coverage - expire_in: 1 week - -integration_tests: - <<: *coverage_template - script: - - ../bin/integration_tests - - make gcovr - - mv gcovr integration_test_coverage - artifacts: - paths: - - build/integration_test_coverage - expire_in: 1 week - -regression_tests: - <<: *coverage_template - script: - - ../bin/regression_tests - - make gcovr - - mv gcovr regression_test_coverage - artifacts: - paths: - - build/regression_test_coverage - expire_in: 1 week - -format_tests: - stage: test - script: - - find ./{test,src}/ -iname *.h -o -iname *.cpp -o -iname *.hpp | xargs clang-format-8 -style=file | clang-format-diff-8 > out.txt - - if [[ -s out.txt ]]; then false; fi - allow_failure: true - -# Code quality -cyclomatic_complexity: - stage: quality - script: - - python /home/lizard/lizard.py --CCN=15 --length=100 --arguments=10 src - -static_analysis: - stage: quality - script: - - script -c "cppcheck src --enable=all" cppcheck.out - artifacts: - paths: - - cppcheck.out - expire_in: 1 week - -similarity: - stage: quality - script: - - script -c "sim_c++ -aRn src/*" similarity.out - artifacts: - paths: - - similarity.out - expire_in: 1 week - - -flaws: - stage: security - script: - - script -c "flawfinder src" flawfinder.out - artifacts: - paths: - - flawfinder.out - expire_in: 1 week - -pages: - stage: deploy - script: - # assuming build folder in the build stage is kept - - mkdir builddoc && cd builddoc - - cmake .. - - make doc - # doxygen output folder name is controlled in defined Doxygen.in - # gitlab pages request document must put into `public` folder of the repo directory - - mv public/html ../public - - cd .. - - mv build/unit_test_coverage public/unit_coverage - - mv build/integration_test_coverage public/integration_coverage - - mv build/regression_test_coverage public/regression_coverage - dependencies: - - unit_tests - - integration_tests - - regression_tests - only: - - master - artifacts: - paths: - - public - allow_failure: true # TODO change to false diff --git a/scripts/build-platypus-csd3-cclake.sh b/scripts/build-platypus-csd3-cclake.sh old mode 100644 new mode 100755 index 8dd20206..e372fe5f --- a/scripts/build-platypus-csd3-cclake.sh +++ b/scripts/build-platypus-csd3-cclake.sh @@ -1,8 +1,8 @@ #!/bin/bash #set -ue -export STACK_SRC=`mktemp -d /tmp/moose_stack_src.XXXXXX` -export WORKDIR=`pwd` +export STACK_SRC=$(mktemp -d /tmp/moose_stack_src.XXXXXX) +export WORKDIR=$(pwd) export compile_cores=32 export OMPI_MCA_mca_base_component_show_load_errors=0 @@ -14,18 +14,18 @@ function load_modules() { } function build_petsc() { - cd $WORKDIR + cd "$WORKDIR" || exit 1 curl -LJO https://github.com/xiaoyeli/superlu_dist/archive/refs/tags/v8.1.0.tar.gz if [ -d "$WORKDIR/petsc" ] ; then return fi mkdir petsc - cd petsc + cd petsc || exit 1 curl -L -O http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.19.3.tar.gz tar -xf petsc-3.19.3.tar.gz -C . - cd petsc-3.19.3 + cd petsc-3.19.3 || exit 1 ./configure \ - --prefix=$WORKDIR/petsc \ + --prefix="$WORKDIR"/petsc \ CXXOPTFLAGS='-O3 -march=cascadelake -funroll-loops' COPTFLAGS='-O3 -march=cascadelake -funroll-loops' FOPTFLAGS='-O3 -march=cascadelake' \ --with-debugging=0 \ --with-ssl=0 \ @@ -40,16 +40,16 @@ function build_petsc() { --download-metis=1 \ --download-ptscotch=1 \ --download-parmetis=1 \ - --download-superlu_dist=$WORKDIR/superlu_dist-8.1.0.tar.gz \ + --download-superlu_dist="$WORKDIR"/superlu_dist-8.1.0.tar.gz \ --download-scalapack=1 \ --download-mumps=1 \ --download-slepc=1 \ --with-64-bit-indices=1 \ --with-mpi-dir=/usr/local/Cluster-Apps/openmpi/gcc/9.3/4.0.4 \ - PETSC_DIR=`pwd` PETSC_ARCH=arch-linux-c-opt + PETSC_DIR=$(pwd) PETSC_ARCH=arch-linux-c-opt make - make PETSC_DIR=$WORKDIR/petsc/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install - make PETSC_DIR=$WORKDIR/petsc PETSC_ARCH="" check + make PETSC_DIR="$WORKDIR"/petsc/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install + make PETSC_DIR="$WORKDIR"/petsc PETSC_ARCH="" check cd .. cd .. export PETSC_DIR=$WORKDIR/petsc @@ -57,16 +57,16 @@ function build_petsc() { function build_moose() { export MOOSE_JOBS=32 - cd $WORKDIR + cd "$WORKDIR" || exit 1 if [ -d "$WORKDIR/moose" ] ; then return fi # _build_mpich33 load_modules #build_vtk_git - cd $WORKDIR + cd "$WORKDIR" || exit 1 git clone https://github.com/idaholab/moose - cd moose + cd moose || exit 1 git checkout master if [ ! -f "$WORKDIR/petsc/lib/libpetsc.so" ] ; then echo "PETSc Install Unsuccessful" @@ -82,20 +82,20 @@ function build_moose() { export FC=mpif90 if [ -d "$WORKDIR/vtk" ] ; then echo "building libmesh with VTK" - METHODS='opt' ./scripts/update_and_rebuild_libmesh.sh --with-mpi --with-cxx-std=2017 --with-vtk-include=$WORKDIR/vtk/include/vtk-9.1 --with-vtk-lib=$WORKDIR/vtk/lib64 + METHODS='opt' ./scripts/update_and_rebuild_libmesh.sh --with-mpi --with-cxx-std=2017 --with-vtk-include="$WORKDIR"/vtk/include/vtk-9.1 --with-vtk-lib="$WORKDIR"/vtk/lib64 else echo "Building libmesh withOUT VTK" METHODS='opt' ./scripts/update_and_rebuild_libmesh.sh --with-mpi fi ./configure --with-derivative-size=200 --with-ad-indexing-type=global METHODS='opt' ./scripts/update_and_rebuild_wasp.sh - cd framework + cd framework || exit 1 METHOD=opt make -j32 cd .. - cd modules + cd modules || exit 1 METHOD=opt make -j32 cd .. - cd test + cd test || exit 1 METHOD=opt make -j32 ./run_tests -j32 cd .. @@ -103,16 +103,16 @@ function build_moose() { } function build_mfem() { - cd $WORKDIR + cd "$WORKDIR" || exit 1 if [ -d "$WORKDIR/mfem" ] ; then return fi git clone https://github.com/Heinrich-BR/mfem.git - cd mfem + cd mfem || exit 1 git checkout SubmeshBoundary - sed -i "s|list|# list|g" $WORKDIR/mfem/config/cmake/modules/FindNetCDF.cmake + sed -i "s|list|# list|g" "$WORKDIR"/mfem/config/cmake/modules/FindNetCDF.cmake mkdir build - cd build + cd build || exit 1 echo "Building MFEM" cmake .. \ -DCMAKE_BUILD_TYPE=Release \ @@ -120,41 +120,41 @@ function build_mfem() { -DMFEM_SHARED=YES \ -DMFEM_USE_OPENMP=YES \ -DMFEM_THREAD_SAFE=NO \ - -DHYPRE_DIR=/$WORKDIR/petsc/ \ - -DBLAS_LIBRARIES=/$WORKDIR/petsc/lib/libfblas.a \ - -DLAPACK_LIBRARIES=/$WORKDIR/petsc/lib/libflapack.a \ + -DHYPRE_DIR=/"$WORKDIR"/petsc/ \ + -DBLAS_LIBRARIES=/"$WORKDIR"/petsc/lib/libfblas.a \ + -DLAPACK_LIBRARIES=/"$WORKDIR"/petsc/lib/libflapack.a \ -DMFEM_USE_MPI=YES \ -DMFEM_USE_METIS_5=YES \ - -DMETIS_DIR=/$WORKDIR/petsc/ \ - -DParMETIS_DIR=/$WORKDIR/petsc/ \ + -DMETIS_DIR=/"$WORKDIR"/petsc/ \ + -DParMETIS_DIR=/"$WORKDIR"/petsc/ \ -DMFEM_USE_SUPERLU=YES \ - -DSuperLUDist_DIR=/$WORKDIR/petsc/ \ + -DSuperLUDist_DIR=/"$WORKDIR"/petsc/ \ -DMFEM_USE_NETCDF=YES \ - -DNETCDF_LIBRARIES=$WORKDIR/moose/libmesh/installed/lib/libnetcdf.so \ - -DNETCDF_INCLUDE_DIRS=$WORKDIR/moose/libmesh/contrib/netcdf/netcdf-c-4.6.2/include \ + -DNETCDF_LIBRARIES="$WORKDIR"/moose/libmesh/installed/lib/libnetcdf.so \ + -DNETCDF_INCLUDE_DIRS="$WORKDIR"/moose/libmesh/contrib/netcdf/netcdf-c-4.6.2/include \ -DHDF5_DIR=/usr/local/Cluster-Apps/hdf5/openmpi/gcc/9.3/1.12.0 \ -DCMAKE_POLICY_DEFAULT_CMP0057=NEW make -j"$compile_cores" - cd miniapps/common + cd miniapps/common || exit 1 make -j"$compile_cores" } function build_platypus() { - cd $WORKDIR + cd "$WORKDIR" || exit 1 if [ -d "$WORKDIR/platypus" ] ; then return fi git clone https://github.com/aurora-multiphysics/platypus.git - cd platypus + cd platypus || exit 1 git checkout master git submodule update --init --recursive - cd contrib/hephaestus/ + cd contrib/hephaestus/ || exit 1 mkdir build - cd build - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DMFEM_DIR=/$WORKDIR/mfem/build -DMFEM_COMMON_INCLUDES=/$WORKDIR/mfem/miniapps/common .. + cd build || exit 1 + cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DMFEM_DIR=/"$WORKDIR"/mfem/build -DMFEM_COMMON_INCLUDES=/"$WORKDIR"/mfem/miniapps/common .. make -j1 - cd /$WORKDIR/platypus + cd /"$WORKDIR"/platypus || exit 1 make -j"$compile_cores" } diff --git a/scripts/build-platypus-csd3-sapphire.sh b/scripts/build-platypus-csd3-sapphire.sh old mode 100644 new mode 100755 index c3d14427..2c8a2b53 --- a/scripts/build-platypus-csd3-sapphire.sh +++ b/scripts/build-platypus-csd3-sapphire.sh @@ -25,12 +25,12 @@ function load_modules() { module load python/3.8 module load ninja - export STACK_SRC=`mktemp -d /tmp/moose_stack_src.XXXXXX` - export WORKDIR=`pwd` + export STACK_SRC=$(mktemp -d /tmp/moose_stack_src.XXXXXX) + export WORKDIR=$(pwd) export compile_cores=8 export OMPI_MCA_mca_base_component_show_load_errors=0 - USER=`whoami` + USER=$(whoami) BUILD_DIR_NAME=${WORKDIR} ROOT_PATH=/home/${USER}/rds/rds-ukaea-ap001/${USER} @@ -52,7 +52,7 @@ function load_modules() { export PATH=${BUILD_PATH}:${PATH} - cd ${WORKDIR} + cd "${WORKDIR}" || exit 1 #Need to set some compiler flags via config file" echo "-std=c++17" >> icpx.cfg @@ -72,7 +72,7 @@ function load_modules() { } function _build_hdf5() { - cd ${WORKDIR} + cd "${WORKDIR}" || exit 1 mkdir -p ${HDF5_DIR_NAME} || { echo "Failed to create ${HDF5_DIR_NAME}" ; exit 1 ; } HDF5_MAJ_VER=1.10 @@ -84,9 +84,9 @@ function _build_hdf5() { || { echo "Failed to download hdf5" ; exit 1 ; } tar -xf hdf5-${HDF5_VER}.tar.gz - cd hdf5-${HDF5_VER} + cd hdf5-${HDF5_VER} || exit 1 make clean - ./configure --prefix=${HDF5_INSTALL_PATH} --enable-cxx --enable-fortran --enable-build-mode=production + ./configure --prefix="${HDF5_INSTALL_PATH}" --enable-cxx --enable-fortran --enable-build-mode=production make install -j ${compile_cores} if [ $? -eq 2 ]; then echo "HDF5 Build failed" @@ -96,7 +96,7 @@ function _build_hdf5() { } function _build_petsc() { - cd $WORKDIR + cd "$WORKDIR" || exit 1 # echo "Downloading SuperLU_dist" # curl -kLJO https://github.com/xiaoyeli/superlu_dist/archive/refs/tags/v8.1.0.tar.gz # curl -kLJO https://github.com/xiaoyeli/superlu_dist/archive/refs/tags/v8.1.0.tar.gz @@ -104,23 +104,23 @@ function _build_petsc() { # return # fi mkdir -p petsc - cd petsc + cd petsc || exit 1 curl -kL -O http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.19.3.tar.gz tar -xf petsc-3.19.3.tar.gz -C . - cd petsc-3.19.3 + cd petsc-3.19.3 || exit 1 ./configure \ --with-cc=$CC --with-cxx=$CXX --with-fc=$FC -CXXPP=cpp \ - --prefix=${WORKDIR}/${PETSC_DIR_NAME} \ + --prefix="${WORKDIR}"/${PETSC_DIR_NAME} \ --download-hypre=1 \ --with-shared-libraries \ --with-debugging=no \ - --with-hdf5-dir=${WORKDIR}/${HDF5_DIR_NAME} \ - --with-blaslapack-dir=${MKLROOT} \ + --with-hdf5-dir="${WORKDIR}"/${HDF5_DIR_NAME} \ + --with-blaslapack-dir="${MKLROOT}" \ --download-metis=1 \ --download-parmetis=1 \ --download-ptscotch=1 \ --download-mumps=1 \ - --download-superlu_dist=${WORKDIR}/superlu_dist-8.1.0.tar.gz \ + --download-superlu_dist="${WORKDIR}"/superlu_dist-8.1.0.tar.gz \ --download-scalapack=1 \ --download-slepc=1 \ --with-mpi=1 \ @@ -128,13 +128,13 @@ function _build_petsc() { --with-fortran-bindings=0 \ --with-sowing=0 \ --with-64-bit-indices \ - --with-make-np=${SLURM_NTASKS} \ + --with-make-np="${SLURM_NTASKS}" \ COPTFLAGS='-O3 -fno-slp-vectorize' \ CXXOPTFLAGS='-O3 -fno-slp-vectorize' \ FOPTFLAGS='-O3 -fno-slp-vectorize' \ - PETSC_DIR=`pwd` PETSC_ARCH=arch-linux-c-opt + PETSC_DIR=$(pwd) PETSC_ARCH=arch-linux-c-opt make - make PETSC_DIR=${WORKDIR}/${PETSC_DIR_NAME}/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install \ + make PETSC_DIR="${WORKDIR}"/${PETSC_DIR_NAME}/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install \ || { echo "Failed to build petsc" ; exit 1 ; } cd .. cd .. @@ -143,13 +143,13 @@ function _build_petsc() { function build_moose() { export MOOSE_JOBS=32 - cd $WORKDIR + cd "$WORKDIR" || exit 1 # if [ -d "$WORKDIR/moose" ] ; then # return # fi - cd $WORKDIR + cd "$WORKDIR" || exit 1 git clone https://github.com/idaholab/moose - cd moose + cd moose || exit 1 git checkout ${MOOSE_COMMIT} || { echo "Checkout failed" ; exit 1 ; } if [ ! -f "$WORKDIR/petsc/lib/libpetsc.so" ] ; then echo "PETSc Install Unsuccessful" @@ -198,13 +198,13 @@ function build_moose() { ./configure --with-derivative-size=200 --with-ad-indexing-type=global METHODS='opt' ./scripts/update_and_rebuild_wasp.sh - cd framework + cd framework || exit 1 METHOD=opt make -j"$compile_cores" cd .. - cd modules + cd modules || exit 1 METHOD=opt make -j"$compile_cores" cd .. - cd test + cd test || exit 1 METHOD=opt make -j"$compile_cores" ./run_tests -j"$compile_cores" cd .. @@ -212,69 +212,69 @@ function build_moose() { } function build_gslib() { - cd $WORKDIR + cd "$WORKDIR" || exit 1 if [ -d "$WORKDIR/gslb" ] ; then return fi git clone https://github.com/Nek5000/gslib.git - cd gslib + cd gslib || exit 1 make CFLAGS='-O2 -fPIC' } function build_mfem() { - cd $WORKDIR + cd "$WORKDIR" || exit 1 # if [ -d "$WORKDIR/mfem" ] ; then # return # fi git clone https://github.com/Heinrich-BR/mfem.git - cd mfem + cd mfem || exit 1 git checkout SubmeshBoundary - sed -i "s|list|# list|g" $WORKDIR/mfem/config/cmake/modules/FindNetCDF.cmake + sed -i "s|list|# list|g" "$WORKDIR"/mfem/config/cmake/modules/FindNetCDF.cmake mkdir build - cd build + cd build || exit 1 echo "Building MFEM" cmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POSITION_INDEPENDENT_CODE=YES \ -DMFEM_USE_OPENMP=NO \ -DMFEM_THREAD_SAFE=NO \ - -DHYPRE_DIR=/$WORKDIR/petsc/ \ + -DHYPRE_DIR=/"$WORKDIR"/petsc/ \ -DMFEM_USE_LAPACK=YES \ -DMFEM_USE_MPI=YES \ -DMFEM_USE_METIS_5=YES \ - -DMETIS_DIR=/$WORKDIR/petsc/ \ - -DParMETIS_DIR=/$WORKDIR/petsc/ \ + -DMETIS_DIR=/"$WORKDIR"/petsc/ \ + -DParMETIS_DIR=/"$WORKDIR"/petsc/ \ -DMFEM_USE_SUPERLU=YES \ - -DSuperLUDist_DIR=/$WORKDIR/petsc/ \ + -DSuperLUDist_DIR=/"$WORKDIR"/petsc/ \ -DSuperLUDist_VERSION_OK=YES \ -DMFEM_USE_NETCDF=YES \ - -DNETCDF_LIBRARIES=$WORKDIR/moose/libmesh/installed/lib/libnetcdf.so \ - -DNETCDF_INCLUDE_DIRS=$WORKDIR/moose/libmesh/contrib/netcdf/netcdf-c-4.6.2/include \ - -DHDF5_DIR=/$WORKDIR/${HDF5_DIR_NAME}/ \ + -DNETCDF_LIBRARIES="$WORKDIR"/moose/libmesh/installed/lib/libnetcdf.so \ + -DNETCDF_INCLUDE_DIRS="$WORKDIR"/moose/libmesh/contrib/netcdf/netcdf-c-4.6.2/include \ + -DHDF5_DIR=/"$WORKDIR"/${HDF5_DIR_NAME}/ \ -DMFEM_USE_GSLIB=YES \ - -DGSLIB_DIR=/$WORKDIR/gslib/build + -DGSLIB_DIR=/"$WORKDIR"/gslib/build make -j"$compile_cores" - cd miniapps/common + cd miniapps/common || exit 1 make -j"$compile_cores" } function build_platypus() { - cd $WORKDIR + cd "$WORKDIR" || exit 1 # if [ -d "$WORKDIR/platypus" ] ; then # return # fi git clone https://github.com/aurora-multiphysics/platypus.git - cd platypus + cd platypus || exit 1 git checkout ${PLATYPUS_COMMIT} git submodule update --init --recursive - cd contrib/hephaestus/ + cd contrib/hephaestus/ || exit 1 # git checkout master mkdir build - cd build - cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DMFEM_DIR=/$WORKDIR/mfem/build .. + cd build || exit 1 + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DMFEM_DIR=/"$WORKDIR"/mfem/build .. ninja - cd /$WORKDIR/platypus + cd /"$WORKDIR"/platypus || exit 1 make -j"$compile_cores" } diff --git a/scripts/install-format-hook.sh b/scripts/install-format-hook.sh index 44a2037a..004318a2 100755 --- a/scripts/install-format-hook.sh +++ b/scripts/install-format-hook.sh @@ -20,7 +20,7 @@ else echo "$patch" exit 1 fi -' > $hookfile +' > "$hookfile" -chmod a+x $hookfile +chmod a+x "$hookfile" diff --git a/scripts/upload-coverage.sh b/scripts/upload-coverage.sh new file mode 100755 index 00000000..7157dc51 --- /dev/null +++ b/scripts/upload-coverage.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +cd /opt/platypus || exit 1 + +for filename in $(find build -name "*.C"); +do + gcov -n -o . "$filename" > /dev/null; +done + +bash <(curl -s https://codecov.io/bash) diff --git a/upload-coverage.sh b/upload-coverage.sh deleted file mode 100644 index fbff8588..00000000 --- a/upload-coverage.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -cd /opt/platypus - -for filename in `find src -name "*.C"`; -do - gcov -n -o . $filename > /dev/null; -done - -bash <(curl -s https://codecov.io/bash) From 8df4908aa35d0cb26866d24aac238a7f0caaf5cc Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 16:27:46 +0100 Subject: [PATCH 11/26] Adjusted path to coverage upload script --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0aaa5fbc..9fe98b45 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,4 +31,4 @@ jobs: - name: UploadCoverage run: | ci_env=`bash <(curl -s https://codecov.io/env)` - docker run $ci_env -e CI=true ci-platypus-ubuntu:latest bash opt/platypus/upload-coverage.sh + docker run $ci_env -e CI=true ci-platypus-ubuntu:latest bash opt/platypus/scripts/upload-coverage.sh From 86f54051ce1b32d35c5914af1e0b6b96f607e64a Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 17:50:23 +0100 Subject: [PATCH 12/26] Configured linters and tried to correct issues with them --- .github/linters/.clang-format | 1 + .github/linters/.markdown-lint.yml | 35 ++++++++++++++++++++++++++++++ .github/linters/.yaml-lint.yml | 11 ++++++++++ .github/workflows/lint.yml | 12 ++++++++++ .github/workflows/main.yml | 12 +++++----- .pre-commit-config.yaml | 3 ++- doc/config.yml | 1 + docker/platypus-deps/Dockerfile | 18 +++++++-------- docker/platypus/Dockerfile | 20 ++++++++--------- platypus.yaml | 7 +++--- 10 files changed, 92 insertions(+), 28 deletions(-) create mode 120000 .github/linters/.clang-format create mode 100644 .github/linters/.markdown-lint.yml create mode 100644 .github/linters/.yaml-lint.yml diff --git a/.github/linters/.clang-format b/.github/linters/.clang-format new file mode 120000 index 00000000..2d112372 --- /dev/null +++ b/.github/linters/.clang-format @@ -0,0 +1 @@ +../../.clang-format \ No newline at end of file diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml new file mode 100644 index 00000000..a694d1b7 --- /dev/null +++ b/.github/linters/.markdown-lint.yml @@ -0,0 +1,35 @@ +--- +########################### +########################### +## Markdown Linter rules ## +########################### +########################### + +# Linter rules doc: +# - https://github.com/DavidAnson/markdownlint +# +# Note: +# To comment out a single error: +# +# any violations you want +# +# + +############### +# Rules by id # +############### +MD004: false # Unordered list style +MD007: + indent: 2 # Unordered list indentation +MD013: + line_length: 100 # Line length 80 is far too short +MD026: + punctuation: ".,;:!。,;:" # List of not allowed +MD029: false # Ordered list item prefix +MD033: false # Allow inline HTML +MD041: false # Allow MOOSE configuration data before first heading + +################# +# Rules by tags # +################# +blank_lines: false # Error on blank lines diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml new file mode 100644 index 00000000..b0bc8c54 --- /dev/null +++ b/.github/linters/.yaml-lint.yml @@ -0,0 +1,11 @@ +extends: default + +ignore: + - syntax.yaml + +line-length: + level: warning + max: 100 + allow-non-breakable-words: true + allow-non-breakable-inline-mappings: true + diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 65ed6650..14a25bd2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,3 +1,4 @@ +--- name: Lint on: @@ -31,6 +32,17 @@ jobs: - name: Super-linter uses: super-linter/super-linter/slim@v6.6.0 + with: + VALIDATE_ANSIBLE: false + VALIDATE_CHECKOV: false + VALIDATE_CPP: false + VALIDATE_JSCPD: false + VALIDATE_PYTHON_BLACK: false + VALIDATE_PYTHON_FLAKE8: false + VALIDATE_PYTHON_ISORT: false + VALIDATE_PYTHON_MYPY: false + VALIDATE_PYTHON_PYLINT: false + VALIDATE_PYTHON_RUFF: false env: # To report GitHub Actions status checks GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9fe98b45..3eb03a4e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,3 +1,4 @@ +--- name: BuildTest on: push: @@ -17,18 +18,19 @@ jobs: steps: # First check out the repository to get the docker file - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Print the context for this GitHub workflow - name: PrintGithubContext - run: echo ${PRCOMMITSHA:-$GITHUB_SHA} ${PRREPOSITORY:-$GITHUB_REPOSITORY} + run: echo "${PRCOMMITSHA:-$GITHUB_SHA}" "${PRREPOSITORY:-$GITHUB_REPOSITORY}" # Now build in a container with all deps - name: DockerBuildTest run: | docker build -t ci-platypus-ubuntu \ - --build-arg build_git_sha=${PRCOMMITSHA:-$GITHUB_SHA} \ - --build-arg build_git_repo=${PRREPOSITORY:-$GITHUB_REPOSITORY} \ + --build-arg build_git_sha="${PRCOMMITSHA:-$GITHUB_SHA}" \ + --build-arg build_git_repo="${PRREPOSITORY:-$GITHUB_REPOSITORY}" \ docker/platypus - name: UploadCoverage run: | - ci_env=`bash <(curl -s https://codecov.io/env)` + ci_env=$(bash <(curl -s https://codecov.io/env)) + # shellcheck disable=SC2086 docker run $ci_env -e CI=true ci-platypus-ubuntu:latest bash opt/platypus/scripts/upload-coverage.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b8aee6cb..60809f66 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +--- repos: - repo: https://github.com/pre-commit/mirrors-clang-format rev: v14.0.6 @@ -8,4 +9,4 @@ repos: rev: v1.3.5 hooks: - id: clang-tidy - args: [-p=./build, -config-file=./.clang-tidy, --warnings-as-errors=*, -extra-arg=-std=c++17, -extra-arg=-stdlib=libstdc++] \ No newline at end of file + args: [-p=./build, -config-file=./.clang-tidy, --warnings-as-errors=*, -extra-arg=-std=c++17, -extra-arg=-stdlib=libstdc++] diff --git a/doc/config.yml b/doc/config.yml index 0cfa7005..95128cfc 100644 --- a/doc/config.yml +++ b/doc/config.yml @@ -1,3 +1,4 @@ +--- Content: Platypus: root_dir: ${ROOT_DIR}/doc/content diff --git a/docker/platypus-deps/Dockerfile b/docker/platypus-deps/Dockerfile index 2b2bf6a3..d6b90fcf 100644 --- a/docker/platypus-deps/Dockerfile +++ b/docker/platypus-deps/Dockerfile @@ -9,8 +9,8 @@ ARG compile_cores=4 ARG WORKDIR=opt # Configure MOOSE +WORKDIR /$WORKDIR RUN export MOOSE_JOBS=$compile_cores && \ - cd /$WORKDIR && \ git clone https://github.com/idaholab/moose && \ cd moose && \ git checkout master && \ @@ -25,23 +25,23 @@ RUN export MOOSE_JOBS=$compile_cores && \ ./configure --with-derivative-size=200 # Build WASP -RUN cd /$WORKDIR/moose/scripts && \ - METHODS=opt ./update_and_rebuild_wasp.sh +WORKDIR /$WORKDIR/moose/scripts +RUN METHODS=opt ./update_and_rebuild_wasp.sh # Build MOOSE -RUN cd /$WORKDIR/moose/framework && \ - METHOD=opt make -j$compile_cores +WORKDIR /$WORKDIR/moose/framework +RUN METHOD=opt make -j$compile_cores -RUN cd /$WORKDIR/moose/test && \ - METHOD=opt make -j$compile_cores +WORKDIR /$WORKDIR/moose/test +RUN METHOD=opt make -j$compile_cores # This is needed or it mpiexec complains because docker runs as root # Discussion on this issue https://github.com/open-mpi/ompi/issues/4451 ENV OMPI_ALLOW_RUN_AS_ROOT=1 ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 -# RUN cd /$WORKDIR/moose/test && \ -# ./run_tests -j"$compile_cores" --re='(?!initial_condition.newton_with_exact_initialization)' +# WORKDIR /$WORKDIR/moose/test +# RUN ./run_tests -j"$compile_cores" --re='(?!initial_condition.newton_with_exact_initialization)' # ENV OMPI_ALLOW_RUN_AS_ROOT= # ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM= diff --git a/docker/platypus/Dockerfile b/docker/platypus/Dockerfile index 327c7455..cedb9970 100644 --- a/docker/platypus/Dockerfile +++ b/docker/platypus/Dockerfile @@ -16,27 +16,27 @@ ARG WORKDIR=opt ARG coverage=false # Get Platypus with Hephaestus -RUN cd /$WORKDIR && \ - git clone https://github.com/$build_git_repo && \ +WORKDIR /$WORKDIR +RUN git clone https://github.com/$build_git_repo && \ cd platypus && \ git checkout $build_git_sha && \ git submodule update --init --recursive # Build Hephaestus -RUN cd /$WORKDIR/platypus/contrib/hephaestus/ && \ - mkdir build && \ +WORKDIR /$WORKDIR/platypus/contrib/hephaestus/ +RUN mkdir build && \ cd build && \ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DMFEM_DIR=/$WORKDIR/mfem/build .. && \ ninja # Test Hephaestus -RUN cd /$WORKDIR/platypus/contrib/hephaestus/build && \ - ninja test +WORKDIR /$WORKDIR/platypus/contrib/hephaestus/build +RUN ninja test # Build Platypus -RUN cd /$WORKDIR/platypus && \ - make -j$compile_cores coverage=$coverage +WORKDIR /$WORKDIR/platypus +RUN make -j$compile_cores coverage=$coverage # Test Platypus -RUN cd /$WORKDIR/platypus && \ - make test linkcoverage=$coverage +WORKDIR /$WORKDIR/platypus +RUN make test linkcoverage=$coverage diff --git a/platypus.yaml b/platypus.yaml index ff87e7db..99471ace 100644 --- a/platypus.yaml +++ b/platypus.yaml @@ -1,9 +1,10 @@ +--- DMETHOD: opt Werror: reorder compiler_type: gcc documentation: true installation_type: in_tree registered_apps: -- WASPAPP -- PLATYPUSAPP -- PLATYPUSTESTAPP + - WASPAPP + - PLATYPUSAPP + - PLATYPUSTESTAPP From 5cddb1a50ff5bedcaad62f2ffd70239f04d7781f Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 18:12:50 +0100 Subject: [PATCH 13/26] Fixed path to upload script --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3eb03a4e..577d6be6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,4 +33,4 @@ jobs: run: | ci_env=$(bash <(curl -s https://codecov.io/env)) # shellcheck disable=SC2086 - docker run $ci_env -e CI=true ci-platypus-ubuntu:latest bash opt/platypus/scripts/upload-coverage.sh + docker run $ci_env -e CI=true ci-platypus-ubuntu:latest bash /opt/platypus/scripts/upload-coverage.sh From a465503d1a0b1fb85eb13fafbf05ced6e4a53e9c Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 19:00:51 +0100 Subject: [PATCH 14/26] Applied shfmt --- .editorconfig | 6 ++ scripts/build-platypus-csd3-cclake.sh | 78 ++++++++++---------- scripts/build-platypus-csd3-sapphire.sh | 96 ++++++++++++++----------- scripts/install-format-hook.sh | 3 +- scripts/upload-coverage.sh | 5 +- unit/run_tests | 16 ++--- 6 files changed, 109 insertions(+), 95 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..cae7cdab --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +[{*.sh,run_tests}] +indent_style = space +indent_size = 4 +space_redirects = true +keep_padding = true +never_split = true \ No newline at end of file diff --git a/scripts/build-platypus-csd3-cclake.sh b/scripts/build-platypus-csd3-cclake.sh index e372fe5f..9b51d8ef 100755 --- a/scripts/build-platypus-csd3-cclake.sh +++ b/scripts/build-platypus-csd3-cclake.sh @@ -16,8 +16,8 @@ function load_modules() { function build_petsc() { cd "$WORKDIR" || exit 1 curl -LJO https://github.com/xiaoyeli/superlu_dist/archive/refs/tags/v8.1.0.tar.gz - if [ -d "$WORKDIR/petsc" ] ; then - return + if [ -d "$WORKDIR/petsc" ]; then + return fi mkdir petsc cd petsc || exit 1 @@ -25,28 +25,28 @@ function build_petsc() { tar -xf petsc-3.19.3.tar.gz -C . cd petsc-3.19.3 || exit 1 ./configure \ - --prefix="$WORKDIR"/petsc \ + --prefix="$WORKDIR"/petsc \ CXXOPTFLAGS='-O3 -march=cascadelake -funroll-loops' COPTFLAGS='-O3 -march=cascadelake -funroll-loops' FOPTFLAGS='-O3 -march=cascadelake' \ - --with-debugging=0 \ - --with-ssl=0 \ - --with-pic=1 \ - --with-openmp=1 \ - --with-mpi=1 \ - --with-shared-libraries=1 \ - --with-fortran-bindings=0 \ - --with-sowing=0 \ - --download-hypre=1 \ - --download-fblaslapack=1 \ - --download-metis=1 \ - --download-ptscotch=1 \ - --download-parmetis=1 \ - --download-superlu_dist="$WORKDIR"/superlu_dist-8.1.0.tar.gz \ - --download-scalapack=1 \ - --download-mumps=1 \ - --download-slepc=1 \ - --with-64-bit-indices=1 \ - --with-mpi-dir=/usr/local/Cluster-Apps/openmpi/gcc/9.3/4.0.4 \ - PETSC_DIR=$(pwd) PETSC_ARCH=arch-linux-c-opt + --with-debugging=0 \ + --with-ssl=0 \ + --with-pic=1 \ + --with-openmp=1 \ + --with-mpi=1 \ + --with-shared-libraries=1 \ + --with-fortran-bindings=0 \ + --with-sowing=0 \ + --download-hypre=1 \ + --download-fblaslapack=1 \ + --download-metis=1 \ + --download-ptscotch=1 \ + --download-parmetis=1 \ + --download-superlu_dist="$WORKDIR"/superlu_dist-8.1.0.tar.gz \ + --download-scalapack=1 \ + --download-mumps=1 \ + --download-slepc=1 \ + --with-64-bit-indices=1 \ + --with-mpi-dir=/usr/local/Cluster-Apps/openmpi/gcc/9.3/4.0.4 \ + PETSC_DIR=$(pwd) PETSC_ARCH=arch-linux-c-opt make make PETSC_DIR="$WORKDIR"/petsc/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install make PETSC_DIR="$WORKDIR"/petsc PETSC_ARCH="" check @@ -58,19 +58,19 @@ function build_petsc() { function build_moose() { export MOOSE_JOBS=32 cd "$WORKDIR" || exit 1 - if [ -d "$WORKDIR/moose" ] ; then - return + if [ -d "$WORKDIR/moose" ]; then + return fi -# _build_mpich33 + # _build_mpich33 load_modules - #build_vtk_git + # build_vtk_git cd "$WORKDIR" || exit 1 git clone https://github.com/idaholab/moose cd moose || exit 1 git checkout master - if [ ! -f "$WORKDIR/petsc/lib/libpetsc.so" ] ; then - echo "PETSc Install Unsuccessful" - return + if [ ! -f "$WORKDIR/petsc/lib/libpetsc.so" ]; then + echo "PETSc Install Unsuccessful" + return fi export PETSC_DIR=$WORKDIR/petsc @@ -80,12 +80,12 @@ function build_moose() { export F90=mpif90 export F77=mpif77 export FC=mpif90 - if [ -d "$WORKDIR/vtk" ] ; then - echo "building libmesh with VTK" - METHODS='opt' ./scripts/update_and_rebuild_libmesh.sh --with-mpi --with-cxx-std=2017 --with-vtk-include="$WORKDIR"/vtk/include/vtk-9.1 --with-vtk-lib="$WORKDIR"/vtk/lib64 + if [ -d "$WORKDIR/vtk" ]; then + echo "building libmesh with VTK" + METHODS='opt' ./scripts/update_and_rebuild_libmesh.sh --with-mpi --with-cxx-std=2017 --with-vtk-include="$WORKDIR"/vtk/include/vtk-9.1 --with-vtk-lib="$WORKDIR"/vtk/lib64 else - echo "Building libmesh withOUT VTK" - METHODS='opt' ./scripts/update_and_rebuild_libmesh.sh --with-mpi + echo "Building libmesh withOUT VTK" + METHODS='opt' ./scripts/update_and_rebuild_libmesh.sh --with-mpi fi ./configure --with-derivative-size=200 --with-ad-indexing-type=global METHODS='opt' ./scripts/update_and_rebuild_wasp.sh @@ -104,8 +104,8 @@ function build_moose() { function build_mfem() { cd "$WORKDIR" || exit 1 - if [ -d "$WORKDIR/mfem" ] ; then - return + if [ -d "$WORKDIR/mfem" ]; then + return fi git clone https://github.com/Heinrich-BR/mfem.git cd mfem || exit 1 @@ -141,8 +141,8 @@ function build_mfem() { function build_platypus() { cd "$WORKDIR" || exit 1 - if [ -d "$WORKDIR/platypus" ] ; then - return + if [ -d "$WORKDIR/platypus" ]; then + return fi git clone https://github.com/aurora-multiphysics/platypus.git diff --git a/scripts/build-platypus-csd3-sapphire.sh b/scripts/build-platypus-csd3-sapphire.sh index 2c8a2b53..e4f5819c 100755 --- a/scripts/build-platypus-csd3-sapphire.sh +++ b/scripts/build-platypus-csd3-sapphire.sh @@ -8,7 +8,7 @@ #SBATCH --cpus-per-task=1 #SBATCH -o out_%j_%A_%a #SBATCH --exclusive -. /etc/profile.d/modules.sh +. /etc/profile.d/modules.sh #TODO: # - Remove xdr requirement from moose/scripts/configure_libmesh @@ -59,7 +59,7 @@ function load_modules() { echo "-Wno-tautological-constant-compare" >> icpx.cfg export ICPXCFG=${WORKDIR}/icpx.cfg - export CC=mpiicc + export CC=mpiicc export CXX=mpiicpc export FC=mpiifort export F77=mpiifort @@ -68,20 +68,26 @@ function load_modules() { export I_MPI_CXX=icpx export I_MPI_F90=ifx export I_MPI_FC=ifx - export I_MPI_F77=ifx + export I_MPI_F77=ifx } function _build_hdf5() { cd "${WORKDIR}" || exit 1 - mkdir -p ${HDF5_DIR_NAME} || { echo "Failed to create ${HDF5_DIR_NAME}" ; exit 1 ; } + mkdir -p ${HDF5_DIR_NAME} || { + echo "Failed to create ${HDF5_DIR_NAME}" + exit 1 + } HDF5_MAJ_VER=1.10 HDF5_MIN_VER=10 HDF5_VER=${HDF5_MAJ_VER}.${HDF5_MIN_VER} echo "Downloading HDF5" curl -kLJO \ - https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_MAJ_VER}/hdf5-${HDF5_VER}/src/hdf5-${HDF5_VER}.tar.gz \ - || { echo "Failed to download hdf5" ; exit 1 ; } + https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_MAJ_VER}/hdf5-${HDF5_VER}/src/hdf5-${HDF5_VER}.tar.gz || + { + echo "Failed to download hdf5" + exit 1 + } tar -xf hdf5-${HDF5_VER}.tar.gz cd hdf5-${HDF5_VER} || exit 1 @@ -92,7 +98,7 @@ function _build_hdf5() { echo "HDF5 Build failed" exit 1 fi - echo "HDF5 built" + echo "HDF5 built" } function _build_petsc() { @@ -109,33 +115,36 @@ function _build_petsc() { tar -xf petsc-3.19.3.tar.gz -C . cd petsc-3.19.3 || exit 1 ./configure \ - --with-cc=$CC --with-cxx=$CXX --with-fc=$FC -CXXPP=cpp \ - --prefix="${WORKDIR}"/${PETSC_DIR_NAME} \ - --download-hypre=1 \ - --with-shared-libraries \ - --with-debugging=no \ - --with-hdf5-dir="${WORKDIR}"/${HDF5_DIR_NAME} \ - --with-blaslapack-dir="${MKLROOT}" \ - --download-metis=1 \ - --download-parmetis=1 \ - --download-ptscotch=1 \ - --download-mumps=1 \ - --download-superlu_dist="${WORKDIR}"/superlu_dist-8.1.0.tar.gz \ - --download-scalapack=1 \ - --download-slepc=1 \ - --with-mpi=1 \ - --with-cxx-dialect=C++17 \ - --with-fortran-bindings=0 \ - --with-sowing=0 \ - --with-64-bit-indices \ - --with-make-np="${SLURM_NTASKS}" \ - COPTFLAGS='-O3 -fno-slp-vectorize' \ - CXXOPTFLAGS='-O3 -fno-slp-vectorize' \ + --with-cc=$CC --with-cxx=$CXX --with-fc=$FC -CXXPP=cpp \ + --prefix="${WORKDIR}"/${PETSC_DIR_NAME} \ + --download-hypre=1 \ + --with-shared-libraries \ + --with-debugging=no \ + --with-hdf5-dir="${WORKDIR}"/${HDF5_DIR_NAME} \ + --with-blaslapack-dir="${MKLROOT}" \ + --download-metis=1 \ + --download-parmetis=1 \ + --download-ptscotch=1 \ + --download-mumps=1 \ + --download-superlu_dist="${WORKDIR}"/superlu_dist-8.1.0.tar.gz \ + --download-scalapack=1 \ + --download-slepc=1 \ + --with-mpi=1 \ + --with-cxx-dialect=C++17 \ + --with-fortran-bindings=0 \ + --with-sowing=0 \ + --with-64-bit-indices \ + --with-make-np="${SLURM_NTASKS}" \ + COPTFLAGS='-O3 -fno-slp-vectorize' \ + CXXOPTFLAGS='-O3 -fno-slp-vectorize' \ FOPTFLAGS='-O3 -fno-slp-vectorize' \ - PETSC_DIR=$(pwd) PETSC_ARCH=arch-linux-c-opt + PETSC_DIR=$(pwd) PETSC_ARCH=arch-linux-c-opt make - make PETSC_DIR="${WORKDIR}"/${PETSC_DIR_NAME}/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install \ - || { echo "Failed to build petsc" ; exit 1 ; } + make PETSC_DIR="${WORKDIR}"/${PETSC_DIR_NAME}/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install || + { + echo "Failed to build petsc" + exit 1 + } cd .. cd .. export PETSC_DIR=$WORKDIR/petsc @@ -150,10 +159,13 @@ function build_moose() { cd "$WORKDIR" || exit 1 git clone https://github.com/idaholab/moose cd moose || exit 1 - git checkout ${MOOSE_COMMIT} || { echo "Checkout failed" ; exit 1 ; } - if [ ! -f "$WORKDIR/petsc/lib/libpetsc.so" ] ; then - echo "PETSc Install Unsuccessful" - return + git checkout ${MOOSE_COMMIT} || { + echo "Checkout failed" + exit 1 + } + if [ ! -f "$WORKDIR/petsc/lib/libpetsc.so" ]; then + echo "PETSc Install Unsuccessful" + return fi export PETSC_DIR=$WORKDIR/petsc export PETSC_ARCH=arch-linux-c-opt @@ -195,7 +207,7 @@ function build_moose() { export I_MPI_F90=ifx export I_MPI_F77=ifx export I_MPI_C=icx - + ./configure --with-derivative-size=200 --with-ad-indexing-type=global METHODS='opt' ./scripts/update_and_rebuild_wasp.sh cd framework || exit 1 @@ -213,8 +225,8 @@ function build_moose() { function build_gslib() { cd "$WORKDIR" || exit 1 - if [ -d "$WORKDIR/gslb" ] ; then - return + if [ -d "$WORKDIR/gslb" ]; then + return fi git clone https://github.com/Nek5000/gslib.git cd gslib || exit 1 @@ -235,9 +247,9 @@ function build_mfem() { echo "Building MFEM" cmake .. \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_POSITION_INDEPENDENT_CODE=YES \ - -DMFEM_USE_OPENMP=NO \ - -DMFEM_THREAD_SAFE=NO \ + -DCMAKE_POSITION_INDEPENDENT_CODE=YES \ + -DMFEM_USE_OPENMP=NO \ + -DMFEM_THREAD_SAFE=NO \ -DHYPRE_DIR=/"$WORKDIR"/petsc/ \ -DMFEM_USE_LAPACK=YES \ -DMFEM_USE_MPI=YES \ diff --git a/scripts/install-format-hook.sh b/scripts/install-format-hook.sh index 004318a2..27f45815 100755 --- a/scripts/install-format-hook.sh +++ b/scripts/install-format-hook.sh @@ -1,6 +1,6 @@ #!/bin/bash -REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../" +REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd)/../" hookfile="$REPO_DIR/.git/hooks/pre-commit" if [[ -f $hookfile ]]; then @@ -23,4 +23,3 @@ fi ' > "$hookfile" chmod a+x "$hookfile" - diff --git a/scripts/upload-coverage.sh b/scripts/upload-coverage.sh index 7157dc51..8fbbabde 100755 --- a/scripts/upload-coverage.sh +++ b/scripts/upload-coverage.sh @@ -2,9 +2,8 @@ cd /opt/platypus || exit 1 -for filename in $(find build -name "*.C"); -do - gcov -n -o . "$filename" > /dev/null; +for filename in $(find build -name "*.C"); do + gcov -n -o . "$filename" > /dev/null done bash <(curl -s https://codecov.io/bash) diff --git a/unit/run_tests b/unit/run_tests index f79debb7..8c95970b 100755 --- a/unit/run_tests +++ b/unit/run_tests @@ -3,16 +3,14 @@ APPLICATION_NAME=platypus # If $METHOD is not set, use opt if [ -z $METHOD ]; then - export METHOD=opt + export METHOD=opt fi -if [ -e ./unit/$APPLICATION_NAME-unit-$METHOD ] -then - ./unit/$APPLICATION_NAME-unit-$METHOD -elif [ -e ./$APPLICATION_NAME-unit-$METHOD ] -then - ./$APPLICATION_NAME-unit-$METHOD +if [ -e ./unit/$APPLICATION_NAME-unit-$METHOD ]; then + ./unit/$APPLICATION_NAME-unit-$METHOD +elif [ -e ./$APPLICATION_NAME-unit-$METHOD ]; then + ./$APPLICATION_NAME-unit-$METHOD else - echo "Executable missing!" - exit 1 + echo "Executable missing!" + exit 1 fi From 6b66e2bfe659b222b240ffc85e3e5922acd34775 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 19:03:03 +0100 Subject: [PATCH 15/26] Applied clang-format --- test/include/base/PlatypusTestApp.h | 1 - 1 file changed, 1 deletion(-) diff --git a/test/include/base/PlatypusTestApp.h b/test/include/base/PlatypusTestApp.h index ff8133e2..82119365 100644 --- a/test/include/base/PlatypusTestApp.h +++ b/test/include/base/PlatypusTestApp.h @@ -13,4 +13,3 @@ class PlatypusTestApp : public MooseApp static void registerApps(); static void registerAll(Factory & f, ActionFactory & af, Syntax & s, bool use_test_objs = false); }; - From dc2c3af8871dc274b6bccbd3bd6666c75721f4a0 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 19:03:50 +0100 Subject: [PATCH 16/26] Ignore some unavoidable hadolint errors --- docker/platypus-deps/Dockerfile | 1 + docker/platypus/Dockerfile | 2 ++ 2 files changed, 3 insertions(+) diff --git a/docker/platypus-deps/Dockerfile b/docker/platypus-deps/Dockerfile index d6b90fcf..7188db5c 100644 --- a/docker/platypus-deps/Dockerfile +++ b/docker/platypus-deps/Dockerfile @@ -10,6 +10,7 @@ ARG WORKDIR=opt # Configure MOOSE WORKDIR /$WORKDIR +# hadolint ignore=DL3003 RUN export MOOSE_JOBS=$compile_cores && \ git clone https://github.com/idaholab/moose && \ cd moose && \ diff --git a/docker/platypus/Dockerfile b/docker/platypus/Dockerfile index cedb9970..5e0832cd 100644 --- a/docker/platypus/Dockerfile +++ b/docker/platypus/Dockerfile @@ -17,6 +17,7 @@ ARG coverage=false # Get Platypus with Hephaestus WORKDIR /$WORKDIR +# hadolint ignore=DL3003 RUN git clone https://github.com/$build_git_repo && \ cd platypus && \ git checkout $build_git_sha && \ @@ -24,6 +25,7 @@ RUN git clone https://github.com/$build_git_repo && \ # Build Hephaestus WORKDIR /$WORKDIR/platypus/contrib/hephaestus/ +# hadolint ignore=DL3003 RUN mkdir build && \ cd build && \ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DMFEM_DIR=/$WORKDIR/mfem/build .. && \ From b3b7b0ccdc25e70f3ec251828ca6643543d327a3 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 19:04:34 +0100 Subject: [PATCH 17/26] Fix YAML formatting --- .github/linters/.yaml-lint.yml | 67 ++++++++++++++++++++++++++---- .github/workflows/lint.yml | 13 +++--- .github/workflows/main.yml | 6 +-- .github/workflows/weekly_build.yml | 3 +- .pre-commit-config.yaml | 18 ++++---- 5 files changed, 79 insertions(+), 28 deletions(-) diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml index b0bc8c54..c8bf34bd 100644 --- a/.github/linters/.yaml-lint.yml +++ b/.github/linters/.yaml-lint.yml @@ -1,11 +1,62 @@ -extends: default - -ignore: - - syntax.yaml - -line-length: +--- +########################################### +# These are the rules used for # +# linting all the yaml files in the stack # +# NOTE: # +# You can disable line with: # +# # yamllint disable-line # +########################################### +rules: + braces: + level: warning + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 1 + max-spaces-inside-empty: 5 + brackets: + level: warning + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 1 + max-spaces-inside-empty: 5 + colons: + level: warning + max-spaces-before: 0 + max-spaces-after: 1 + commas: + level: warning + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: disable + comments-indentation: disable + document-end: disable + document-start: level: warning - max: 100 + present: true + empty-lines: + level: warning + max: 2 + max-start: 0 + max-end: 0 + hyphens: + level: warning + max-spaces-after: 1 + indentation: + level: warning + spaces: consistent + indent-sequences: true + check-multi-line-strings: false + key-duplicates: enable + line-length: + level: warning + max: 80 allow-non-breakable-words: true allow-non-breakable-inline-mappings: true - + new-line-at-end-of-file: disable + new-lines: + type: unix + trailing-spaces: disable + +ignore: + - syntax.yaml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 14a25bd2..b64233a8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,12 +4,12 @@ name: Lint on: push: branches: - - main + - main pull_request: branches: - - main + - main -permissions: { } +permissions: {} jobs: build: @@ -32,7 +32,9 @@ jobs: - name: Super-linter uses: super-linter/super-linter/slim@v6.6.0 - with: + env: + # To report GitHub Actions status checks + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_ANSIBLE: false VALIDATE_CHECKOV: false VALIDATE_CPP: false @@ -43,6 +45,3 @@ jobs: VALIDATE_PYTHON_MYPY: false VALIDATE_PYTHON_PYLINT: false VALIDATE_PYTHON_RUFF: false - env: - # To report GitHub Actions status checks - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 577d6be6..58586fbc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,17 +3,17 @@ name: BuildTest on: push: branches: - - main + - main pull_request: branches: - - main + - main jobs: docker-build-test-ubuntu: runs-on: ubuntu-latest name: BuildTestUbuntu env: - PRCOMMITSHA : ${{ github.event.pull_request.head.sha }} + PRCOMMITSHA: ${{ github.event.pull_request.head.sha }} PRREPOSITORY: ${{ github.event.pull_request.head.repo.full_name }} steps: # First check out the repository to get the docker file diff --git a/.github/workflows/weekly_build.yml b/.github/workflows/weekly_build.yml index cf78d9f7..1c8dbc98 100644 --- a/.github/workflows/weekly_build.yml +++ b/.github/workflows/weekly_build.yml @@ -1,9 +1,10 @@ +--- name: Publish Docker Images on: workflow_dispatch: schedule: # Schedule to update image every Monday morning at 04:00. - - cron: '00 4 * * 1' + - cron: '00 4 * * 1' jobs: push-platypus-deps-image-to-docker-hub: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 60809f66..db7a527b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ --- repos: -- repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 - hooks: - - id: clang-format + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v14.0.6 + hooks: + - id: clang-format -- repo: https://github.com/pocc/pre-commit-hooks - rev: v1.3.5 - hooks: - - id: clang-tidy - args: [-p=./build, -config-file=./.clang-tidy, --warnings-as-errors=*, -extra-arg=-std=c++17, -extra-arg=-stdlib=libstdc++] + - repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + hooks: + - id: clang-tidy + args: [-p=./build, -config-file=./.clang-tidy, --warnings-as-errors=*, -extra-arg=-std=c++17, -extra-arg=-stdlib=libstdc++] From 40e5b30937dbda59d73a95ad629f1d2fce910a6d Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 19:05:23 +0100 Subject: [PATCH 18/26] Fixed very long line --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ea27f3e1..faf018b8 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Platypus ![build](https://github.com/aurora-multiphysics/platypus/actions/workflows/main.yml/badge.svg?branch=main) [![GitHub License](https://img.shields.io/github/license/aurora-multiphysics/platypus)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) -Platypus is a MOOSE-based application created to enable custom MOOSE problems to be set up and solved using the [MFEM](https://github.com/mfem/mfem) finite element library as an alternative backend to libMesh. It is based off of the MOOSE electromagnetics app [Apollo](https://github.com/aurora-multiphysics/apollo) that uses MFEM for solving electromagnetics problems in a variety of formulations. +Platypus is a MOOSE-based application created to enable custom MOOSE +problems to be set up and solved using the +[MFEM](https://github.com/mfem/mfem) finite element library as an +alternative backend to libMesh. It is based off of the MOOSE +electromagnetics app +[Apollo](https://github.com/aurora-multiphysics/apollo) that uses MFEM +for solving electromagnetics problems in a variety of formulations. Platypus is under active development and is being updated frequently. From a3d9408b40fb6b68be91c5e4890b041b38e6930a Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 19:18:05 +0100 Subject: [PATCH 19/26] Fixed a few more YAML formatting errors --- .github/linters/.yaml-lint.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/main.yml | 3 ++- .pre-commit-config.yaml | 7 ++++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml index c8bf34bd..4c44381e 100644 --- a/.github/linters/.yaml-lint.yml +++ b/.github/linters/.yaml-lint.yml @@ -50,7 +50,7 @@ rules: key-duplicates: enable line-length: level: warning - max: 80 + max: 100 allow-non-breakable-words: true allow-non-breakable-inline-mappings: true new-line-at-end-of-file: disable diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b64233a8..c1356c40 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,7 +9,7 @@ on: branches: - main -permissions: {} +permissions: { } jobs: build: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58586fbc..48311070 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,4 +33,5 @@ jobs: run: | ci_env=$(bash <(curl -s https://codecov.io/env)) # shellcheck disable=SC2086 - docker run $ci_env -e CI=true ci-platypus-ubuntu:latest bash /opt/platypus/scripts/upload-coverage.sh + docker run $ci_env -e CI=true ci-platypus-ubuntu:latest \ + bash /opt/platypus/scripts/upload-coverage.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db7a527b..4cd0ef39 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,4 +9,9 @@ repos: rev: v1.3.5 hooks: - id: clang-tidy - args: [-p=./build, -config-file=./.clang-tidy, --warnings-as-errors=*, -extra-arg=-std=c++17, -extra-arg=-stdlib=libstdc++] + args: + - "-p=./build" + - "-config-file=./.clang-tidy" + - "--warnings-as-errors=*" + - "-extra-arg=-std=c++17" + - "-extra-arg=-stdlib=libstdc++" From b2fe79c9e354e36bb912efd84e86b0b3c788f686 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 19:43:16 +0100 Subject: [PATCH 20/26] Fixed remaining shellcheck errors --- .github/workflows/lint.yml | 1 - scripts/build-platypus-csd3-cclake.sh | 8 +++++--- scripts/build-platypus-csd3-sapphire.sh | 14 +++++++------- scripts/upload-coverage.sh | 3 ++- unit/run_tests | 8 ++++---- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c1356c40..ce30aa9f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,7 +33,6 @@ jobs: - name: Super-linter uses: super-linter/super-linter/slim@v6.6.0 env: - # To report GitHub Actions status checks GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_ANSIBLE: false VALIDATE_CHECKOV: false diff --git a/scripts/build-platypus-csd3-cclake.sh b/scripts/build-platypus-csd3-cclake.sh index 9b51d8ef..226bfeba 100755 --- a/scripts/build-platypus-csd3-cclake.sh +++ b/scripts/build-platypus-csd3-cclake.sh @@ -1,8 +1,10 @@ #!/bin/bash #set -ue -export STACK_SRC=$(mktemp -d /tmp/moose_stack_src.XXXXXX) -export WORKDIR=$(pwd) +STACK_SRC=$(mktemp -d /tmp/moose_stack_src.XXXXXX) +export STACK_SRC +WORKDIR=$(pwd) +export WORKDIR export compile_cores=32 export OMPI_MCA_mca_base_component_show_load_errors=0 @@ -46,7 +48,7 @@ function build_petsc() { --download-slepc=1 \ --with-64-bit-indices=1 \ --with-mpi-dir=/usr/local/Cluster-Apps/openmpi/gcc/9.3/4.0.4 \ - PETSC_DIR=$(pwd) PETSC_ARCH=arch-linux-c-opt + PETSC_DIR="$(pwd)" PETSC_ARCH=arch-linux-c-opt make make PETSC_DIR="$WORKDIR"/petsc/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install make PETSC_DIR="$WORKDIR"/petsc PETSC_ARCH="" check diff --git a/scripts/build-platypus-csd3-sapphire.sh b/scripts/build-platypus-csd3-sapphire.sh index e4f5819c..d4644414 100755 --- a/scripts/build-platypus-csd3-sapphire.sh +++ b/scripts/build-platypus-csd3-sapphire.sh @@ -8,6 +8,7 @@ #SBATCH --cpus-per-task=1 #SBATCH -o out_%j_%A_%a #SBATCH --exclusive +# shellcheck source=/dev/null . /etc/profile.d/modules.sh #TODO: @@ -25,8 +26,10 @@ function load_modules() { module load python/3.8 module load ninja - export STACK_SRC=$(mktemp -d /tmp/moose_stack_src.XXXXXX) - export WORKDIR=$(pwd) + STACK_SRC=$(mktemp -d /tmp/moose_stack_src.XXXXXX) + export STACK_SRC + WORKDIR=$(pwd) + export WORKDIR export compile_cores=8 export OMPI_MCA_mca_base_component_show_load_errors=0 @@ -35,16 +38,13 @@ function load_modules() { ROOT_PATH=/home/${USER}/rds/rds-ukaea-ap001/${USER} BUILD_PATH=${ROOT_PATH}/${BUILD_DIR_NAME} - USR_PATH=${BUILD_PATH}/usr HDF5_MAJ_VER=1.10 HDF5_MIN_VER=10 HDF5_DIR_NAME=hdf5 HDF5_INSTALL_PATH=${WORKDIR}/${HDF5_DIR_NAME} - PETSC_COMMIT=38aca504f6ea08cc814f159b2c9bcf837a5876f3 PETSC_DIR_NAME=petsc - PETSC_INSTALL_DIR=${BUILD_PATH}/petsc MOOSE_COMMIT=4e99faf9804480e7be302895ff9b8ded5b9944ea @@ -116,7 +116,7 @@ function _build_petsc() { cd petsc-3.19.3 || exit 1 ./configure \ --with-cc=$CC --with-cxx=$CXX --with-fc=$FC -CXXPP=cpp \ - --prefix="${WORKDIR}"/${PETSC_DIR_NAME} \ + --prefix="${WORKDIR}/${PETSC_DIR_NAME}" \ --download-hypre=1 \ --with-shared-libraries \ --with-debugging=no \ @@ -138,7 +138,7 @@ function _build_petsc() { COPTFLAGS='-O3 -fno-slp-vectorize' \ CXXOPTFLAGS='-O3 -fno-slp-vectorize' \ FOPTFLAGS='-O3 -fno-slp-vectorize' \ - PETSC_DIR=$(pwd) PETSC_ARCH=arch-linux-c-opt + PETSC_DIR="$(pwd)" PETSC_ARCH=arch-linux-c-opt make make PETSC_DIR="${WORKDIR}"/${PETSC_DIR_NAME}/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install || { diff --git a/scripts/upload-coverage.sh b/scripts/upload-coverage.sh index 8fbbabde..a3a33d23 100755 --- a/scripts/upload-coverage.sh +++ b/scripts/upload-coverage.sh @@ -2,7 +2,8 @@ cd /opt/platypus || exit 1 -for filename in $(find build -name "*.C"); do +for filename in build/**/*.C +do gcov -n -o . "$filename" > /dev/null done diff --git a/unit/run_tests b/unit/run_tests index 8c95970b..e0132af4 100755 --- a/unit/run_tests +++ b/unit/run_tests @@ -2,14 +2,14 @@ APPLICATION_NAME=platypus # If $METHOD is not set, use opt -if [ -z $METHOD ]; then +if [ -z "$METHOD" ]; then export METHOD=opt fi -if [ -e ./unit/$APPLICATION_NAME-unit-$METHOD ]; then +if [ -e ./unit/"$APPLICATION_NAME"-unit-"$METHOD" ]; then ./unit/$APPLICATION_NAME-unit-$METHOD -elif [ -e ./$APPLICATION_NAME-unit-$METHOD ]; then - ./$APPLICATION_NAME-unit-$METHOD +elif [ -e ./"$APPLICATION_NAME"-unit-"$METHOD" ]; then + ./"$APPLICATION_NAME"-unit-"$METHOD" else echo "Executable missing!" exit 1 From 629534660f009ec0335cca0d81a8aa32394c0d98 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 20:06:46 +0100 Subject: [PATCH 21/26] Fixed a few more formatting errors in bash script --- scripts/build-platypus-csd3-sapphire.sh | 46 ++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/scripts/build-platypus-csd3-sapphire.sh b/scripts/build-platypus-csd3-sapphire.sh index d4644414..6873ebb2 100755 --- a/scripts/build-platypus-csd3-sapphire.sh +++ b/scripts/build-platypus-csd3-sapphire.sh @@ -116,29 +116,29 @@ function _build_petsc() { cd petsc-3.19.3 || exit 1 ./configure \ --with-cc=$CC --with-cxx=$CXX --with-fc=$FC -CXXPP=cpp \ - --prefix="${WORKDIR}/${PETSC_DIR_NAME}" \ - --download-hypre=1 \ - --with-shared-libraries \ - --with-debugging=no \ - --with-hdf5-dir="${WORKDIR}"/${HDF5_DIR_NAME} \ - --with-blaslapack-dir="${MKLROOT}" \ - --download-metis=1 \ - --download-parmetis=1 \ - --download-ptscotch=1 \ - --download-mumps=1 \ - --download-superlu_dist="${WORKDIR}"/superlu_dist-8.1.0.tar.gz \ - --download-scalapack=1 \ - --download-slepc=1 \ - --with-mpi=1 \ - --with-cxx-dialect=C++17 \ - --with-fortran-bindings=0 \ - --with-sowing=0 \ - --with-64-bit-indices \ - --with-make-np="${SLURM_NTASKS}" \ - COPTFLAGS='-O3 -fno-slp-vectorize' \ - CXXOPTFLAGS='-O3 -fno-slp-vectorize' \ - FOPTFLAGS='-O3 -fno-slp-vectorize' \ - PETSC_DIR="$(pwd)" PETSC_ARCH=arch-linux-c-opt + --prefix="${WORKDIR}/${PETSC_DIR_NAME}" \ + --download-hypre=1 \ + --with-shared-libraries \ + --with-debugging=no \ + --with-hdf5-dir="${WORKDIR}"/${HDF5_DIR_NAME} \ + --with-blaslapack-dir="${MKLROOT}" \ + --download-metis=1 \ + --download-parmetis=1 \ + --download-ptscotch=1 \ + --download-mumps=1 \ + --download-superlu_dist="${WORKDIR}"/superlu_dist-8.1.0.tar.gz \ + --download-scalapack=1 \ + --download-slepc=1 \ + --with-mpi=1 \ + --with-cxx-dialect=C++17 \ + --with-fortran-bindings=0 \ + --with-sowing=0 \ + --with-64-bit-indices \ + --with-make-np="${SLURM_NTASKS}" \ + COPTFLAGS='-O3 -fno-slp-vectorize' \ + CXXOPTFLAGS='-O3 -fno-slp-vectorize' \ + FOPTFLAGS='-O3 -fno-slp-vectorize' \ + PETSC_DIR="$(pwd)" PETSC_ARCH=arch-linux-c-opt make make PETSC_DIR="${WORKDIR}"/${PETSC_DIR_NAME}/petsc-3.19.3 PETSC_ARCH=arch-linux-c-opt install || { From f4f1027aa1a6f1d30be5cc66a24c5f7839d336c6 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 20:07:01 +0100 Subject: [PATCH 22/26] Build with coverage flags --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 48311070..3dcf8ea2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,6 +28,7 @@ jobs: docker build -t ci-platypus-ubuntu \ --build-arg build_git_sha="${PRCOMMITSHA:-$GITHUB_SHA}" \ --build-arg build_git_repo="${PRREPOSITORY:-$GITHUB_REPOSITORY}" \ + --build-arg coverage=true \ docker/platypus - name: UploadCoverage run: | From 662d4edba7bd30f1014d65570fa32b8e2516f5ce Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Fri, 7 Jun 2024 20:43:59 +0100 Subject: [PATCH 23/26] Added pre-commit hooks for same linters as used in CI --- .github/linters/.markdown-lint.yml | 36 +---------------- .github/linters/.yaml-lint.yml | 63 +----------------------------- .markdownlint.yml | 35 +++++++++++++++++ .pre-commit-config.yaml | 61 ++++++++++++++++++++++++----- .yamllint.yml | 62 +++++++++++++++++++++++++++++ 5 files changed, 150 insertions(+), 107 deletions(-) mode change 100644 => 120000 .github/linters/.markdown-lint.yml mode change 100644 => 120000 .github/linters/.yaml-lint.yml create mode 100644 .markdownlint.yml create mode 100644 .yamllint.yml diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml deleted file mode 100644 index a694d1b7..00000000 --- a/.github/linters/.markdown-lint.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -########################### -########################### -## Markdown Linter rules ## -########################### -########################### - -# Linter rules doc: -# - https://github.com/DavidAnson/markdownlint -# -# Note: -# To comment out a single error: -# -# any violations you want -# -# - -############### -# Rules by id # -############### -MD004: false # Unordered list style -MD007: - indent: 2 # Unordered list indentation -MD013: - line_length: 100 # Line length 80 is far too short -MD026: - punctuation: ".,;:!。,;:" # List of not allowed -MD029: false # Ordered list item prefix -MD033: false # Allow inline HTML -MD041: false # Allow MOOSE configuration data before first heading - -################# -# Rules by tags # -################# -blank_lines: false # Error on blank lines diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml new file mode 120000 index 00000000..7e62b3d9 --- /dev/null +++ b/.github/linters/.markdown-lint.yml @@ -0,0 +1 @@ +../../.markdownlint.yml \ No newline at end of file diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml deleted file mode 100644 index 4c44381e..00000000 --- a/.github/linters/.yaml-lint.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -########################################### -# These are the rules used for # -# linting all the yaml files in the stack # -# NOTE: # -# You can disable line with: # -# # yamllint disable-line # -########################################### -rules: - braces: - level: warning - min-spaces-inside: 0 - max-spaces-inside: 0 - min-spaces-inside-empty: 1 - max-spaces-inside-empty: 5 - brackets: - level: warning - min-spaces-inside: 0 - max-spaces-inside: 0 - min-spaces-inside-empty: 1 - max-spaces-inside-empty: 5 - colons: - level: warning - max-spaces-before: 0 - max-spaces-after: 1 - commas: - level: warning - max-spaces-before: 0 - min-spaces-after: 1 - max-spaces-after: 1 - comments: disable - comments-indentation: disable - document-end: disable - document-start: - level: warning - present: true - empty-lines: - level: warning - max: 2 - max-start: 0 - max-end: 0 - hyphens: - level: warning - max-spaces-after: 1 - indentation: - level: warning - spaces: consistent - indent-sequences: true - check-multi-line-strings: false - key-duplicates: enable - line-length: - level: warning - max: 100 - allow-non-breakable-words: true - allow-non-breakable-inline-mappings: true - new-line-at-end-of-file: disable - new-lines: - type: unix - trailing-spaces: disable - -ignore: - - syntax.yaml diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml new file mode 120000 index 00000000..54a3654b --- /dev/null +++ b/.github/linters/.yaml-lint.yml @@ -0,0 +1 @@ +../../.yamllint.yml \ No newline at end of file diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 00000000..a694d1b7 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,35 @@ +--- +########################### +########################### +## Markdown Linter rules ## +########################### +########################### + +# Linter rules doc: +# - https://github.com/DavidAnson/markdownlint +# +# Note: +# To comment out a single error: +# +# any violations you want +# +# + +############### +# Rules by id # +############### +MD004: false # Unordered list style +MD007: + indent: 2 # Unordered list indentation +MD013: + line_length: 100 # Line length 80 is far too short +MD026: + punctuation: ".,;:!。,;:" # List of not allowed +MD029: false # Ordered list item prefix +MD033: false # Allow inline HTML +MD041: false # Allow MOOSE configuration data before first heading + +################# +# Rules by tags # +################# +blank_lines: false # Error on blank lines diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4cd0ef39..2e66799f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,13 +5,54 @@ repos: hooks: - id: clang-format - - repo: https://github.com/pocc/pre-commit-hooks - rev: v1.3.5 - hooks: - - id: clang-tidy - args: - - "-p=./build" - - "-config-file=./.clang-tidy" - - "--warnings-as-errors=*" - - "-extra-arg=-std=c++17" - - "-extra-arg=-stdlib=libstdc++" + # - repo: https://github.com/pocc/pre-commit-hooks + # rev: v1.3.5 + # hooks: + # - id: clang-tidy + # args: + # - "-p=./build" + # - "-config-file=./.clang-tidy" + # - "--warnings-as-errors=*" + # - "-extra-arg=-std=c++17" + # - "-extra-arg=-stdlib=libstdc++" + + - repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: 2.7.3 + hooks: + - id: editorconfig-checker + alias: ec + + - repo: https://github.com/scop/pre-commit-shfmt + rev: v3.8.0-1 + hooks: + - id: shfmt + + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck + + - repo: https://github.com/hadolint/hadolint + rev: v2.12.0 + hooks: + - id: hadolint + + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.41.0 + hooks: + - id: markdownlint-fix + + - repo: https://github.com/rhysd/actionlint + rev: v1.7.1 + hooks: + - id: actionlint + + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + + - repo: https://github.com/gitleaks/gitleaks + rev: v8.16.1 + hooks: + - id: gitleaks diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 00000000..4c44381e --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,62 @@ +--- +########################################### +# These are the rules used for # +# linting all the yaml files in the stack # +# NOTE: # +# You can disable line with: # +# # yamllint disable-line # +########################################### +rules: + braces: + level: warning + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 1 + max-spaces-inside-empty: 5 + brackets: + level: warning + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 1 + max-spaces-inside-empty: 5 + colons: + level: warning + max-spaces-before: 0 + max-spaces-after: 1 + commas: + level: warning + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: disable + comments-indentation: disable + document-end: disable + document-start: + level: warning + present: true + empty-lines: + level: warning + max: 2 + max-start: 0 + max-end: 0 + hyphens: + level: warning + max-spaces-after: 1 + indentation: + level: warning + spaces: consistent + indent-sequences: true + check-multi-line-strings: false + key-duplicates: enable + line-length: + level: warning + max: 100 + allow-non-breakable-words: true + allow-non-breakable-inline-mappings: true + new-line-at-end-of-file: disable + new-lines: + type: unix + trailing-spaces: disable + +ignore: + - syntax.yaml From 4249c1248b42a608870df0e7025015cbe85e98d2 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Mon, 10 Jun 2024 13:26:10 +0100 Subject: [PATCH 24/26] Fixed remaining issues with pre-commit hooks/linting --- .editorconfig | 11 +++++++++-- .pre-commit-config.yaml | 14 ++++++++++---- scripts/install-format-hook.sh | 7 ++++--- scripts/upload-coverage.sh | 3 +-- unit/run_tests | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.editorconfig b/.editorconfig index cae7cdab..4c9b9224 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,13 @@ -[{*.sh,run_tests}] +[*.sh] indent_style = space indent_size = 4 space_redirects = true keep_padding = true -never_split = true \ No newline at end of file +never_split = true + +[unit/run_tests] +indent_style = space +indent_size = 4 +space_redirects = true +keep_padding = true +never_split = true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2e66799f..e0d6aa26 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,6 +5,7 @@ repos: hooks: - id: clang-format + # Not yet figured out how to configure this properly # - repo: https://github.com/pocc/pre-commit-hooks # rev: v1.3.5 # hooks: @@ -32,11 +33,16 @@ repos: hooks: - id: shellcheck - - repo: https://github.com/hadolint/hadolint - rev: v2.12.0 - hooks: - - id: hadolint + # Hadolint isn't trivial to install + # - repo: https://github.com/hadolint/hadolint + # rev: v2.12.0 + # hooks: + # - id: hadolint + # Note: needs node.js >= 18, which is more recent than version + # distributed with Ubuntu 22.4. The latest versions of node.js can + # be installed using the instructions at + # https://github.com/nodesource/distributions?tab=readme-ov-file#debian-and-ubuntu-based-distributions - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.41.0 hooks: diff --git a/scripts/install-format-hook.sh b/scripts/install-format-hook.sh index 27f45815..86e1958a 100755 --- a/scripts/install-format-hook.sh +++ b/scripts/install-format-hook.sh @@ -1,6 +1,6 @@ #!/bin/bash -REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd)/../" +REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../" hookfile="$REPO_DIR/.git/hooks/pre-commit" if [[ -f $hookfile ]]; then @@ -8,7 +8,8 @@ if [[ -f $hookfile ]]; then exit 1 fi -echo '#!/bin/bash +cat << 'EOF' > "$hookfile" +#!/bin/bash patch=$(git clang-format --diff -- $(git diff --staged --name-only -- src include tests unit)) if [[ "$patch" =~ "no modified files to format" || "$patch" =~ "clang-format did not modify any files" ]]; then echo "" > /dev/null @@ -20,6 +21,6 @@ else echo "$patch" exit 1 fi -' > "$hookfile" +EOF chmod a+x "$hookfile" diff --git a/scripts/upload-coverage.sh b/scripts/upload-coverage.sh index a3a33d23..99843299 100755 --- a/scripts/upload-coverage.sh +++ b/scripts/upload-coverage.sh @@ -2,8 +2,7 @@ cd /opt/platypus || exit 1 -for filename in build/**/*.C -do +for filename in build/**/*.C; do gcov -n -o . "$filename" > /dev/null done diff --git a/unit/run_tests b/unit/run_tests index e0132af4..2fef62c7 100755 --- a/unit/run_tests +++ b/unit/run_tests @@ -7,7 +7,7 @@ if [ -z "$METHOD" ]; then fi if [ -e ./unit/"$APPLICATION_NAME"-unit-"$METHOD" ]; then - ./unit/$APPLICATION_NAME-unit-$METHOD + ./unit/"$APPLICATION_NAME"-unit-"$METHOD" elif [ -e ./"$APPLICATION_NAME"-unit-"$METHOD" ]; then ./"$APPLICATION_NAME"-unit-"$METHOD" else From 74127010ada110e653592ecfda12beee0dff1479 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Tue, 11 Jun 2024 15:55:06 +0100 Subject: [PATCH 25/26] Trying (yet again) to upload to codecov --- .github/workflows/main.yml | 2 ++ scripts/upload-coverage.sh | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3dcf8ea2..65fa04a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,3 +36,5 @@ jobs: # shellcheck disable=SC2086 docker run $ci_env -e CI=true ci-platypus-ubuntu:latest \ bash /opt/platypus/scripts/upload-coverage.sh + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/scripts/upload-coverage.sh b/scripts/upload-coverage.sh index 99843299..980963ef 100755 --- a/scripts/upload-coverage.sh +++ b/scripts/upload-coverage.sh @@ -1,9 +1,4 @@ #!/bin/bash cd /opt/platypus || exit 1 - -for filename in build/**/*.C; do - gcov -n -o . "$filename" > /dev/null -done - bash <(curl -s https://codecov.io/bash) From 915351c66669518dfc8cbb3aa944eeca534d1a54 Mon Sep 17 00:00:00 2001 From: Chris MacMackin Date: Wed, 12 Jun 2024 11:25:56 +0100 Subject: [PATCH 26/26] Added two more badges --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index faf018b8..d2f13404 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ Platypus ===== +![lint](https://github.com/aurora-multiphysics/platypus/actions/workflows/lint.yml/badge.svg?branch=main) ![build](https://github.com/aurora-multiphysics/platypus/actions/workflows/main.yml/badge.svg?branch=main) +[![codecov](https://codecov.io/gh/aurora-multiphysics/platypus/graph/badge.svg?token=WV2DE9DT53)](https://codecov.io/gh/aurora-multiphysics/platypus) [![GitHub License](https://img.shields.io/github/license/aurora-multiphysics/platypus)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) Platypus is a MOOSE-based application created to enable custom MOOSE