From 4274505308301e8dccfd9c72b2729f161b4c7c20 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 5 Sep 2023 10:00:24 +0200 Subject: [PATCH 01/26] removed the uneccesarry TUTORIAL checkout --- .github/workflows/run_testsuite.yml | 54 ++++++----------------------- 1 file changed, 11 insertions(+), 43 deletions(-) diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite.yml index 37fc08525..b9cac23fc 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite.yml @@ -2,41 +2,22 @@ name: Run Testsuite (manual) # Unfortunately, we cannot modify the name: https:/ on: workflow_dispatch: inputs: - testsuites: - description: 'Virtual Environment' - default: 'openfoam-adapter-release' + suites: + description: 'Comma seperated testsuites to execute' required: true - type: choice - options: - - openfoam-adapter-release - - openfoam-adapter-pr - - fenics-test + type: string build_args: description: 'Build arguments' - default: 'OPENFOAM_EXECUTABLE:openfoam2212,PRECICE_TAG:latest,OPENFOAM_ADAPTER_REF:master' - required: true - type: choice - options: - - 'OPENFOAM_EXECUTABLE:openfoam2212,PRECICE_TAG:latest,OPENFOAM_ADAPTER_REF:master' - - 'OPENFOAM_EXECUTABLE:openfoam2112,PRECICE_TAG:latest,OPENFOAM_ADAPTER_REF:master' - - 'OPENFOAM_EXECUTABLE:openfoam2212,PRECICE_TAG:develop,OPENFOAM_ADAPTER_REF:develop' - tutorial_branch: - description: 'Branch to take the tutorials from' - default: 'master' - required: true - type: choice - options: - - 'develop' - - 'master' + required: false + type: string systests_branch: description: 'Branch to take the systest from' - default: 'add-systemtests' + default: 'develop' required: true type: choice options: - 'develop' - 'master' - - 'add-systemtests' jobs: build: runs-on: ubuntu-latest @@ -44,29 +25,16 @@ jobs: - name: Report log run: | echo "Initiated by: ${{ github.actor }}" - echo "Running systemtests --build_args=${{github.event.inputs.build_args}} --suites=${{github.event.inputs.testsuites}}" - echo "Tutorials branch: ${{ github.event.inputs.tutorial_branch }}" + echo "Running systemtests --build_args=${{github.event.inputs.build_args}} --suites=${{github.event.inputs.suites}}" echo "Systemtests branch: ${{ github.event.inputs.systests_branch }}" - - name: Check out Tutorials - uses: actions/checkout@v2 - with: - ref: ${{ github.event.inputs.tutorial_branch }} - path: 'tutorials' - name: Check out Tutorials for systest uses: actions/checkout@v2 with: ref: ${{ github.event.inputs.systests_branch }} - path: 'systest' - name: Log directory run: | ls -al pwd - - name: Copy folders and files from systest into tutorials - run: | - cp -R systest/tools/* tutorials/tools - cd systest - find . -type f -name "metadata.yaml" -exec cp --parents {} ../tutorials \; - cd .. - uses: actions/setup-python@v4 with: python-version: '3.11' @@ -74,15 +42,15 @@ jobs: uses: docker/setup-buildx-action@v2 - name: install python depencies run: | - python -m pip install -r tutorials/tools/tests/requirements.txt + python -m pip install -r ./tools/tests/requirements.txt - name: Run tests run: | - cd tutorials/tools/tests - python systemtests.py --build_args=${{github.event.inputs.build_args}} --suites=${{github.event.inputs.testsuites}} + cd ./tools/tests + python systemtests.py --build_args=${{github.event.inputs.build_args}} --suites=${{github.event.inputs.suites}} cd ../../ - name: Archive run files uses: actions/upload-artifact@v2 with: name: runs path: | - tutorials/runs/* \ No newline at end of file + runs/* \ No newline at end of file From 1dc50ad1aba3fbd62d8d38b6e316a1991872ed61 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 5 Sep 2023 10:08:14 +0200 Subject: [PATCH 02/26] little hack around the git checkout problem --- .github/workflows/run_testsuite.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite.yml index b9cac23fc..cd8880559 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite.yml @@ -31,6 +31,7 @@ jobs: uses: actions/checkout@v2 with: ref: ${{ github.event.inputs.systests_branch }} + fetch-depth: 0 - name: Log directory run: | ls -al From 608da7a40b7709c7effbb7837546246aa272bb40 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 5 Sep 2023 10:12:03 +0200 Subject: [PATCH 03/26] ofc we need lfs --- .github/workflows/run_testsuite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite.yml index cd8880559..f98ec89a8 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite.yml @@ -31,7 +31,7 @@ jobs: uses: actions/checkout@v2 with: ref: ${{ github.event.inputs.systests_branch }} - fetch-depth: 0 + lfs: true - name: Log directory run: | ls -al From 6f5bcf74851cd8953c2ba8cb55e5700122da303c Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 5 Sep 2023 10:20:29 +0200 Subject: [PATCH 04/26] try again --- .github/workflows/run_testsuite.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite.yml index f98ec89a8..b889d381b 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite.yml @@ -32,6 +32,7 @@ jobs: with: ref: ${{ github.event.inputs.systests_branch }} lfs: true + fetch-depth: 0 - name: Log directory run: | ls -al @@ -46,6 +47,8 @@ jobs: python -m pip install -r ./tools/tests/requirements.txt - name: Run tests run: | + export GIT_TRACE=true + export GIT_CURL_VERBOSE=true cd ./tools/tests python systemtests.py --build_args=${{github.event.inputs.build_args}} --suites=${{github.event.inputs.suites}} cd ../../ From e91f3f0ab14d4d376fb486e7ceda88787eeddbd5 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Thu, 21 Sep 2023 11:04:33 +0200 Subject: [PATCH 05/26] lets try ospath --- tools/tests/systemtests/Systemtest.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/tests/systemtests/Systemtest.py b/tools/tests/systemtests/Systemtest.py index 33056c7bc..45226a527 100644 --- a/tools/tests/systemtests/Systemtest.py +++ b/tools/tests/systemtests/Systemtest.py @@ -16,6 +16,7 @@ import unicodedata import re import logging +import os GLOBAL_TIMEOUT = 360 @@ -217,7 +218,7 @@ def _get_git_ref(self, repository: Path, abbrev_ref=False) -> Optional[str]: try: result = subprocess.run([ "git", - "-C", repository.resolve(), + "-C", os.fspath(repository.resolve()), "rev-parse", "--abbrev-ref" if abbrev_ref else "HEAD"], stdout=subprocess.PIPE, @@ -231,9 +232,9 @@ def _checkout_ref_in_subfolder(self, repository: Path, subfolder: Path, ref: str try: result = subprocess.run([ "git", - "-C", repository.resolve(), + "-C", os.fspath(repository.resolve()), "checkout", ref, - "--", subfolder.resolve() + "--", os.fspath(subfolder.resolve()) ], check=True, timeout=60) if result.returncode != 0: raise RuntimeError(f"git command returned code {result.returncode}") From dfbc425f0658bda1c2b2eb15a5395e03f087583e Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Thu, 21 Sep 2023 11:10:01 +0200 Subject: [PATCH 06/26] add test workflows to run actual branhc --- .github/workflows/run_testsuite.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite.yml index b889d381b..f59a2b522 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite.yml @@ -18,6 +18,7 @@ on: options: - 'develop' - 'master' + - 'add-test-workflows' jobs: build: runs-on: ubuntu-latest From 263a959b162961b563c26bb8c6c8f626a4f24c91 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Thu, 21 Sep 2023 11:23:48 +0200 Subject: [PATCH 07/26] add debug stage --- .github/workflows/run_testsuite.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite.yml index f59a2b522..49473835e 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite.yml @@ -46,6 +46,13 @@ jobs: - name: install python depencies run: | python -m pip install -r ./tools/tests/requirements.txt + - name: run git branch -v + run: | + export GIT_TRACE=true + export GIT_CURL_VERBOSE=true + cd ./tools/tests + git branch -v + cd ../../ - name: Run tests run: | export GIT_TRACE=true From e8e27205907c456560e3f7f65cf0e89eb7c39396 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Thu, 21 Sep 2023 12:10:22 +0200 Subject: [PATCH 08/26] now with fetching refs --- tools/tests/systemtests/Systemtest.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/tests/systemtests/Systemtest.py b/tools/tests/systemtests/Systemtest.py index 45226a527..ac84eff7f 100644 --- a/tools/tests/systemtests/Systemtest.py +++ b/tools/tests/systemtests/Systemtest.py @@ -228,6 +228,22 @@ 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_ref(self, repository: Path, ref: str): + try: + result = subprocess.run([ + "git", + "-C", os.fspath(repository.resolve()), + "fetch", + "origin", + ref + ], check=True, timeout=60) + if result.returncode != 0: + raise RuntimeError(f"git command returned code {result.returncode}") + + except Exception as e: + raise RuntimeError(f"An error occurred while fetching origin '{ref}': {e}") + def _checkout_ref_in_subfolder(self, repository: Path, subfolder: Path, ref: str): try: result = subprocess.run([ @@ -252,6 +268,7 @@ def __copy_tutorial_into_directory(self, run_directory: Path): ref_requested = self.params_to_use.get("TUTORIALS_REF") if ref_requested: logging.debug(f"Checking out tutorials {ref_requested} before copying") + self._fetch_ref(PRECICE_TUTORIAL_DIR,ref_requested) self._checkout_ref_in_subfolder(PRECICE_TUTORIAL_DIR, self.tutorial.path, ref_requested) self.tutorial_folder = slugify(f'{self.tutorial.path.name}_{self.case_combination.cases}_{current_time_string}') From 7629f352843090d8f436b6bf456812eae6b28ce7 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Thu, 21 Sep 2023 12:18:45 +0200 Subject: [PATCH 09/26] give the thing the right name --- tools/tests/systemtests/Systemtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tests/systemtests/Systemtest.py b/tools/tests/systemtests/Systemtest.py index ac84eff7f..9b76a091d 100644 --- a/tools/tests/systemtests/Systemtest.py +++ b/tools/tests/systemtests/Systemtest.py @@ -236,7 +236,7 @@ def _fetch_ref(self, repository: Path, ref: str): "-C", os.fspath(repository.resolve()), "fetch", "origin", - ref + f"{ref}:{ref}" ], check=True, timeout=60) if result.returncode != 0: raise RuntimeError(f"git command returned code {result.returncode}") From 563cac02bfec4648c699c2418f81bd3f10cebdce Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Thu, 21 Sep 2023 17:20:16 +0200 Subject: [PATCH 10/26] add loglevel --- .github/workflows/run_testsuite.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite.yml index 49473835e..9f0d79e0b 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite.yml @@ -19,6 +19,17 @@ on: - 'develop' - 'master' - 'add-test-workflows' + loglevel: + description: 'loglevel used for the systemtests' + default: 'INFO' + required: true + type: choice + options: + - 'DEBUG' + - 'INFO' + - 'WARNING' + - 'ERROR' + - 'CRITICAL' jobs: build: runs-on: ubuntu-latest @@ -46,19 +57,10 @@ jobs: - name: install python depencies run: | python -m pip install -r ./tools/tests/requirements.txt - - name: run git branch -v - run: | - export GIT_TRACE=true - export GIT_CURL_VERBOSE=true - cd ./tools/tests - git branch -v - cd ../../ - name: Run tests run: | - export GIT_TRACE=true - export GIT_CURL_VERBOSE=true cd ./tools/tests - python systemtests.py --build_args=${{github.event.inputs.build_args}} --suites=${{github.event.inputs.suites}} + python systemtests.py --build_args=${{github.event.inputs.build_args}} --suites=${{github.event.inputs.suites}} --log-level=${{github.event.inputs.loglevel}} cd ../../ - name: Archive run files uses: actions/upload-artifact@v2 From 3e8e61df730575cb610923d0aaa1b72795c2d4ac Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Fri, 22 Sep 2023 13:18:18 +0200 Subject: [PATCH 11/26] "always" run the archive files --- .github/workflows/run_testsuite.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite.yml index 9f0d79e0b..c7c0d66d1 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite.yml @@ -63,6 +63,7 @@ jobs: python systemtests.py --build_args=${{github.event.inputs.build_args}} --suites=${{github.event.inputs.suites}} --log-level=${{github.event.inputs.loglevel}} cd ../../ - name: Archive run files + if: success() || failure() uses: actions/upload-artifact@v2 with: name: runs From 80ae3a4bb8b0f16873ab9b1fa80f5f5a8ef9fa21 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Sat, 23 Sep 2023 11:11:14 +0200 Subject: [PATCH 12/26] try caching in gha --- .github/workflows/run_testsuite.yml | 2 ++ tools/tests/component-templates/calculix-adapter.yaml | 4 ++++ tools/tests/component-templates/fenics-adapter.yaml | 4 ++++ tools/tests/component-templates/nutils-adapter.yaml | 4 ++++ tools/tests/component-templates/openfoam-adapter.yaml | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite.yml index c7c0d66d1..184eba6f8 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite.yml @@ -57,6 +57,8 @@ jobs: - name: install python depencies run: | python -m pip install -r ./tools/tests/requirements.txt + - name: Expose GitHub Runtime + uses: crazy-max/ghaction-github-runtime@v3 - name: Run tests run: | cd ./tools/tests diff --git a/tools/tests/component-templates/calculix-adapter.yaml b/tools/tests/component-templates/calculix-adapter.yaml index 038a088b7..91bc51251 100644 --- a/tools/tests/component-templates/calculix-adapter.yaml +++ b/tools/tests/component-templates/calculix-adapter.yaml @@ -5,6 +5,10 @@ build: - {{key}}={{value}} {% endfor %} target: calculix_adapter + cache_from: + - type=gha + cache_to: + - type=gha depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/fenics-adapter.yaml b/tools/tests/component-templates/fenics-adapter.yaml index b83a23707..6f8293503 100644 --- a/tools/tests/component-templates/fenics-adapter.yaml +++ b/tools/tests/component-templates/fenics-adapter.yaml @@ -5,6 +5,10 @@ build: - {{key}}={{value}} {% endfor %} target: fenics_adapter + cache_from: + - type=gha + cache_to: + - type=gha depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/nutils-adapter.yaml b/tools/tests/component-templates/nutils-adapter.yaml index 9963028ab..36227e9a6 100644 --- a/tools/tests/component-templates/nutils-adapter.yaml +++ b/tools/tests/component-templates/nutils-adapter.yaml @@ -5,6 +5,10 @@ build: - {{key}}={{value}} {% endfor %} target: nutils_adapter + cache_from: + - type=gha + cache_to: + - type=gha depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/openfoam-adapter.yaml b/tools/tests/component-templates/openfoam-adapter.yaml index 4657b6e23..e86dd6de4 100644 --- a/tools/tests/component-templates/openfoam-adapter.yaml +++ b/tools/tests/component-templates/openfoam-adapter.yaml @@ -5,6 +5,10 @@ build: - {{key}}={{value}} {% endfor %} target: openfoam_adapter + cache_from: + - type=gha + cache_to: + - type=gha,mode=max depends_on: prepare: condition: service_completed_successfully From d60096594b919c18d39d33b04203ff0661b95432 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Sat, 23 Sep 2023 11:43:52 +0200 Subject: [PATCH 13/26] added cahce-max --- tools/tests/component-templates/calculix-adapter.yaml | 2 +- tools/tests/component-templates/fenics-adapter.yaml | 2 +- tools/tests/component-templates/nutils-adapter.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tests/component-templates/calculix-adapter.yaml b/tools/tests/component-templates/calculix-adapter.yaml index 91bc51251..c63e6591a 100644 --- a/tools/tests/component-templates/calculix-adapter.yaml +++ b/tools/tests/component-templates/calculix-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha + - type=gha,mode=max depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/fenics-adapter.yaml b/tools/tests/component-templates/fenics-adapter.yaml index 6f8293503..1d1fbe6f3 100644 --- a/tools/tests/component-templates/fenics-adapter.yaml +++ b/tools/tests/component-templates/fenics-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha + - type=gha,mode=max depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/nutils-adapter.yaml b/tools/tests/component-templates/nutils-adapter.yaml index 36227e9a6..2ff395dea 100644 --- a/tools/tests/component-templates/nutils-adapter.yaml +++ b/tools/tests/component-templates/nutils-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha + - type=gha,mode=max depends_on: prepare: condition: service_completed_successfully From 5fab40f708a24998152b587c1e65d900ab2b5686 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Sat, 23 Sep 2023 13:13:17 +0200 Subject: [PATCH 14/26] pritnout file permissions --- tools/tests/docker-compose.template.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/tests/docker-compose.template.yaml b/tools/tests/docker-compose.template.yaml index ff6f7d279..19f0e0413 100644 --- a/tools/tests/docker-compose.template.yaml +++ b/tools/tests/docker-compose.template.yaml @@ -4,12 +4,19 @@ services: build: context: {{ dockerfile_context }} target: base_image + cache_from: + - type=gha + cache_to: + - type=gha,mode=max + volumes: - {{ run_directory }}:/runs command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}' && + ls -al && + touch somefile.permissions && sed -i 's%% %g' precice-config.xml && sed -i 's|m2n:sockets from|m2n:sockets network=\"eth0\" from|g' precice-config.xml && cat precice-config.xml" From d9c87f14a29d7e316214f7e783e79eb335837e0c Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Sat, 23 Sep 2023 21:39:41 +0200 Subject: [PATCH 15/26] chown --- tools/tests/docker-compose.template.yaml | 1 + tools/tests/dockerfiles/ubuntu_2204/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/tests/docker-compose.template.yaml b/tools/tests/docker-compose.template.yaml index 19f0e0413..a10b985b1 100644 --- a/tools/tests/docker-compose.template.yaml +++ b/tools/tests/docker-compose.template.yaml @@ -15,6 +15,7 @@ services: command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}' && + chown -R precice:precice /runs && ls -al && touch somefile.permissions && sed -i 's%% %g' precice-config.xml && diff --git a/tools/tests/dockerfiles/ubuntu_2204/Dockerfile b/tools/tests/dockerfiles/ubuntu_2204/Dockerfile index 3f34db82e..5eb69adf2 100644 --- a/tools/tests/dockerfiles/ubuntu_2204/Dockerfile +++ b/tools/tests/dockerfiles/ubuntu_2204/Dockerfile @@ -3,7 +3,7 @@ USER root SHELL ["/bin/bash", "-c"] ENV DEBIAN_FRONTEND=noninteractive -RUN useradd -ms /bin/bash precice +RUN useradd -ms /bin/bash precice ENV PATH="${PATH}:/home/precice/.local/bin" ENV LD_LIBRARY_PATH="/home/precice/.local/lib:${LD_LIBRARY_PATH}" ENV CPATH="/home/precice/.local/include:$CPATH" From 432cc2420f4ff885919008c8e671106f31c2aa9c Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Sat, 23 Sep 2023 22:06:13 +0200 Subject: [PATCH 16/26] user ? maybe ? PLS! --- tools/tests/docker-compose.template.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/tests/docker-compose.template.yaml b/tools/tests/docker-compose.template.yaml index a10b985b1..90d6578c1 100644 --- a/tools/tests/docker-compose.template.yaml +++ b/tools/tests/docker-compose.template.yaml @@ -11,11 +11,10 @@ services: volumes: - {{ run_directory }}:/runs - + user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}' && - chown -R precice:precice /runs && ls -al && touch somefile.permissions && sed -i 's%% %g' precice-config.xml && From 957da02bf64b3c6963c6767a69597692332afe2c Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Sat, 23 Sep 2023 22:28:18 +0200 Subject: [PATCH 17/26] adopt to all templates --- tools/tests/component-templates/calculix-adapter.yaml | 1 + tools/tests/component-templates/fenics-adapter.yaml | 1 + tools/tests/component-templates/nutils-adapter.yaml | 1 + tools/tests/component-templates/openfoam-adapter.yaml | 1 + tools/tests/docker-compose.field_compare.template.yaml | 1 + 5 files changed, 5 insertions(+) diff --git a/tools/tests/component-templates/calculix-adapter.yaml b/tools/tests/component-templates/calculix-adapter.yaml index c63e6591a..e809c37a5 100644 --- a/tools/tests/component-templates/calculix-adapter.yaml +++ b/tools/tests/component-templates/calculix-adapter.yaml @@ -14,6 +14,7 @@ depends_on: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs +user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && diff --git a/tools/tests/component-templates/fenics-adapter.yaml b/tools/tests/component-templates/fenics-adapter.yaml index 1d1fbe6f3..20554fe3c 100644 --- a/tools/tests/component-templates/fenics-adapter.yaml +++ b/tools/tests/component-templates/fenics-adapter.yaml @@ -14,6 +14,7 @@ depends_on: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs +user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && diff --git a/tools/tests/component-templates/nutils-adapter.yaml b/tools/tests/component-templates/nutils-adapter.yaml index 2ff395dea..1a02114f0 100644 --- a/tools/tests/component-templates/nutils-adapter.yaml +++ b/tools/tests/component-templates/nutils-adapter.yaml @@ -14,6 +14,7 @@ depends_on: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs +user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && diff --git a/tools/tests/component-templates/openfoam-adapter.yaml b/tools/tests/component-templates/openfoam-adapter.yaml index e86dd6de4..19e4819c6 100644 --- a/tools/tests/component-templates/openfoam-adapter.yaml +++ b/tools/tests/component-templates/openfoam-adapter.yaml @@ -14,6 +14,7 @@ depends_on: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs +user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && diff --git a/tools/tests/docker-compose.field_compare.template.yaml b/tools/tests/docker-compose.field_compare.template.yaml index 21d35dfea..b47df6131 100644 --- a/tools/tests/docker-compose.field_compare.template.yaml +++ b/tools/tests/docker-compose.field_compare.template.yaml @@ -4,6 +4,7 @@ services: build: https://github.com/dglaeser/fieldcompare-action.git # use the docker container provided by fieldcompare volumes: - {{ run_directory }}:/runs + user: ${UID}:${GID} command: - /runs/{{ tutorial_folder }}/{{ precice_output_folder }} - /runs/{{ tutorial_folder }}/{{ reference_output_folder }} From cf18d809a509a4225d1a34e2f03a0c67d7fd5eee Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Mon, 25 Sep 2023 21:25:44 +0200 Subject: [PATCH 18/26] now setting the uid at build time --- tools/tests/component-templates/calculix-adapter.yaml | 1 - tools/tests/component-templates/fenics-adapter.yaml | 1 - tools/tests/component-templates/nutils-adapter.yaml | 1 - tools/tests/component-templates/openfoam-adapter.yaml | 1 - tools/tests/docker-compose.field_compare.template.yaml | 1 - tools/tests/docker-compose.template.yaml | 6 ++++-- tools/tests/dockerfiles/ubuntu_2204/Dockerfile | 5 +++-- tools/tests/systemtests/Systemtest.py | 8 ++++---- 8 files changed, 11 insertions(+), 13 deletions(-) diff --git a/tools/tests/component-templates/calculix-adapter.yaml b/tools/tests/component-templates/calculix-adapter.yaml index e809c37a5..c63e6591a 100644 --- a/tools/tests/component-templates/calculix-adapter.yaml +++ b/tools/tests/component-templates/calculix-adapter.yaml @@ -14,7 +14,6 @@ depends_on: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs -user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && diff --git a/tools/tests/component-templates/fenics-adapter.yaml b/tools/tests/component-templates/fenics-adapter.yaml index 20554fe3c..1d1fbe6f3 100644 --- a/tools/tests/component-templates/fenics-adapter.yaml +++ b/tools/tests/component-templates/fenics-adapter.yaml @@ -14,7 +14,6 @@ depends_on: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs -user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && diff --git a/tools/tests/component-templates/nutils-adapter.yaml b/tools/tests/component-templates/nutils-adapter.yaml index 1a02114f0..2ff395dea 100644 --- a/tools/tests/component-templates/nutils-adapter.yaml +++ b/tools/tests/component-templates/nutils-adapter.yaml @@ -14,7 +14,6 @@ depends_on: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs -user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && diff --git a/tools/tests/component-templates/openfoam-adapter.yaml b/tools/tests/component-templates/openfoam-adapter.yaml index 19e4819c6..e86dd6de4 100644 --- a/tools/tests/component-templates/openfoam-adapter.yaml +++ b/tools/tests/component-templates/openfoam-adapter.yaml @@ -14,7 +14,6 @@ depends_on: condition: service_completed_successfully volumes: - {{ run_directory }}:/runs -user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' && diff --git a/tools/tests/docker-compose.field_compare.template.yaml b/tools/tests/docker-compose.field_compare.template.yaml index b47df6131..21d35dfea 100644 --- a/tools/tests/docker-compose.field_compare.template.yaml +++ b/tools/tests/docker-compose.field_compare.template.yaml @@ -4,7 +4,6 @@ services: build: https://github.com/dglaeser/fieldcompare-action.git # use the docker container provided by fieldcompare volumes: - {{ run_directory }}:/runs - user: ${UID}:${GID} command: - /runs/{{ tutorial_folder }}/{{ precice_output_folder }} - /runs/{{ tutorial_folder }}/{{ reference_output_folder }} diff --git a/tools/tests/docker-compose.template.yaml b/tools/tests/docker-compose.template.yaml index 90d6578c1..e77d6eb6d 100644 --- a/tools/tests/docker-compose.template.yaml +++ b/tools/tests/docker-compose.template.yaml @@ -8,10 +8,12 @@ services: - type=gha cache_to: - type=gha,mode=max - + args: + {% for key, value in build_arguments.items() %} + - {{key}}={{value}} + {% endfor %} volumes: - {{ run_directory }}:/runs - user: ${UID}:${GID} command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}' && diff --git a/tools/tests/dockerfiles/ubuntu_2204/Dockerfile b/tools/tests/dockerfiles/ubuntu_2204/Dockerfile index 5eb69adf2..eaa866809 100644 --- a/tools/tests/dockerfiles/ubuntu_2204/Dockerfile +++ b/tools/tests/dockerfiles/ubuntu_2204/Dockerfile @@ -2,8 +2,9 @@ FROM ubuntu:22.04 as base_image USER root SHELL ["/bin/bash", "-c"] ENV DEBIAN_FRONTEND=noninteractive - -RUN useradd -ms /bin/bash precice +ARG PRECICE_UID=1000 +ARG PRECICE_GID=1000 +RUN groupadd -g ${PRECICE_GID} precice && useradd -u ${PRECICE_UID} -g ${PRECICE_GID} -ms /bin/bash precice ENV PATH="${PATH}:/home/precice/.local/bin" ENV LD_LIBRARY_PATH="/home/precice/.local/lib:${LD_LIBRARY_PATH}" ENV CPATH="/home/precice/.local/include:$CPATH" diff --git a/tools/tests/systemtests/Systemtest.py b/tools/tests/systemtests/Systemtest.py index 9b76a091d..a7cc0e775 100644 --- a/tools/tests/systemtests/Systemtest.py +++ b/tools/tests/systemtests/Systemtest.py @@ -195,6 +195,7 @@ def __get_docker_compose_file(self): 'tutorial_folder': self.tutorial_folder, 'tutorial': self.tutorial.path.name, 'services': rendered_services, + 'build_arguments': self.params_to_use, 'dockerfile_context': self.dockerfile_context, 'precice_output_folder': PRECICE_REL_OUTPUT_DIR, } @@ -479,10 +480,9 @@ def __prepare_for_run(self, run_directory: Path): self.__copy_tutorial_into_directory(run_directory) self.__copy_tools(run_directory) self.__put_gitignore(run_directory) - uid, gid = self.__get_uid_gid() - self.env["UID"] = uid - self.env["GID"] = gid - self.__write_env_file() + host_uid, host_gid = self.__get_uid_gid() + self.params_to_use['PRECICE_UID'] = host_uid + self.params_to_use['PRECICE_GID'] = host_gid def run(self, run_directory: Path): """ From a66648df12052d126abecda2ba444f3584fcacf0 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Mon, 25 Sep 2023 21:52:25 +0200 Subject: [PATCH 19/26] add scopes --- tools/tests/component-templates/calculix-adapter.yaml | 2 +- tools/tests/component-templates/fenics-adapter.yaml | 2 +- tools/tests/component-templates/nutils-adapter.yaml | 2 +- tools/tests/component-templates/openfoam-adapter.yaml | 2 +- tools/tests/docker-compose.template.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/tests/component-templates/calculix-adapter.yaml b/tools/tests/component-templates/calculix-adapter.yaml index c63e6591a..fdf1d8141 100644 --- a/tools/tests/component-templates/calculix-adapter.yaml +++ b/tools/tests/component-templates/calculix-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha,mode=max + - type=gha,mode=max,scope=calculix_adapter depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/fenics-adapter.yaml b/tools/tests/component-templates/fenics-adapter.yaml index 1d1fbe6f3..63d730fe8 100644 --- a/tools/tests/component-templates/fenics-adapter.yaml +++ b/tools/tests/component-templates/fenics-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha,mode=max + - type=gha,mode=max,scope=fenics_adapter depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/nutils-adapter.yaml b/tools/tests/component-templates/nutils-adapter.yaml index 2ff395dea..9f56a5f36 100644 --- a/tools/tests/component-templates/nutils-adapter.yaml +++ b/tools/tests/component-templates/nutils-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha,mode=max + - type=gha,mode=max,scope=nutils_adapter depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/openfoam-adapter.yaml b/tools/tests/component-templates/openfoam-adapter.yaml index e86dd6de4..bb9cc4f7c 100644 --- a/tools/tests/component-templates/openfoam-adapter.yaml +++ b/tools/tests/component-templates/openfoam-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha,mode=max + - type=gha,mode=max,scope=openfoam_adapter depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/docker-compose.template.yaml b/tools/tests/docker-compose.template.yaml index e77d6eb6d..b9a0df8d9 100644 --- a/tools/tests/docker-compose.template.yaml +++ b/tools/tests/docker-compose.template.yaml @@ -7,7 +7,7 @@ services: cache_from: - type=gha cache_to: - - type=gha,mode=max + - type=gha,mode=max,scope=prepare args: {% for key, value in build_arguments.items() %} - {{key}}={{value}} From c13715ebbdb916347e8eb876f178b8836007453e Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Mon, 25 Sep 2023 21:55:10 +0200 Subject: [PATCH 20/26] add more relaxed rtol to stop them from failing --- tools/tests/docker-compose.field_compare.template.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/tests/docker-compose.field_compare.template.yaml b/tools/tests/docker-compose.field_compare.template.yaml index 21d35dfea..bca06b03d 100644 --- a/tools/tests/docker-compose.field_compare.template.yaml +++ b/tools/tests/docker-compose.field_compare.template.yaml @@ -7,3 +7,4 @@ services: command: - /runs/{{ tutorial_folder }}/{{ precice_output_folder }} - /runs/{{ tutorial_folder }}/{{ reference_output_folder }} + - "-rtol 1e-4" From 4a44a3e6afbd68565a816de1cafb4aca8ce5292b Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Mon, 25 Sep 2023 22:29:30 +0200 Subject: [PATCH 21/26] try min --- tools/tests/component-templates/calculix-adapter.yaml | 2 +- tools/tests/component-templates/fenics-adapter.yaml | 2 +- tools/tests/component-templates/nutils-adapter.yaml | 2 +- tools/tests/component-templates/openfoam-adapter.yaml | 2 +- tools/tests/docker-compose.template.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/tests/component-templates/calculix-adapter.yaml b/tools/tests/component-templates/calculix-adapter.yaml index fdf1d8141..373c6e0f1 100644 --- a/tools/tests/component-templates/calculix-adapter.yaml +++ b/tools/tests/component-templates/calculix-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha,mode=max,scope=calculix_adapter + - type=gha,mode=min,scope=calculix_adapter depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/fenics-adapter.yaml b/tools/tests/component-templates/fenics-adapter.yaml index 63d730fe8..52177d719 100644 --- a/tools/tests/component-templates/fenics-adapter.yaml +++ b/tools/tests/component-templates/fenics-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha,mode=max,scope=fenics_adapter + - type=gha,mode=min,scope=fenics_adapter depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/nutils-adapter.yaml b/tools/tests/component-templates/nutils-adapter.yaml index 9f56a5f36..ee98f1ec1 100644 --- a/tools/tests/component-templates/nutils-adapter.yaml +++ b/tools/tests/component-templates/nutils-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha,mode=max,scope=nutils_adapter + - type=gha,mode=min,scope=nutils_adapter depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/component-templates/openfoam-adapter.yaml b/tools/tests/component-templates/openfoam-adapter.yaml index bb9cc4f7c..e3821247a 100644 --- a/tools/tests/component-templates/openfoam-adapter.yaml +++ b/tools/tests/component-templates/openfoam-adapter.yaml @@ -8,7 +8,7 @@ build: cache_from: - type=gha cache_to: - - type=gha,mode=max,scope=openfoam_adapter + - type=gha,mode=min,scope=openfoam_adapter depends_on: prepare: condition: service_completed_successfully diff --git a/tools/tests/docker-compose.template.yaml b/tools/tests/docker-compose.template.yaml index b9a0df8d9..3d5620b0f 100644 --- a/tools/tests/docker-compose.template.yaml +++ b/tools/tests/docker-compose.template.yaml @@ -7,7 +7,7 @@ services: cache_from: - type=gha cache_to: - - type=gha,mode=max,scope=prepare + - type=gha,mode=min,scope=prepare args: {% for key, value in build_arguments.items() %} - {{key}}={{value}} From 8711e5daec7005a3be98ed23162aeaaca6bc6e7c Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Mon, 25 Sep 2023 23:00:59 +0200 Subject: [PATCH 22/26] refactor into reusable workflow --- .github/workflows/run_testsuite_manual.yml | 36 +++++++++++++++++++ ...stsuite.yml => run_testsuite_workflow.yml} | 22 ++++-------- 2 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/run_testsuite_manual.yml rename .github/workflows/{run_testsuite.yml => run_testsuite_workflow.yml} (78%) diff --git a/.github/workflows/run_testsuite_manual.yml b/.github/workflows/run_testsuite_manual.yml new file mode 100644 index 000000000..54781d30b --- /dev/null +++ b/.github/workflows/run_testsuite_manual.yml @@ -0,0 +1,36 @@ +name: Run Testsuite (manual) # Unfortunately, we cannot modify the name: https://github.community/t/github-actions-dynamic-name-of-the-workflow-with-workflow-dispatch/150327 +on: + workflow_dispatch: + inputs: + suites: + description: 'Comma seperated testsuites to execute' + required: true + type: string + build_args: + description: 'Build arguments, if not specified defaults will be taken' + required: false + type: string + systests_branch: + description: 'Branch to take the systest from' + default: 'develop' + required: true + type: string + loglevel: + description: 'loglevel used for the systemtests' + default: 'INFO' + required: true + type: choice + options: + - 'DEBUG' + - 'INFO' + - 'WARNING' + - 'ERROR' + - 'CRITICAL' +jobs: + run_testsuite_manual: + uses: ./.github/workflows/run_testsuite_workflow.yml + with: + suites: ${{ inputs.suites }} + build_args: ${{ inputs.build_args }} + systests_branch: ${{ inputs.systests_branch }} + loglevel: ${{ inputs.loglevel }} \ No newline at end of file diff --git a/.github/workflows/run_testsuite.yml b/.github/workflows/run_testsuite_workflow.yml similarity index 78% rename from .github/workflows/run_testsuite.yml rename to .github/workflows/run_testsuite_workflow.yml index 184eba6f8..933eb8845 100644 --- a/.github/workflows/run_testsuite.yml +++ b/.github/workflows/run_testsuite_workflow.yml @@ -1,6 +1,6 @@ -name: Run Testsuite (manual) # Unfortunately, we cannot modify the name: https://github.community/t/github-actions-dynamic-name-of-the-workflow-with-workflow-dispatch/150327 +name: Run Testsuite Workflow on: - workflow_dispatch: + workflow_call: inputs: suites: description: 'Comma seperated testsuites to execute' @@ -14,24 +14,14 @@ on: description: 'Branch to take the systest from' default: 'develop' required: true - type: choice - options: - - 'develop' - - 'master' - - 'add-test-workflows' + type: string loglevel: description: 'loglevel used for the systemtests' default: 'INFO' - required: true - type: choice - options: - - 'DEBUG' - - 'INFO' - - 'WARNING' - - 'ERROR' - - 'CRITICAL' + required: false + type: string jobs: - build: + run_testsuite: runs-on: ubuntu-latest steps: - name: Report log From 7454d8dbedc9475f792f3fa92227bf05cf7e6e7f Mon Sep 17 00:00:00 2001 From: valentin-seitz Date: Tue, 26 Sep 2023 08:11:41 +0200 Subject: [PATCH 23/26] Update docker-compose.template.yaml --- tools/tests/docker-compose.template.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/tests/docker-compose.template.yaml b/tools/tests/docker-compose.template.yaml index 3d5620b0f..2df2c144f 100644 --- a/tools/tests/docker-compose.template.yaml +++ b/tools/tests/docker-compose.template.yaml @@ -17,8 +17,6 @@ services: command: > /bin/bash -c "id && cd '/runs/{{ tutorial_folder }}' && - ls -al && - touch somefile.permissions && sed -i 's%% %g' precice-config.xml && sed -i 's|m2n:sockets from|m2n:sockets network=\"eth0\" from|g' precice-config.xml && cat precice-config.xml" @@ -27,4 +25,4 @@ services: {% for service in services %} {{ service }}: {{ services[service] |indent(4) }} - {% endfor %} \ No newline at end of file + {% endfor %} From 60b6d7ec8a3bddaa8e6e5fbe32e56b30b35f650b Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 26 Sep 2023 08:25:13 +0200 Subject: [PATCH 24/26] MAKE PEP8 happy --- tools/tests/systemtests/Systemtest.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/tests/systemtests/Systemtest.py b/tools/tests/systemtests/Systemtest.py index a7cc0e775..b8dae1d6a 100644 --- a/tools/tests/systemtests/Systemtest.py +++ b/tools/tests/systemtests/Systemtest.py @@ -229,14 +229,13 @@ 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_ref(self, repository: Path, ref: str): try: result = subprocess.run([ "git", "-C", os.fspath(repository.resolve()), - "fetch", - "origin", + "fetch", + "origin", f"{ref}:{ref}" ], check=True, timeout=60) if result.returncode != 0: @@ -269,7 +268,7 @@ def __copy_tutorial_into_directory(self, run_directory: Path): ref_requested = self.params_to_use.get("TUTORIALS_REF") if ref_requested: logging.debug(f"Checking out tutorials {ref_requested} before copying") - self._fetch_ref(PRECICE_TUTORIAL_DIR,ref_requested) + self._fetch_ref(PRECICE_TUTORIAL_DIR, ref_requested) self._checkout_ref_in_subfolder(PRECICE_TUTORIAL_DIR, self.tutorial.path, ref_requested) self.tutorial_folder = slugify(f'{self.tutorial.path.name}_{self.case_combination.cases}_{current_time_string}') From 080a288d133a76e8b53cbc14ba3aacb9835c4305 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Thu, 5 Oct 2023 09:49:40 +0200 Subject: [PATCH 25/26] Added a bit of documentation --- .github/workflows/run_testsuite_workflow.yml | 6 +++--- tools/tests/README.md | 16 ++++++++++++++++ tools/tests/dockerfiles/ubuntu_2204/Dockerfile | 4 ++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_testsuite_workflow.yml b/.github/workflows/run_testsuite_workflow.yml index 933eb8845..2e2781270 100644 --- a/.github/workflows/run_testsuite_workflow.yml +++ b/.github/workflows/run_testsuite_workflow.yml @@ -30,7 +30,7 @@ jobs: echo "Running systemtests --build_args=${{github.event.inputs.build_args}} --suites=${{github.event.inputs.suites}}" echo "Systemtests branch: ${{ github.event.inputs.systests_branch }}" - name: Check out Tutorials for systest - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.systests_branch }} lfs: true @@ -47,7 +47,7 @@ jobs: - name: install python depencies run: | python -m pip install -r ./tools/tests/requirements.txt - - name: Expose GitHub Runtime + - name: Expose GitHub Runtime (needed for accessing the gha cache) uses: crazy-max/ghaction-github-runtime@v3 - name: Run tests run: | @@ -56,7 +56,7 @@ jobs: cd ../../ - name: Archive run files if: success() || failure() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: runs path: | diff --git a/tools/tests/README.md b/tools/tests/README.md index 93c7b44b4..64a2c120d 100644 --- a/tools/tests/README.md +++ b/tools/tests/README.md @@ -19,6 +19,22 @@ python3 systemtests.py --suites=openfoam-adapter-release, To discover all tests, use `python print_test_suites.py`. To be able to fill in the right case tuple into the `tests.yaml`, you can use the `python3 print_case_combinations.py` script. +## Adding new tests + +### Adding tutorials + +In order for the systemtests to pick up the tutorial we need to define a `metadata.yaml` in the folder of the tutorial. There are a few `metadata.yaml` already present to get inspiration from. You can also have a look at the implementation details but normally the currently available ones should be easy to adopt. You can check your metadata parsing by `python print_metadata.py` and `python print_case_combinations.py` + +### Adding Testsuites + +To add a testsuite just open the `tests.yaml` file and use the output of `python print_case_combinations.py` to add the right case combinations you want to test. Note that you can specify a `reference_result` which is not yet present. The `generate_reference_data.py` will pick that up and create it for you. +Note that its important to carefully check the paths of the `reference_result` in order to not have typos in there. Also note that same cases in different testsuites should use the same `reference_result`. + +### Generate reference results + +Since we need data to compare against, you need to run `python generate_reference_data.py`. This process might take a while. +Please include the generated reference results in the pull request as they are strongly connected to the new testsuites. + ## Implementation details Each tutorial contains automation scripts (mainly `run.sh` and `clean.sh`), as well as metadata (`metadata.yaml`). The metadata file describes the available cases, how to run them, as well as their dependencies. A central `tests.yaml` file in this directory defines test suites, which execute different combinations of cases. The Python script `systemtests.py` executes the tests, allowing to filter for specific components or test suites. diff --git a/tools/tests/dockerfiles/ubuntu_2204/Dockerfile b/tools/tests/dockerfiles/ubuntu_2204/Dockerfile index eaa866809..e31e911a1 100644 --- a/tools/tests/dockerfiles/ubuntu_2204/Dockerfile +++ b/tools/tests/dockerfiles/ubuntu_2204/Dockerfile @@ -2,6 +2,10 @@ FROM ubuntu:22.04 as base_image USER root SHELL ["/bin/bash", "-c"] ENV DEBIAN_FRONTEND=noninteractive +# We set a sensical value, but still have the possibilty to influence this via the build time arguments. +# When the dockerfile is built using the systemtests.py we set the PRECICE_UID and PRECICE_GID to the user executing the systemtests. +# This ensures no file ownership problems down the line and is the most easy fix, as we normally built the containers locally +# If not built via the systemtests.py its either possible to specify manually but 1000 would be the default anyway. ARG PRECICE_UID=1000 ARG PRECICE_GID=1000 RUN groupadd -g ${PRECICE_GID} precice && useradd -u ${PRECICE_UID} -g ${PRECICE_GID} -ms /bin/bash precice From c19183408acb2cd4d81ac3fea2a80f67fc8cc349 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Thu, 5 Oct 2023 09:57:40 +0200 Subject: [PATCH 26/26] tightend reltol fieldcompare a bit --- tools/tests/docker-compose.field_compare.template.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/tests/docker-compose.field_compare.template.yaml b/tools/tests/docker-compose.field_compare.template.yaml index bca06b03d..4e86de2e7 100644 --- a/tools/tests/docker-compose.field_compare.template.yaml +++ b/tools/tests/docker-compose.field_compare.template.yaml @@ -7,4 +7,7 @@ services: command: - /runs/{{ tutorial_folder }}/{{ precice_output_folder }} - /runs/{{ tutorial_folder }}/{{ reference_output_folder }} - - "-rtol 1e-4" + - "-rtol 3e-7" + +# Currently its really hard to estimate the impact of compiling and executing in a different platform (like github actions) +# 3e-7 might not be the thightest we can afford and we want to have but its an okayish guestimation for now. \ No newline at end of file