-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Rust code snippets to the tutorial (incl. CI execution) (#450)
Co-authored-by: Sylwester Arabas <[email protected]>
- Loading branch information
Showing
2 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: readme_rust | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
schedule: | ||
- cron: '0 13 * * 4' | ||
|
||
jobs: | ||
rust: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rust-src | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
- run: pip install -e . | ||
- run: pip install pytest-codeblocks pytest | ||
|
||
- run: | | ||
cat >Cargo.toml <<EOF | ||
[package] | ||
name = "PyMPDATA" | ||
version = "0.1.0" | ||
edition = "2021" | ||
[dependencies] | ||
pyo3 = { version = "0.22.2", features=["auto-initialize"]} | ||
EOF | ||
- run: mkdir src | ||
- run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('docs/markdown/pympdata_landing.md'); f=open('src/main.rs', 'w'); f.writelines(block.code for block in code if block.syntax=='Rust'); f.close()" | ||
- run: cat -n src/main.rs | ||
- run: cargo run | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters