@@ -2,87 +2,91 @@ name: Docker-based CI
22
33on :
44 push :
5- branches :
6- - dumux_and_rotating_cylinder
5+ branches : [ main ]
76 pull_request :
8- branches :
9- - dumux_and_rotating_cylinder
7+ branches : [ main ]
108 workflow_dispatch :
11- schedule :
12- - cron : ' 3 16 * * *'
9+ # schedule:
10+ # - cron: '3 16 * * *'
11+
12+ permissions :
13+ contents : write
1314
1415jobs :
15- # -----------------------------
16- # Build Docker images (Linux only)
17- # -----------------------------
1816 build-docker :
1917 runs-on : ubuntu-latest
2018 steps :
2119 - uses : actions/checkout@v4
20+ with :
21+ persist-credentials : false
2222
23- - name : Build base image
24- id : base
25- run : |
26- docker build -t ci-base -f dockerfiles/Dockerfile.base .
23+ # -----------------------------
24+ # Build Docker images
25+ # -----------------------------
26+ - name : Build base image (mesh generation included)
27+ run : docker build -t ci-base -f dockerfiles/Dockerfile.base .
2728
28- - name : Build Docker images
29+ - name : Build Fenics image (simulations included)
30+ run : docker build -t ci-fenics -f dockerfiles/Dockerfile.fenics .
31+
32+ - name : Build Kratos image (simulations included)
33+ run : docker build -t ci-kratos -f dockerfiles/Dockerfile.kratos .
34+
35+ # -----------------------------
36+ # Extract Fenics results
37+ # -----------------------------
38+ - name : Extract Results from Fenics container
2939 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 .
40+ docker create --name fenics_temp ci-fenics
41+ # Copy the results folder as-is from container to host
42+ docker cp fenics_temp:/sim/benchmarks/linear-elastic-plate-with-hole/results ./benchmarks/linear-elastic-plate-with-hole/
43+ docker rm fenics_temp
3444
35- - name : Generate config and mesh
45+ # -----------------------------
46+ # Extract Kratos results
47+ # -----------------------------
48+ - name : Extract Kratos results
3649 run : |
37- docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace/benchmarks/linear-elastic-plate-with-hole ci-mesh \
38- python generate_config.py
50+ docker create --name kratos_temp ci-kratos
51+ # Copy the results folder as-is from container to host
52+ docker cp kratos_temp:/sim/benchmarks/linear-elastic-plate-with-hole/results ./benchmarks/linear-elastic-plate-with-hole/
53+ docker rm kratos_temp
3954
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'
55+ # -----------------------------
56+ # Upload Artifacts
57+ # -----------------------------
58+ - name : Upload Artifacts
59+ uses : actions/upload-artifact@v4
60+ with :
61+ name : workflow-results
62+ path : |
63+ benchmarks/linear-elastic-plate-with-hole/results/fenics
64+ benchmarks/linear-elastic-plate-with-hole/results/kratos
4665
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'
66+ # # -----------------------------
67+ # # Optional: commit generated results to GitHub
68+ # # -----------------------------
69+ # - name: Commit generated results
70+ # env:
71+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+ # run: |
73+ # git config --global user.name "github-actions[bot]"
74+ # git config --global user.email "github-actions[bot]@users.noreply.github.com"
7275
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'
76+ # # Create a flat zip of the simulation results
77+ # cd benchmarks/linear-elastic-plate-with-hole
78+ # tar -cJf simulation_results.tar.xz results
79+ # cd ../..
80+
81+ # # Add only the zip
82+ # git add -f benchmarks/linear-elastic-plate-with-hole/simulation_results.tar.xz
83+
84+ # git commit -m "Add generated simulation results" || echo "No changes to commit"
85+ # git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:main
86+
87+ # - name: Build Postprocessing image
88+ # run: |
89+ # docker build -t ci-postprocessing -f dockerfiles/Dockerfile.postprocessing .
8690
8791 # - name: Postprocessing (metadata + extraction + plot)
8892 # run: |
@@ -93,21 +97,11 @@ jobs:
9397 # bash -c '
9498 # echo "Generating metadata...";
9599 # python parameter_extractor.py ./results metadata4ing_provenance.zip;
96-
100+ #
97101 # echo "Extracting ZIP...";
98102 # mkdir -p ./metadata4ing_provenance;
99103 # unzip -o metadata4ing_provenance.zip -d ./metadata4ing_provenance;
100-
104+ #
101105 # echo "Plotting provenance...";
102106 # 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
107+ # '
0 commit comments