Skip to content

Ice thermal conductivity kinetic correction fix and example revision #88

Ice thermal conductivity kinetic correction fix and example revision

Ice thermal conductivity kinetic correction fix and example revision #88

name: docs_code
defaults:
run:
shell: bash
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 13 * * 4'
jobs:
python:
strategy:
matrix:
platform: [ubuntu-latest, macos-14, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4.1.6
- uses: actions/setup-python@v7.0.0
with:
python-version: "3.11"
- run: python -m pip install $PIP_INSTALL_ARGS -e .[CI_version_pins]
- run: python -m pip install $PIP_INSTALL_ARGS pytest-codeblocks pytest
- run: |
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()"
- run: cat -n docs_code.py
- name: run-on-cpu-backend
run: |
python -We docs_code.py
- name: run-on-gpu-backend
run: |
sed -i -e 's/CPU/GPU/g' docs_code.py
python -We docs_code.py
- name: artefacts
if: github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest'
uses: eine/tip@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
readme.png
- name: run-with-jax-backend
run: |
sed -i -e 's/GPU/JAX/g' docs_code.py
sed -i -e 's/Coalescence(/Coalescence(adaptive=False,/g' docs_code.py
awk "{print}; /readme.png/ {exit}" docs_code.py > docs_code_jax.py
python -We docs_code_jax.py
- name: jax-artefacts
uses: actions/upload-artifact@v4
with:
name: jax
if-no-files-found: error
path: readme.png
julia:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4.1.6
- uses: actions/setup-python@v7.0.0
with:
python-version: "3.11"
- run: pip install -e .[CI_version_pins]
- run: pip install pytest-codeblocks pytest
- 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()"
- uses: julia-actions/setup-julia@v3
- run: cat -n docs_code.jl
- run: echo PYTHON=`which python` >> $GITHUB_ENV
- run: julia docs_code.jl
- run: sed -i -e 's/CPU/GPU/g' docs_code.jl
- run: julia docs_code.jl
matlab:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.6
- uses: actions/setup-python@v7.0.0
with:
python-version: "3.12"
- run: echo NUMBA_THREADING_LAYER=workqueue >> $GITHUB_ENV
- run: pip install -e .[CI_version_pins]
- run: pip install pytest-codeblocks pytest
- 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()"
- run: cat -n docs_code.m
- uses: matlab-actions/setup-matlab@v3.0.2
with:
release: R2024b
cache: true
- uses: matlab-actions/run-command@v3.2
with:
command: docs_code
- run: sed -i -e 's/CPU/GPU/g' docs_code.m
- uses: matlab-actions/run-command@v3.2
with:
command: docs_code
- name: artefacts
if: github.ref == 'refs/heads/main'
uses: eine/tip@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
parcel.png