From 4269e1f42d8280422753f2a4da39fb83912f9591 Mon Sep 17 00:00:00 2001 From: Carlos Roig Date: Fri, 10 Mar 2023 11:59:15 +0100 Subject: [PATCH] Adding CI --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ run_examples.py | 17 +++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 run_examples.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..5ca9aff8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: Examples-CI + +on: + pull_request: + branches: + - master + +concurrency: + group: ci-${{ github.head_ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + ubuntu: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Dependencies + shell: bash + run: python3 -m pip install KratosMultiphysics-all + + - name: Running examples + shell: bash + run: python3 ${GITHUB_WORKSPACE}/run_examples.py \ No newline at end of file diff --git a/run_examples.py b/run_examples.py new file mode 100644 index 00000000..03da3082 --- /dev/null +++ b/run_examples.py @@ -0,0 +1,17 @@ +import os +import sys +import pathlib +import subprocess + +rootdir = "." +current = os.getcwd() + +for subdir, dirs, files in os.walk(rootdir): + for filename in files: + p = pathlib.PurePath(current, subdir, filename) + + if p.name == "MainKratos.py": + sp = subprocess.Popen([sys.executable, p], cwd=p.parents[0]) + x = sp.wait() + + print("Exit with code", x) \ No newline at end of file