Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft GHA workflow #1

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/problem-matchers.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
]
}
121 changes: 121 additions & 0 deletions .github/workflows/Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions tests/physics/EI_cyl_160_fine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 2 additions & 0 deletions tests/physics/E_cyl_160_fine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 2 additions & 0 deletions tests/physics/sphere_63_120_mass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 2 additions & 0 deletions tests/physics/sphere_63_120_nomass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
4 changes: 4 additions & 0 deletions tests/physics/sphere_diffusion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions tests/rods/integration/connection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Loading