|
| 1 | +name: Docker-based CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - dumux_and_rotating_cylinder |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - dumux_and_rotating_cylinder |
| 10 | + workflow_dispatch: |
| 11 | + schedule: |
| 12 | + - cron: '3 16 * * *' |
| 13 | + |
| 14 | +jobs: |
| 15 | + # ----------------------------- |
| 16 | + # Build Docker images (Linux only) |
| 17 | + # ----------------------------- |
| 18 | + build-docker: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Build base image |
| 24 | + id: base |
| 25 | + run: | |
| 26 | + docker build -t ci-base -f dockerfiles/Dockerfile.base . |
| 27 | +
|
| 28 | + - name: Build Docker images |
| 29 | + run: | |
| 30 | + docker build -t ci-mesh -f dockerfiles/Dockerfile.mesh . |
| 31 | + docker build -t ci-fenics -f dockerfiles/Dockerfile.fenics . |
| 32 | + docker build -t ci-kratos -f dockerfiles/Dockerfile.kratos . |
| 33 | + docker build -t ci-postprocessing -f dockerfiles/Dockerfile.postprocessing . |
| 34 | +
|
| 35 | + - name: Generate config and mesh |
| 36 | + run: | |
| 37 | + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace/benchmarks/linear-elastic-plate-with-hole ci-mesh \ |
| 38 | + python generate_config.py |
| 39 | +
|
| 40 | + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace/benchmarks/linear-elastic-plate-with-hole ci-mesh \ |
| 41 | + bash -c 'mkdir -p results/linear-elastic-plate-with-hole/mesh && \ |
| 42 | + for f in parameters_*.json; do \ |
| 43 | + python create_mesh.py --input_parameter_file "$f" \ |
| 44 | + --output_mesh_file "results/linear-elastic-plate-with-hole/mesh/mesh_${f%.json}.msh"; \ |
| 45 | + done' |
| 46 | +
|
| 47 | + - name: Run Kratos simulations |
| 48 | + run: | |
| 49 | + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace/benchmarks/linear-elastic-plate-with-hole ci-kratos \ |
| 50 | + bash -c 'mkdir -p results/linear-elastic-plate-with-hole/kratos && \ |
| 51 | + for f in parameters_*.json; do \ |
| 52 | + # Convert mesh to MDPA |
| 53 | + python kratos/msh_to_mdpa.py \ |
| 54 | + --input_parameter_file "$f" \ |
| 55 | + --input_mesh_file "results/linear-elastic-plate-with-hole/mesh/mesh_${f%.json}.msh" \ |
| 56 | + --output_mdpa_file "results/linear-elastic-plate-with-hole/kratos/mesh_${f%.json}.mdpa"; \ |
| 57 | + \ |
| 58 | + # Create Kratos input and run simulation |
| 59 | + python kratos/create_kratos_input.py \ |
| 60 | + --input_parameter_file "$f" \ |
| 61 | + --input_mdpa_file "results/linear-elastic-plate-with-hole/kratos/mesh_${f%.json}.mdpa" \ |
| 62 | + --input_kratos_input_template kratos/input_template.json \ |
| 63 | + --input_material_template kratos/StructuralMaterials_template.json \ |
| 64 | + --output_kratos_inputfile "results/linear-elastic-plate-with-hole/kratos/ProjectParameters_${f%.json}.json" \ |
| 65 | + --output_kratos_materialfile "results/linear-elastic-plate-with-hole/kratos/MaterialParameters_${f%.json}.json"; \ |
| 66 | + \ |
| 67 | + python kratos/run_kratos_simulation.py \ |
| 68 | + --input_parameter_file "$f" \ |
| 69 | + --input_kratos_inputfile "results/linear-elastic-plate-with-hole/kratos/ProjectParameters_${f%.json}.json" \ |
| 70 | + --input_kratos_materialfile "results/linear-elastic-plate-with-hole/kratos/MaterialParameters_${f%.json}.json"; \ |
| 71 | + done' |
| 72 | +
|
| 73 | + - name: Run fenics simulations |
| 74 | + run: | |
| 75 | + docker run --rm -v ${{ github.workspace }}:/workspace \ |
| 76 | + -w /workspace/benchmarks/linear-elastic-plate-with-hole ci-fenics \ |
| 77 | + bash -c 'mkdir -p results/linear-elastic-plate-with-hole/fenics && \ |
| 78 | + for f in parameters_*.json; do \ |
| 79 | + config_name="${f%.json}"; \ |
| 80 | + python fenics/run_fenics_simulation.py \ |
| 81 | + --input_parameter_file "$f" \ |
| 82 | + --input_mesh_file "results/linear-elastic-plate-with-hole/mesh/mesh_${config_name}.msh" \ |
| 83 | + --output_solution_file_zip "results/linear-elastic-plate-with-hole/fenics/solution_field_data_${config_name}.zip" \ |
| 84 | + --output_metrics_file "results/linear-elastic-plate-with-hole/fenics/solution_metrics_${config_name}.json"; \ |
| 85 | + done' |
| 86 | +
|
| 87 | + # - name: Postprocessing (metadata + extraction + plot) |
| 88 | + # run: | |
| 89 | + # docker run --rm \ |
| 90 | + # -v ${{ github.workspace }}:/workspace \ |
| 91 | + # -w /workspace/benchmarks/linear-elastic-plate-with-hole \ |
| 92 | + # ci-postprocessing \ |
| 93 | + # bash -c ' |
| 94 | + # echo "Generating metadata..."; |
| 95 | + # python parameter_extractor.py ./results metadata4ing_provenance.zip; |
| 96 | + |
| 97 | + # echo "Extracting ZIP..."; |
| 98 | + # mkdir -p ./metadata4ing_provenance; |
| 99 | + # unzip -o metadata4ing_provenance.zip -d ./metadata4ing_provenance; |
| 100 | + |
| 101 | + # echo "Plotting provenance..."; |
| 102 | + # python plot_provenance.py ./metadata4ing_provenance |
| 103 | + # ' |
| 104 | + |
| 105 | + - name: Upload Artifacts |
| 106 | + uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + name: workflow-results |
| 109 | + path: |
| 110 | + benchmarks/linear-elastic-plate-with-hole/results |
| 111 | + # benchmarks/linear-elastic-plate-with-hole/metadata4ing_provenance/ |
| 112 | + # benchmarks/linear-elastic-plate-with-hole/metadata4ing_provenance.zip |
| 113 | + # benchmarks/linear-elastic-plate-with-hole/*.pdf |
0 commit comments