How to compile/test Rust code
cargo build
cargo build
will not compile when run in /rust
due to problems compiling /rust/fastsim-py
.
cargo build
should compile when run in the /rust/fastsim-core
.
cargo test
cargo test
should compile when run in /rust because there are no tests in /rust/fastsim-py
.
build_and_test.sh
Running sh build_and_test.sh
from the root fastsim directory compile/tests the Rust code, and tests the Python code. It should compile without errors.
Releasing
Incrementing the Version Number
Increment the 3rd decimal place in the version number for small changes (e.g. minor bug fixes, new variables), the 2nd for medium changes (e.g. new methods or classes), and the 1st for large changes (e.g. changes to the interface that might affect backwards compatibility / the API interface).
Instructions
- Create and check out a new branch, e.g. for version X.X.X:
git checkout -b fastsim-X.X.X
- Update the version number in the
pyproject.toml
file - If changes have happened in
rust/
, increment the Rust crate version numbers inrust/fastsim-core/Cargo.toml
andrust/fastsim-core/fastsim-proc-macros/Cargo.toml
- Commit changes, as appropriate:
git add pyproject.toml README.md rust/fastsim-core/Cargo.toml rust/fastsim-core/fastsim-proc-macros/Cargo.toml
git commit -m "vX.X.X"
- Tag the commit with the new version number, prepended with a
v
:
Or, optionally, you can also add a tag message with thegit tag vX.X.X
-m
flag, for example:git tag vX.X.X -m "release version X.X.X"
- Push the commit to the GitHub.com repository (for Git remote setup instructions, see this page):
git push -u external fastsim-X.X.X
- Push the tag:
This will start thegit push external vX.X.X
wheels.yaml
GitHub Actions workflow and run all tests - Create a PR for the new version in the external repository, using the
release
label for organization - When all tests pass, and a review has been completed, merge the PR
- If changes were made in
rust/
, publish the crates (you must be listed as an owner of both crates on crates.io):
If necessary, log into crates.io first after adding and verifying your email at https://crates.io/settings/profile:
Then, run these commands to update the crates (order matters):cargo login
(cd rust/fastsim-core/fastsim-proc-macros && cargo publish) (cd rust/fastsim-core && cargo publish)
- Start a new release at https://github.com/NREL/fastsim/releases/new, selecting
vX.X.X
as both the tag and the release name. Click "Generate release notes" to automatically create a detailed change log. - Click "Publish release". Wheels will then be built for various platforms and automatically uploaded to the PyPI at https://pypi.org/project/fastsim/. Check that the release workflow finished properly at https://github.com/NREL/fastsim/actions/workflows/release.yaml!
- Synchronize changes to the internal GitHub repository:
git pull external fastsim-2 git push origin fastsim-2