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

[CI] some more improvement towards selective compilation #11904

Merged
merged 8 commits into from
Dec 21, 2023
Merged
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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ jobs:
# - name: Installing dependencies
# => must be added to the docker container to avoid reinstalling it in every CI run

- name: CI configuration
shell: bash
run: python3 kratos/python_scripts/testing/ci_utilities.py

- name: Build
shell: bash
run: |
Expand Down Expand Up @@ -172,6 +176,10 @@ jobs:
with:
python-version: '3.8'

- name: CI configuration
shell: bash
run: python3 kratos/python_scripts/testing/ci_utilities.py

- name: Download boost
run: |
$url = "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.gz"
Expand Down Expand Up @@ -204,8 +212,11 @@ jobs:

centos:
runs-on: ubuntu-latest
needs: changed-files
env:
KRATOS_BUILD_TYPE: Custom
KRATOS_CI_CHANGED_FILES: ${{needs.changed-files.outputs.files}}
KRATOS_CI_APPLICATIONS: ".github/workflows/ci_apps_centos.json"

container:
image: kratosmultiphysics/kratos-image-ci-centos7:latest
Expand All @@ -217,6 +228,10 @@ jobs:
# - name: Installing dependencies
# => must be added to the docker container to avoid reinstalling it in every CI run

- name: CI configuration
shell: bash
run: python3.8 kratos/python_scripts/testing/ci_utilities.py

- name: Build
run: |
export KRATOS_CMAKE_CXX_FLAGS="-Werror -Wno-deprecated-declarations -Wignored-qualifiers"
Expand All @@ -232,8 +247,11 @@ jobs:

ubuntu-core-without-unity:
runs-on: ubuntu-latest
needs: changed-files
env:
KRATOS_BUILD_TYPE: Custom
KRATOS_CI_CHANGED_FILES: ${{needs.changed-files.outputs.files}}
KRATOS_CI_APPLICATIONS: "ONLY_CORE"
OMPI_MCA_rmaps_base_oversubscribe: 1 # Allow oversubscription for MPI (needed for OpenMPI >= 3.0)

container:
Expand All @@ -249,6 +267,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: CI configuration
shell: bash
run: python3 kratos/python_scripts/testing/ci_utilities.py

- name: Cache Build
id: cache-build
uses: actions/cache@v3
Expand Down Expand Up @@ -354,15 +376,22 @@ jobs:

windows-core-without-unity:
runs-on: windows-2022
needs: changed-files
env:
KRATOS_BUILD_TYPE: Custom
KRATOS_CI_CHANGED_FILES: ${{needs.changed-files.outputs.files}}
KRATOS_CI_APPLICATIONS: "ONLY_CORE"

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: CI configuration
shell: bash
run: python3 kratos/python_scripts/testing/ci_utilities.py

- name: Download boost
run: |
$url = "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.gz"
Expand Down Expand Up @@ -515,8 +544,11 @@ jobs:

ubuntu-intel:
runs-on: ubuntu-latest
needs: changed-files
env:
KRATOS_BUILD_TYPE: Custom
KRATOS_CI_CHANGED_FILES: ${{needs.changed-files.outputs.files}}
KRATOS_CI_APPLICATIONS: ".github/workflows/ci_apps_intel.json"
OMPI_MCA_rmaps_base_oversubscribe: 1 # Allow oversubscription for MPI (needed for OpenMPI >= 3.0)
OMPI_MCA_btl_vader_single_copy_mechanism: none # suppressing some annoying OpenMPI messages

Expand All @@ -530,6 +562,10 @@ jobs:
# - name: Installing dependencies
# => must be added to the docker container to avoid reinstalling it in every CI run

- name: CI configuration
shell: bash
run: python3 kratos/python_scripts/testing/ci_utilities.py

- name: Build
shell: bash
run: |
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/ci_apps_centos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
"FluidDynamicsApplication",
"MappingApplication",
"StructuralMechanicsApplication",
"MeshingApplication",
"LinearSolversApplication",
"ConstitutiveLawsApplication",
"CoSimulationApplication"
]
1 change: 1 addition & 0 deletions .github/workflows/ci_apps_intel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
27 changes: 19 additions & 8 deletions kratos/python_scripts/testing/ci_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ def check_valid_environment_configuration_exists() -> None:
if not getenv("KRATOS_CI_CHANGED_FILES"):
raise RuntimeError("Invalid CI-environment: KRATOS_CI_CHANGED_FILES")

if not getenv("KRATOS_CI_APPLICATIONS"):
kratos_ci_applications: Optional[str] = getenv("KRATOS_CI_APPLICATIONS")

if kratos_ci_applications == "ONLY_CORE":
return

if kratos_ci_applications is None:
raise RuntimeError("Invalid CI-environment: KRATOS_CI_APPLICATIONS")

if not Path(getenv("KRATOS_CI_APPLICATIONS")).exists():
if not Path(kratos_ci_applications).exists():
raise RuntimeError("Invalid CI-environment: KRATOS_CI_APPLICATIONS file does not exist")


Expand All @@ -25,7 +30,13 @@ def changed_files() -> List[Path]:

def ci_applications() -> List[str]:
check_valid_environment_configuration_exists()
with open(getenv("KRATOS_CI_APPLICATIONS")) as ci_apps_file:

kratos_ci_applications: str = getenv("KRATOS_CI_APPLICATIONS")

if kratos_ci_applications == "ONLY_CORE":
return []

with open(kratos_ci_applications) as ci_apps_file:
return json.load(ci_apps_file)


Expand All @@ -51,13 +62,13 @@ def are_only_python_files_changed() -> bool:

def print_ci_information() -> None:
"""This function prints an overview of the CI related information"""
pprint(f"{sorted(changed_files())=}")
pprint(f"{ci_applications()=}")
print(f"{get_changed_files_extensions()=}")
pprint(sorted(map(lambda p : p.as_posix(), changed_files())))
pprint(sorted(ci_applications()))
print(f"{sorted(get_changed_files_extensions())=}")
print(f"{are_only_python_files_changed()=}")
print(f"{get_changed_applications()=}")
print(f"{sorted(get_changed_applications())=}")
print(f"{is_core_changed()=}")
print(f"{is_mpi_core_changed()=}")
print(f"{is_mpi_core_changed()=}\n")


if __name__ == "__main__":
Expand Down
Loading