1- name : tutorial_code
1+ name : docs_code
22
33defaults :
44 run :
@@ -16,22 +16,25 @@ jobs:
1616 python :
1717 strategy :
1818 matrix :
19- platform : [ubuntu-latest, macos-15-intel, macos- 14, windows-latest]
19+ platform : [ubuntu-latest, macos-14, windows-latest]
2020 runs-on : ${{ matrix.platform }}
2121 steps :
2222 - uses : actions/checkout@v4.1.6
2323 - uses : actions/setup-python@v7.0.0
2424 with :
25- python-version : " 3.10 "
25+ python-version : " 3.11 "
2626 - run : python -m pip install $PIP_INSTALL_ARGS -e .[CI_version_pins]
2727 - run : python -m pip install $PIP_INSTALL_ARGS pytest-codeblocks pytest
2828 - run : |
29- python -c "import os,pytest_codeblocks; code=pytest_codeblocks.extract_from_file('docs/markdown/pysdm_landing.md'); f=open('tutorial_code.py', 'w', encoding='utf-8'); f.write('# coding: utf-8'+os.linesep); f.writelines(block.code for block in code if block.syntax=='Python'); f.close()"
30- - run : cat -n tutorial_code.py
31- - run : |
32- python -We tutorial_code.py
33- sed -i -e 's/CPU/GPU/g' tutorial_code.py
34- python -We tutorial_code.py
29+ python -c "import os,pytest_codeblocks; code=pytest_codeblocks.extract_from_file('docs/markdown/pysdm_landing.md'); f=open('docs_code.py', 'w', encoding='utf-8'); f.write('# coding: utf-8'+os.linesep); f.writelines(block.code for block in code if block.syntax=='Python'); f.close()"
30+ - run : cat -n docs_code.py
31+ - name : run-on-cpu-backend
32+ run : |
33+ python -We docs_code.py
34+ - name : run-on-gpu-backend
35+ run : |
36+ sed -i -e 's/CPU/GPU/g' docs_code.py
37+ python -We docs_code.py
3538
3639 - name : artefacts
3740 if : github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest'
@@ -40,23 +43,35 @@ jobs:
4043 token : ${{ secrets.GITHUB_TOKEN }}
4144 files : |
4245 readme.png
46+ - name : run-with-jax-backend
47+ run : |
48+ sed -i -e 's/GPU/JAX/g' docs_code.py
49+ sed -i -e 's/Coalescence(/Coalescence(adaptive=False,/g' docs_code.py
50+ awk "{print}; /readme.png/ {exit}" docs_code.py > docs_code_jax.py
51+ python -We docs_code_jax.py
52+ - name : jax-artefacts
53+ uses : actions/upload-artifact@v4
54+ with :
55+ name : jax
56+ if-no-files-found : error
57+ path : readme.png
4358
4459 julia :
4560 runs-on : macos-latest
4661 steps :
4762 - uses : actions/checkout@v4.1.6
4863 - uses : actions/setup-python@v7.0.0
4964 with :
50- python-version : " 3.10 "
65+ python-version : " 3.11 "
5166 - run : pip install -e .[CI_version_pins]
5267 - run : pip install pytest-codeblocks pytest
53- - run : python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('docs/markdown/pysdm_landing.md'); f=open('tutorial_code .jl', 'w'); f.writelines(block.code for block in code if block.syntax=='Julia'); f.close()"
68+ - run : python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('docs/markdown/pysdm_landing.md'); f=open('docs_code .jl', 'w'); f.writelines(block.code for block in code if block.syntax=='Julia'); f.close()"
5469 - uses : julia-actions/setup-julia@v3
55- - run : cat -n tutorial_code .jl
70+ - run : cat -n docs_code .jl
5671 - run : echo PYTHON=`which python` >> $GITHUB_ENV
57- - run : julia tutorial_code .jl
58- - run : sed -i -e 's/CPU/GPU/g' tutorial_code .jl
59- - run : julia tutorial_code .jl
72+ - run : julia docs_code .jl
73+ - run : sed -i -e 's/CPU/GPU/g' docs_code .jl
74+ - run : julia docs_code .jl
6075
6176 matlab :
6277 runs-on : ubuntu-latest
@@ -70,19 +85,19 @@ jobs:
7085
7186 - run : pip install -e .[CI_version_pins]
7287 - run : pip install pytest-codeblocks pytest
73- - run : python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('docs/markdown/pysdm_landing.md'); f=open('tutorial_code .m', 'w'); f.writelines(block.code for block in code if block.syntax=='Matlab'); f.close()"
74- - run : cat -n tutorial_code .m
88+ - run : python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('docs/markdown/pysdm_landing.md'); f=open('docs_code .m', 'w'); f.writelines(block.code for block in code if block.syntax=='Matlab'); f.close()"
89+ - run : cat -n docs_code .m
7590 - uses : matlab-actions/setup-matlab@v3.0.2
7691 with :
7792 release : R2024b
7893 cache : true
7994 - uses : matlab-actions/run-command@v3.2
8095 with :
81- command : tutorial_code
82- - run : sed -i -e 's/CPU/GPU/g' tutorial_code .m
96+ command : docs_code
97+ - run : sed -i -e 's/CPU/GPU/g' docs_code .m
8398 - uses : matlab-actions/run-command@v3.2
8499 with :
85- command : tutorial_code
100+ command : docs_code
86101
87102 - name : artefacts
88103 if : github.ref == 'refs/heads/main'
0 commit comments