Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit abe114a

Browse files
author
Casale Benjamin
committed
chore(ci,example): add examples to ci
1 parent 219fc60 commit abe114a

7 files changed

Lines changed: 66 additions & 8 deletions

File tree

.github/workflows/examples.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Run Examples (after tests)
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Rust Test"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
run_example:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install system dependencies
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y cmake libhdf5-dev
21+
22+
- name: Install Rust
23+
uses: actions-rs/toolchain@v1
24+
with:
25+
toolchain: stable
26+
profile: minimal
27+
override: true
28+
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v5
31+
with:
32+
version: "0.7.11"
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version-file: "pyproject.toml"
38+
39+
- name: Run examples
40+
run: |
41+
cargo run --release --example rust
42+
cargo run --release --example rust_hist
43+
uv run examples/python/example_python.py
44+
45+
- name: Archive output files
46+
run: |
47+
mkdir -p artefact
48+
find examples/ -type f \( -name "*.svg" -o -name "*.png" -o -name "*.html" \) -exec cp --parents {} artefact/ \;
49+
tar -cvf artefact.tar -C artefact .
50+
51+
- name: Upload artifact
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: example-artefact
55+
path: artefact.tar

.github/workflows/rust_test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: rust_test
22

33
on:
4+
workflow_call: {}
45
push:
56
branches:
67
- main
7-
- test_ci
8+
- "0.5"
89
tags:
910
- '*'
1011
pull_request:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ docs/_build/
7272

7373
# Pyenv
7474
.python-version
75+
76+
*.htmlcov
77+
*.svg
78+
*.png

biomc_pp/main.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import timeit
66
def test():
7-
pp = biomc_pp.PostProcess("cstr","/home/benjamin/Documents/code/cpp/BioCMA-MCST/results/")
7+
pp = biomc_pp.PostProcess("example0d","examples/")
88
return pp.get_number_particle()
99

1010
def main():
@@ -14,7 +14,7 @@ def main():
1414
# c =results.get_spatial_average_concentration(0,biomc_pp.Phase.Liquid)
1515
# ctt =results.get_time_average_concentration(0,0,biomc_pp.Phase.Liquid)
1616

17-
pp = biomc_pp.PostProcess("test","/home_pers/casale/Documents/code/biomc/results/")
17+
pp = biomc_pp.PostProcess("example0d","examples/")
1818

1919
p = pp.get_growth_in_number()
2020

@@ -53,5 +53,3 @@ def calculate_mean2():
5353

5454

5555

56-
57-
main()

examples/python/example_python.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
X = pp.get_biomass_concentration()
1010
plt.plot(time,X)
1111
plt.title("Biomass concentration")
12-
plt.savefig("./examples/out_py.png")
12+
plt.savefig("./examples/out_python_2.png")
1313

1414

1515
n,c= pp.get_histogram(50,pp.n_export - 1, "nu_eff_2")
@@ -25,4 +25,4 @@
2525
alpha=0.7,
2626
color="blue",
2727
)
28-
plt.show()
28+
plt.savefig("./examples/out_python.png")

examples/python/out_py.png

-22.8 KB
Binary file not shown.

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)