diff --git a/.github/problem-matchers.json b/.github/problem-matchers.json new file mode 100644 index 00000000..8b10ca54 --- /dev/null +++ b/.github/problem-matchers.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "gcc", + "pattern": [ + { + "regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + ] + } + ] +} \ No newline at end of file diff --git a/.github/workflows/Ubuntu.yml b/.github/workflows/Ubuntu.yml new file mode 100644 index 00000000..135e36e0 --- /dev/null +++ b/.github/workflows/Ubuntu.yml @@ -0,0 +1,121 @@ +# Guidance: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions +# Compile project on Ubuntu +name: Ubuntu + +on: + # Branch pushes that do not only modify other workflow files + push: + branches: + - '**' + paths: + - "**" + - "!.github/**" + - ".github/workflows/Ubuntu.yml" + # Pull requests to main, that do not only modify other workflow files + pull_request: + branches: + - 'master' + paths: + - "**" + - "!.github/**" + - ".github/workflows/Ubuntu.yml" + # Allow manual invocation. + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ${{ matrix.cxx.os }} + strategy: + fail-fast: false + # Multiplicative build matrix + # optional exclude: can be partial, include: must be specific + matrix: + cxx: + - compiler: gcc-12 + os: ubuntu-22.04 + - compiler: gcc-11 + os: ubuntu-22.04 + - compiler: gcc-10 + os: ubuntu-22.04 + config: + - name: "Release" + config: "Release" + - name: "Debug" + config: "Debug" + # exclude: + exclude: + # Exclude Debug for old GCC + - cxx: + compiler: gcc-11 + config: + name: "Debug" + - cxx: + compiler: gcc-10 + config: + name: "Debug" + + # Name the job based on matrix/env options + name: "build (${{ matrix.cxx.compiler }}, ${{ matrix.config.name }}, ${{ matrix.cxx.os }})" + + # Define job-wide env constants, and promote matrix elements to env constants for portable steps. + env: + # Workflow specific constants for building a specific example + # Compute the output name which should be unique within the matrix. This must be unique per build matrix/job combination + ARTIFACT_NAME_FFEA: ffea-${{ matrix.cxx.os }}-${{ matrix.cxx.compiler }}-${{ matrix.config.name }} + ARTIFACT_NAME_FFEAMB: ffea_mb-${{ matrix.cxx.os }}-${{ matrix.cxx.compiler }}-${{ matrix.config.name }} + # Define constants + BUILD_DIR: "build" + COMPILER: ${{ matrix.cxx.compiler }} + OS: ${{ matrix.cxx.os }} + CONFIG: ${{ matrix.config.config }} + + # What the CI actually runs + steps: + - uses: actions/checkout@v4 + + - name: Install/Select gcc and g++ + if: ${{ startsWith(env.COMPILER, 'gcc-') }} + run: | + gcc_version=${COMPILER//gcc-/} + sudo apt-get install -y gcc-${gcc_version} g++-${gcc_version} + echo "CC=/usr/bin/gcc-${gcc_version}" >> $GITHUB_ENV + echo "CXX=/usr/bin/g++-${gcc_version}" >> $GITHUB_ENV + + # Problem matchers allow compilation warnings/errors to be highlighted on GitHub + - name: Add custom problem matchers for annotations + run: echo "::add-matcher::.github/problem-matchers.json" + + - name: Configure cmake + run: > + cmake . -B "${{ env.BUILD_DIR }}" + -DCMAKE_BUILD_TYPE="${{ env.CONFIG }}" + + - name: Build ffea + working-directory: ${{ env.BUILD_DIR }} + run: cmake --build . --verbose --parallel `nproc` + + # Upload artifacts to the job on GHA, with a short retention + # Use a unique name per job matrix run, to avoid a risk of corruption according to the docs (although it should work with unique filenames) + - name: Upload FFEA Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ARTIFACT_NAME_FFEA }} + path: ${{ env.BUILD_DIR }}/src/ffea + if-no-files-found: error + retention-days: 5 + - name: Upload FFEA_MB Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ARTIFACT_NAME_FFEAMB }} + path: ${{ env.BUILD_DIR }}/src/ffea_mb + if-no-files-found: error + retention-days: 5 + + - name: Run Tests (Slow Tests are Excluded) + if: ${{ env.CONFIG }} == "Release" + working-directory: ${{ env.BUILD_DIR }} + run: ctest -LE SLOW_TEST --output-on-failure diff --git a/tests/physics/EI_cyl_160_fine/CMakeLists.txt b/tests/physics/EI_cyl_160_fine/CMakeLists.txt index fb11233a..d325f416 100644 --- a/tests/physics/EI_cyl_160_fine/CMakeLists.txt +++ b/tests/physics/EI_cyl_160_fine/CMakeLists.txt @@ -24,10 +24,12 @@ if(Python3_EXECUTABLE) add_test(NAME cyl_flexrig COMMAND ${PROJECT_BINARY_DIR}/src/ffea cyl_160_fine-EI.ffea) set_tests_properties(cyl_flexrig PROPERTIES ENVIRONMENT OMP_NUM_THREADS=1) + set_tests_properties(cyl_flexrig PROPERTIES LABELS "SLOW_TEST") add_test(NAME cyl_flexrig_check COMMAND ${Python3_EXECUTABLE} calcEI.py) set_tests_properties(cyl_flexrig_check PROPERTIES DEPENDS cyl_flexrig ENVIRONMENT_MODIFICATION PYTHONPATH=unset: ENVIRONMENT_MODIFICATION PYTHONHOME=unset:) + set_tests_properties(cyl_flexrig_check PROPERTIES LABELS "SLOW_TEST") endif() diff --git a/tests/physics/E_cyl_160_fine/CMakeLists.txt b/tests/physics/E_cyl_160_fine/CMakeLists.txt index 6bbf6390..19fec47a 100644 --- a/tests/physics/E_cyl_160_fine/CMakeLists.txt +++ b/tests/physics/E_cyl_160_fine/CMakeLists.txt @@ -25,9 +25,11 @@ if(Python3_EXECUTABLE) add_test(NAME cyl_youngs_mod COMMAND ${PROJECT_BINARY_DIR}/src/ffea cyl_160_fine-E.ffea) set_tests_properties(cyl_youngs_mod PROPERTIES ENVIRONMENT OMP_NUM_THREADS=1) +set_tests_properties(cyl_youngs_mod PROPERTIES LABELS "SLOW_TEST") add_test(NAME cyl_youngs_mod_check COMMAND ${Python3_EXECUTABLE} calcE.py) set_tests_properties(cyl_youngs_mod_check PROPERTIES DEPENDS cyl_youngs_mod ENVIRONMENT_MODIFICATION PYTHONPATH=unset: ENVIRONMENT_MODIFICATION PYTHONHOME=unset:) +set_tests_properties(cyl_youngs_mod_check PROPERTIES LABELS "SLOW_TEST") endif() \ No newline at end of file diff --git a/tests/physics/sphere_63_120_mass/CMakeLists.txt b/tests/physics/sphere_63_120_mass/CMakeLists.txt index 2b2c29fe..6eefa161 100644 --- a/tests/physics/sphere_63_120_mass/CMakeLists.txt +++ b/tests/physics/sphere_63_120_mass/CMakeLists.txt @@ -24,6 +24,8 @@ if(Python3_EXECUTABLE) add_test(NAME sphere_mass COMMAND ${PROJECT_BINARY_DIR}/src/ffea sphere_63_120_mass.ffea) set_tests_properties(sphere_mass PROPERTIES ENVIRONMENT OMP_NUM_THREADS=1) + set_tests_properties(sphere_mass PROPERTIES LABELS "SLOW_TEST") add_test(NAME sphere_mass_check COMMAND ${Python3_EXECUTABLE} testAverages.py) set_tests_properties(sphere_mass_check PROPERTIES DEPENDS sphere_mass ENVIRONMENT_MODIFICATION PYTHONPATH=unset: ENVIRONMENT_MODIFICATION PYTHONHOME=unset:) + set_tests_properties(sphere_mass_check PROPERTIES LABELS "SLOW_TEST") endif() diff --git a/tests/physics/sphere_63_120_nomass/CMakeLists.txt b/tests/physics/sphere_63_120_nomass/CMakeLists.txt index b37f4dc8..cae4eaa4 100644 --- a/tests/physics/sphere_63_120_nomass/CMakeLists.txt +++ b/tests/physics/sphere_63_120_nomass/CMakeLists.txt @@ -25,8 +25,10 @@ if(Python3_EXECUTABLE) add_test(NAME sphere_nomass COMMAND ${PROJECT_BINARY_DIR}/src/ffea sphere_63_120_nomass.ffea) set_tests_properties(sphere_nomass PROPERTIES ENVIRONMENT OMP_NUM_THREADS=1) + set_tests_properties(sphere_nomass PROPERTIES LABELS "SLOW_TEST") add_test(NAME sphere_nomass_check COMMAND ${Python3_EXECUTABLE} testAverages.py) set_tests_properties(sphere_nomass_check PROPERTIES DEPENDS sphere_nomass ENVIRONMENT_MODIFICATION PYTHONPATH=unset: ENVIRONMENT_MODIFICATION PYTHONHOME=unset:) + set_tests_properties(sphere_nomass_check PROPERTIES LABELS "SLOW_TEST") endif() diff --git a/tests/physics/sphere_diffusion/CMakeLists.txt b/tests/physics/sphere_diffusion/CMakeLists.txt index 28f47391..9e0f1777 100644 --- a/tests/physics/sphere_diffusion/CMakeLists.txt +++ b/tests/physics/sphere_diffusion/CMakeLists.txt @@ -29,15 +29,19 @@ if(Python3_EXECUTABLE) add_test(NAME sphere_diffusion_nomass COMMAND ${PROJECT_BINARY_DIR}/src/ffea sphere_nomass_norestart.ffea) set_tests_properties(sphere_diffusion_nomass PROPERTIES ENVIRONMENT OMP_NUM_THREADS=1) + set_tests_properties(sphere_diffusion_nomass PROPERTIES LABELS "SLOW_TEST") add_test(NAME sphere_diffusion_nomass_check COMMAND ${Python3_EXECUTABLE} diffusion_nomass.py sphere_nomass_norestart.ffea) set_tests_properties(sphere_diffusion_nomass_check PROPERTIES DEPENDS sphere_diffusion_nomass ENVIRONMENT_MODIFICATION PYTHONPATH=unset: ENVIRONMENT_MODIFICATION PYTHONHOME=unset:) + set_tests_properties(sphere_diffusion_nomass_check PROPERTIES LABELS "SLOW_TEST") add_test(NAME sphere_diffusion_mass COMMAND ${PROJECT_BINARY_DIR}/src/ffea sphere_mass_norestart.ffea) set_tests_properties(sphere_diffusion_mass PROPERTIES ENVIRONMENT OMP_NUM_THREADS=1) + set_tests_properties(sphere_diffusion_mass PROPERTIES LABELS "SLOW_TEST") add_test(NAME sphere_diffusion_mass_check COMMAND ${Python3_EXECUTABLE} diffusion_mass.py sphere_mass_norestart.ffea) set_tests_properties(sphere_diffusion_mass_check PROPERTIES DEPENDS sphere_diffusion_mass ENVIRONMENT_MODIFICATION PYTHONPATH=unset: ENVIRONMENT_MODIFICATION PYTHONHOME=unset:) + set_tests_properties(sphere_diffusion_mass_check PROPERTIES LABELS "SLOW_TEST") endif() diff --git a/tests/rods/integration/connection/CMakeLists.txt b/tests/rods/integration/connection/CMakeLists.txt index f7fed4fc..f161edbf 100644 --- a/tests/rods/integration/connection/CMakeLists.txt +++ b/tests/rods/integration/connection/CMakeLists.txt @@ -29,4 +29,5 @@ file (COPY bend.ffea DESTINATION ${CONNECTIONPROPDIR}) file (COPY twist.ffea DESTINATION ${CONNECTIONPROPDIR}) add_subdirectory(sphere_structure) add_test(NAME connection_propagation COMMAND ${PROJECT_BINARY_DIR}/src/ffea connection_propagation.ffeatest) +set_tests_properties(connection_propagation PROPERTIES LABELS "SLOW_TEST")