Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/run_testsuite_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
rm -rf ./*
rm -rf ./.??*
ls -la ./
- name: Check out Tutorials for them system tests (tools/tests/)
- name: Check out Tutorials for the system tests (tools/tests/)
uses: actions/checkout@v4
with:
repository: precice/tutorials
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/system-tests-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ jobs:
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "### Tutorials" >> $GITHUB_STEP_SUMMARY
echo "Reference (pull request): \`${{ github.event.pull_request.head.sha }}\`" >> $GITHUB_STEP_SUMMARY
echo "Pull request number: [${{ github.event.number }}](https://github.com/precice/tutorials/pull/${{ github.event.number }})" >> $GITHUB_STEP_SUMMARY

run-system-tests:
name: Trigger system tests
Expand All @@ -127,6 +128,7 @@ jobs:
OPENFOAM_ADAPTER_REF:${{ needs.gather-refs.outputs.ref-openfoam-adapter }},\
SU2_VERSION:7.5.1,\
SU2_ADAPTER_REF:${{ needs.gather-refs.outputs.ref-su2-adapter }},\
TUTORIALS_PR:${{ github.event.number }},\
Copy link
Member Author

@MakisH MakisH Mar 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line needs to be ported to the workflows of other repositories (replacing the TUTORIALS_PR with, e.g., PRECICE_PR.

TUTORIALS_REF:${{ github.event.pull_request.head.sha }}"
system_tests_branch: develop
log_level: "INFO"
1 change: 1 addition & 0 deletions changelog-entries/638.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added support for running the system tests in forks [#638](https://github.com/precice/tutorials/pull/638)
53 changes: 26 additions & 27 deletions tools/tests/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ bare: # A default component used when the solver does not have any dependencies
repository: https://github.com/precice/precice
template: component-templates/bare.yaml
build_arguments: # these things mean something to the docker-service
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
PRECICE_REF:
description: Version of preCICE to use
default: "main"
PRECICE_PRESET:
description: CMake preset of preCICE
default: "production-audit"
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
TUTORIALS_REF:
description: Tutorial git reference to use
default: "master"
Expand All @@ -19,35 +19,35 @@ python-bindings:
repository: https://github.com/precice/python-bindings
template: component-templates/python-bindings.yaml
build_arguments:
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
PRECICE_REF:
description: Version of preCICE to use
default: "main"
PRECICE_PRESET:
description: CMake preset of preCICE
default: "production-audit"
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
TUTORIALS_REF:
description: Tutorial git reference to use
default: "master"
PYTHON_BINDINGS_REF:
semnantic: Git ref of the pythonbindings to use
semnantic: Git ref of the Python bindings to use
default: "master"

openfoam-adapter:
repository: https://github.com/precice/openfoam-adapter
template: component-templates/openfoam-adapter.yaml
build_arguments:
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
PRECICE_REF:
description: Version of preCICE to use
default: "main"
PRECICE_PRESET:
description: CMake preset of preCICE
default: "production-audit"
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
TUTORIALS_REF:
description: Tutorial git reference to use
default: "master"
Expand All @@ -56,28 +56,27 @@ openfoam-adapter:
description: exectuable of openfoam to use
default: "openfoam2306"
OPENFOAM_ADAPTER_REF:
description: Reference/tag of the actual OpenFOAM adapter
description: Reference/tag of the OpenFOAM adapter to use
default: "master"


fenics-adapter:
repository: https://github.com/precice/fenics-adapter
template: component-templates/fenics-adapter.yaml
build_arguments:
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
PRECICE_REF:
description: Version of preCICE to use
default: "main"
PRECICE_PRESET:
description: CMake preset of preCICE
default: "production-audit"
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
TUTORIALS_REF:
description: Tutorial git reference to use
default: "master"
PYTHON_BINDINGS_REF:
semnantic: Git ref of the pythonbindings to use
semnantic: Git ref of the Python bindings to use
default: "master"
FENICS_ADAPTER_REF:
semnantic: Git ref of the fenics adapter to use
Expand All @@ -87,35 +86,35 @@ nutils-adapter:
repository: https://github.com/precice/nutils-adapter
template: component-templates/nutils-adapter.yaml
build_arguments:
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
PRECICE_REF:
description: Version of preCICE to use
default: "main"
PRECICE_PRESET:
description: CMake preset of preCICE
default: "production-audit"
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
TUTORIALS_REF:
description: Tutorial git reference to use
default: "master"
PYTHON_BINDINGS_REF:
semnantic: Git ref of the pythonbindings to use

semnantic: Git ref of the Python bindings to use
default: "master"

calculix-adapter:
repository: https://github.com/precice/calculix-adapter
template: component-templates/calculix-adapter.yaml
build_arguments:
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
PRECICE_REF:
description: Version of preCICE to use
default: "main"
PRECICE_PRESET:
description: CMake preset of preCICE
default: "production-audit"
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
TUTORIALS_REF:
description: Tutorial git reference to use
default: "master"
Expand All @@ -130,15 +129,15 @@ su2-adapter:
repository: https://github.com/precice/su2-adapter
template: component-templates/su2-adapter.yaml
build_arguments:
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
PRECICE_REF:
description: Version of preCICE to use
default: "main"
PRECICE_PRESET:
description: CMake preset of preCICE
default: "production-audit"
PLATFORM:
description: Dockerfile platform used
default: "ubuntu_2404"
TUTORIALS_REF:
description: Tutorial git reference to use
default: "master"
Expand Down
8 changes: 8 additions & 0 deletions tools/tests/dockerfiles/ubuntu_2204/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ RUN python3 -m pip install --user --upgrade pip

FROM precice_dependecies AS precice
# Install & build precice into /home/precice/precice
ARG PRECICE_PR
ARG PRECICE_REF
ARG PRECICE_PRESET
USER precice
WORKDIR /home/precice
RUN git clone https://github.com/precice/precice.git precice && \
cd precice && \
if [ -n "${PRECICE_PR}" ]; then git fetch origin pull/${PRECICE_PR}/head; fi && \
git checkout ${PRECICE_REF} && \
mkdir build && cd build &&\
cmake .. --preset=${PRECICE_PRESET} -DCMAKE_INSTALL_PREFIX=/home/precice/.local/ -DPRECICE_PETScMapping=OFF -DBUILD_TESTING=OFF && \
Expand All @@ -67,12 +69,14 @@ RUN apt-get update &&\
ln -s $(which ${OPENFOAM_EXECUTABLE} ) /usr/bin/openfoam
USER precice
COPY --from=precice /home/precice/.local/ /home/precice/.local/
ARG OPENFOAM_ADAPTER_PR
ARG OPENFOAM_ADAPTER_REF
# Build the OpenFOAM adapter
USER precice
WORKDIR /home/precice
RUN git clone https://github.com/precice/openfoam-adapter.git &&\
cd openfoam-adapter && \
if [ -n "${OPENFOAM_ADAPTER_PR}" ]; then git fetch origin pull/${OPENFOAM_ADAPTER_PR}/head; fi && \
git checkout ${OPENFOAM_ADAPTER_REF} && \
/usr/bin/${OPENFOAM_EXECUTABLE} ./Allwmake -j $(nproc)

Expand Down Expand Up @@ -119,10 +123,12 @@ RUN wget http://www.dhondt.de/ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
tar xvjf ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
rm -fv ccx_${CALCULIX_VERSION}.src.tar.bz2

ARG CALCULIX_ADAPTER_PR
ARG CALCULIX_ADAPTER_REF
WORKDIR /home/precice
RUN git clone https://github.com/precice/calculix-adapter.git && \
cd calculix-adapter && \
if [ -n "${CALCULIX_ADAPTER_PR}" ]; then git fetch origin pull/${CALCULIX_ADAPTER_PR}/head; fi && \
git checkout ${CALCULIX_ADAPTER_REF} &&\
make CXX_VERSION=${CALCULIX_VERSION} ADDITIONAL_FFLAGS="-fallow-argument-mismatch" -j $(nproc) && \
ln -s /home/precice/calculix-adapter/bin/ccx_preCICE /home/precice/.local/bin/ccx_preCICE
Expand All @@ -141,6 +147,7 @@ RUN wget https://github.com/su2code/SU2/archive/refs/tags/v${SU2_VERSION}.tar.gz
tar xvzf v${SU2_VERSION}.tar.gz && \
rm -fv v${SU2_VERSION}.tar.gz
RUN pip3 install --user mpi4py
ARG SU2_ADAPTER_PR
ARG SU2_ADAPTER_REF
WORKDIR /home/precice
ENV SU2_RUN="/home/precice/SU2_RUN"
Expand All @@ -149,6 +156,7 @@ ENV PATH="/home/precice/su2-adapter/run:$SU2_RUN:$PATH"
ENV PYTHONPATH="$SU2_RUN:$PYTHONPATH"
RUN git clone https://github.com/precice/su2-adapter.git && \
cd su2-adapter &&\
if [ -n "${SU2_ADAPTER_PR}" ]; then git fetch origin pull/${SU2_ADAPTER_PR}/head; fi && \
git checkout ${SU2_ADAPTER_REF} &&\
./su2AdapterInstall
RUN cd "${SU2_HOME}" &&\
Expand Down
8 changes: 8 additions & 0 deletions tools/tests/dockerfiles/ubuntu_2404/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ USER precice

FROM precice_dependecies AS precice
# Install & build precice into /home/precice/precice
ARG PRECICE_PR
ARG PRECICE_REF
ARG PRECICE_PRESET
USER precice
WORKDIR /home/precice
RUN git clone https://github.com/precice/precice.git precice && \
cd precice && \
if [ -n "${PRECICE_PR}" ]; then git fetch origin pull/${PRECICE_PR}/head; fi && \
git checkout ${PRECICE_REF} && \
mkdir build && cd build &&\
cmake .. --preset=${PRECICE_PRESET} -DCMAKE_INSTALL_PREFIX=/home/precice/.local/ -DPRECICE_PETScMapping=OFF -DBUILD_TESTING=OFF && \
Expand All @@ -65,12 +67,14 @@ RUN apt-get update &&\
ln -s $(which ${OPENFOAM_EXECUTABLE} ) /usr/bin/openfoam
USER precice
COPY --from=precice /home/precice/.local/ /home/precice/.local/
ARG OPENFOAM_ADAPTER_PR
ARG OPENFOAM_ADAPTER_REF
# Build the OpenFOAM adapter
USER precice
WORKDIR /home/precice
RUN git clone https://github.com/precice/openfoam-adapter.git &&\
cd openfoam-adapter && \
if [ -n "${OPENFOAM_ADAPTER_PR}" ]; then git fetch origin pull/${OPENFOAM_ADAPTER_PR}/head; fi && \
git checkout ${OPENFOAM_ADAPTER_REF} && \
/usr/bin/${OPENFOAM_EXECUTABLE} ./Allwmake -j $(nproc)

Expand Down Expand Up @@ -123,10 +127,12 @@ RUN wget http://www.dhondt.de/ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
tar xvjf ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
rm -fv ccx_${CALCULIX_VERSION}.src.tar.bz2

ARG CALCULIX_ADAPTER_PR
ARG CALCULIX_ADAPTER_REF
WORKDIR /home/precice
RUN git clone https://github.com/precice/calculix-adapter.git && \
cd calculix-adapter && \
if [ -n "${CALCULIX_ADAPTER_PR}" ]; then git fetch origin pull/${CALCULIX_ADAPTER_PR}/head; fi && \
git checkout ${CALCULIX_ADAPTER_REF} &&\
make CXX_VERSION=${CALCULIX_VERSION} ADDITIONAL_FFLAGS="-fallow-argument-mismatch" -j $(nproc) && \
ln -s /home/precice/calculix-adapter/bin/ccx_preCICE /home/precice/.local/bin/ccx_preCICE
Expand All @@ -147,6 +153,7 @@ RUN wget https://github.com/su2code/SU2/archive/refs/tags/v${SU2_VERSION}.tar.gz
rm -fv v${SU2_VERSION}.tar.gz
RUN python3 -m venv /home/precice/venv && \
. /home/precice/venv/bin/activate
ARG SU2_ADAPTER_PR
ARG SU2_ADAPTER_REF
WORKDIR /home/precice
ENV SU2_RUN="/home/precice/SU2_RUN"
Expand All @@ -155,6 +162,7 @@ ENV PATH="/home/precice/su2-adapter/run:$SU2_RUN:$PATH"
ENV PYTHONPATH="$SU2_RUN:$PYTHONPATH"
RUN git clone https://github.com/precice/su2-adapter.git && \
cd su2-adapter &&\
if [ -n "${SU2_ADAPTER_PR}" ]; then git fetch origin pull/${SU2_ADAPTER_PR}/head; fi && \
git checkout ${SU2_ADAPTER_REF} &&\
./su2AdapterInstall
RUN cd "${SU2_HOME}" &&\
Expand Down
47 changes: 30 additions & 17 deletions tools/tests/systemtests/Systemtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,30 +146,26 @@ def __post_init__(self):

def __init_args_to_use(self):
"""
Checks if all required parameters for the realisation of the cases are supplied in the cmdline arguments.
If a parameter is missing and it's required, an exception is raised.
Otherwise, the default value is used if available.
Forwards the command-line arguments to the params_to_use dictionary, substituting any missing arguments with their defaults.

In the end it populates the args_to_use dict

Raises:
Exception: If a required parameter is missing.
Previously, this function was also checking if all required parameters were provided, and was raising exceptions for parameters not provided and not having a default value. This check made adding optional parameters with empty defaults (e.g., the TUTORIALS_PR) complicated, and it was removed.
"""
self.params_to_use = {}

# Forward all provided arguments to params_to_use
provided_arguments = self.arguments.arguments
self.params_to_use = provided_arguments

# Find out which parameters are needed
needed_parameters = set()
for case in self.case_combination.cases:
needed_parameters.update(case.component.parameters)

# Substitute defaults for non-provided, needed arguments
for needed_param in needed_parameters:
if self.arguments.contains(needed_param.key):
self.params_to_use[needed_param.key] = self.arguments.get(
needed_param.key)
else:
if needed_param.required:
raise Exception(
f"{needed_param} is needed to be given via --params to instantiate the systemtest for {self.tutorial.name}")
else:
self.params_to_use[needed_param.key] = needed_param.default
if not needed_param.key in provided_arguments:
logging.warning(
f"No argument provided for needed parameter {needed_param.key}. Substituting with {needed_param.default}")
self.params_to_use[needed_param.key] = needed_param.default

def __get_docker_services(self) -> Dict[str, str]:
"""
Expand Down Expand Up @@ -249,6 +245,19 @@ def _get_git_ref(self, repository: Path, abbrev_ref=False) -> Optional[str]:
except Exception as e:
raise RuntimeError(f"An error occurred while getting the current Git ref: {e}") from e

def _fetch_pr(self, repository: Path, pr: str):
try:
result = subprocess.run([
"git",
"-C", os.fspath(repository.resolve()),
"fetch",
"origin",
"pull/" + pr + "/head"
], check=True, timeout=60)

except Exception as e:
raise RuntimeError(f"git command returned code {result.returncode}")

def _fetch_ref(self, repository: Path, ref: str):
try:
result = subprocess.run([
Expand Down Expand Up @@ -282,6 +291,10 @@ def __copy_tutorial_into_directory(self, run_directory: Path):
"""
current_time_string = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
self.run_directory = run_directory
pr_requested = self.params_to_use.get("TUTORIALS_PR")
if pr_requested:
logging.debug(f"Fetching the PR {pr_requested} HEAD reference")
self._fetch_pr(PRECICE_TUTORIAL_DIR, pr_requested)
current_ref = self._get_git_ref(PRECICE_TUTORIAL_DIR)
ref_requested = self.params_to_use.get("TUTORIALS_REF")
if ref_requested:
Expand Down