chore: add publish script for urdf and stl + unify all releases by de… (#727)
* chore: add publish script for urdf and stl + unify all releases by default * better cross platform publish support * publish in dry run within ci * publish scripts better errors, abort if a publish fails, with an exit code. * chore(rapier_urdf): fix warnings * chore(rapier-urdf): typo fix --------- Co-authored-by: Sébastien Crozet <developer@crozet.re>
This commit is contained in:
8
.github/workflows/rapier-ci-build.yml
vendored
8
.github/workflows/rapier-ci-build.yml
vendored
@@ -97,3 +97,11 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: check typos
|
- name: check typos
|
||||||
uses: crate-ci/typos@v1.23.2
|
uses: crate-ci/typos@v1.23.2
|
||||||
|
publish-dry-run:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: -D warnings
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: publish dry-run
|
||||||
|
run: ./publish-all.sh
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ use rapier3d::{
|
|||||||
JointAxis, MassProperties, MultibodyJointHandle, MultibodyJointSet, RigidBody,
|
JointAxis, MassProperties, MultibodyJointHandle, MultibodyJointSet, RigidBody,
|
||||||
RigidBodyBuilder, RigidBodyHandle, RigidBodySet, RigidBodyType,
|
RigidBodyBuilder, RigidBodyHandle, RigidBodySet, RigidBodyType,
|
||||||
},
|
},
|
||||||
geometry::{
|
geometry::{Collider, ColliderBuilder, ColliderHandle, ColliderSet, SharedShape, TriMeshFlags},
|
||||||
Collider, ColliderBuilder, ColliderHandle, ColliderSet, MeshConverter, SharedShape,
|
|
||||||
TriMeshFlags,
|
|
||||||
},
|
|
||||||
math::{Isometry, Point, Real, Vector},
|
math::{Isometry, Point, Real, Vector},
|
||||||
na,
|
na,
|
||||||
};
|
};
|
||||||
@@ -493,7 +490,7 @@ fn urdf_to_rigid_body(options: &UrdfLoaderOptions, inertial: &Inertial) -> Rigid
|
|||||||
|
|
||||||
fn urdf_to_collider(
|
fn urdf_to_collider(
|
||||||
options: &UrdfLoaderOptions,
|
options: &UrdfLoaderOptions,
|
||||||
mesh_dir: &Path,
|
_mesh_dir: &Path, // NOTO: this isn’t used if there is no external mesh feature enabled (like stl).
|
||||||
geometry: &Geometry,
|
geometry: &Geometry,
|
||||||
origin: &Pose,
|
origin: &Pose,
|
||||||
) -> Option<Collider> {
|
) -> Option<Collider> {
|
||||||
@@ -514,17 +511,18 @@ fn urdf_to_collider(
|
|||||||
Geometry::Sphere { radius } => SharedShape::ball(*radius as Real),
|
Geometry::Sphere { radius } => SharedShape::ball(*radius as Real),
|
||||||
Geometry::Mesh { filename, scale } => {
|
Geometry::Mesh { filename, scale } => {
|
||||||
let path: &Path = filename.as_ref();
|
let path: &Path = filename.as_ref();
|
||||||
let scale = scale
|
let _scale = scale
|
||||||
.map(|s| Vector::new(s.x as Real, s.y as Real, s.z as Real))
|
.map(|s| Vector::new(s.x as Real, s.y as Real, s.z as Real))
|
||||||
.unwrap_or_else(|| Vector::<Real>::repeat(1.0));
|
.unwrap_or_else(|| Vector::<Real>::repeat(1.0));
|
||||||
match path.extension().and_then(|ext| ext.to_str()) {
|
match path.extension().and_then(|ext| ext.to_str()) {
|
||||||
#[cfg(feature = "stl")]
|
#[cfg(feature = "stl")]
|
||||||
Some("stl") | Some("STL") => {
|
Some("stl") | Some("STL") => {
|
||||||
let full_path = mesh_dir.join(filename);
|
use rapier3d::geometry::MeshConverter;
|
||||||
|
let full_path = _mesh_dir.join(filename);
|
||||||
match rapier3d_stl::load_from_path(
|
match rapier3d_stl::load_from_path(
|
||||||
full_path,
|
full_path,
|
||||||
MeshConverter::TriMeshWithFlags(options.trimesh_flags),
|
MeshConverter::TriMeshWithFlags(options.trimesh_flags),
|
||||||
scale,
|
_scale,
|
||||||
) {
|
) {
|
||||||
Ok(stl_shape) => {
|
Ok(stl_shape) => {
|
||||||
shape_transform = stl_shape.pose;
|
shape_transform = stl_shape.pose;
|
||||||
|
|||||||
14
publish-all.sh
Executable file
14
publish-all.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
if [[ "$PUBLISH_MODE" == 1 ]]
|
||||||
|
then
|
||||||
|
./scripts/publish-rapier.sh &&
|
||||||
|
./scripts/publish-testbeds.sh &&
|
||||||
|
./scripts/publish-extra-formats.sh
|
||||||
|
else
|
||||||
|
echo "Running in dry mode, re-run with \`PUBLISH_MODE=1 publish-all.sh\` to actually publish."
|
||||||
|
|
||||||
|
DRY_RUN="--dry-run" ./scripts/publish-rapier.sh &&
|
||||||
|
DRY_RUN="--dry-run" ./scripts/publish-testbeds.sh &&
|
||||||
|
DRY_RUN="--dry-run" ./scripts/publish-extra-formats.sh
|
||||||
|
fi
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#! /bin/bash
|
|
||||||
|
|
||||||
tmp=$(mktemp -d)
|
|
||||||
|
|
||||||
echo "$tmp"
|
|
||||||
|
|
||||||
cp -r src "$tmp"/.
|
|
||||||
cp -r src_testbed "$tmp"/.
|
|
||||||
cp -r crates "$tmp"/.
|
|
||||||
cp -r LICENSE README.md "$tmp"/.
|
|
||||||
|
|
||||||
### Publish the 2D version.
|
|
||||||
gsed 's#\.\./\.\./src#src#g' crates/rapier_testbed2d/Cargo.toml > "$tmp"/Cargo.toml
|
|
||||||
gsed -i 's#\.\./rapier#./crates/rapier#g' "$tmp"/Cargo.toml
|
|
||||||
currdir=$(pwd)
|
|
||||||
cd "$tmp" && cargo publish
|
|
||||||
cd "$currdir" || exit
|
|
||||||
|
|
||||||
|
|
||||||
### Publish the 3D version.
|
|
||||||
gsed 's#\.\./\.\./src#src#g' crates/rapier_testbed3d/Cargo.toml > "$tmp"/Cargo.toml
|
|
||||||
gsed -i 's#\.\./rapier#./crates/rapier#g' "$tmp"/Cargo.toml
|
|
||||||
cp -r LICENSE README.md "$tmp"/.
|
|
||||||
cd "$tmp" && cargo publish
|
|
||||||
|
|
||||||
rm -rf "$tmp"
|
|
||||||
11
scripts/publish-extra-formats.sh
Executable file
11
scripts/publish-extra-formats.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
currdir=$(pwd)
|
||||||
|
|
||||||
|
### Publish rapier3d-stl.
|
||||||
|
cd "crates/rapier3d-stl" && cargo publish $DRY_RUN || exit 1
|
||||||
|
cd "$currdir" || exit 2
|
||||||
|
|
||||||
|
### Publish rapier3d-urdf.
|
||||||
|
cd "crates/rapier3d-urdf" && cargo publish $DRY_RUN || exit 1
|
||||||
|
cd "$currdir" || exit 2
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#! /bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
tmp=$(mktemp -d)
|
tmp=$(mktemp -d)
|
||||||
|
|
||||||
@@ -10,26 +10,26 @@ cp -r LICENSE README.md "$tmp"/.
|
|||||||
### Publish the 2D version.
|
### Publish the 2D version.
|
||||||
sed 's#\.\./\.\./src#src#g' crates/rapier2d/Cargo.toml > "$tmp"/Cargo.toml
|
sed 's#\.\./\.\./src#src#g' crates/rapier2d/Cargo.toml > "$tmp"/Cargo.toml
|
||||||
currdir=$(pwd)
|
currdir=$(pwd)
|
||||||
cd "$tmp" && cargo publish
|
cd "$tmp" && cargo publish $DRY_RUN || exit 1
|
||||||
cd "$currdir" || exit
|
cd "$currdir" || exit 2
|
||||||
|
|
||||||
|
|
||||||
### Publish the 3D version.
|
### Publish the 3D version.
|
||||||
sed 's#\.\./\.\./src#src#g' crates/rapier3d/Cargo.toml > "$tmp"/Cargo.toml
|
sed 's#\.\./\.\./src#src#g' crates/rapier3d/Cargo.toml > "$tmp"/Cargo.toml
|
||||||
cp -r LICENSE README.md "$tmp"/.
|
cp -r LICENSE README.md "$tmp"/.
|
||||||
cd "$tmp" && cargo publish
|
cd "$tmp" && cargo publish $DRY_RUN || exit 1
|
||||||
cd "$currdir" || exit
|
cd "$currdir" || exit 2
|
||||||
|
|
||||||
### Publish the 2D f64 version.
|
### Publish the 2D f64 version.
|
||||||
sed 's#\.\./\.\./src#src#g' crates/rapier2d-f64/Cargo.toml > "$tmp"/Cargo.toml
|
sed 's#\.\./\.\./src#src#g' crates/rapier2d-f64/Cargo.toml > "$tmp"/Cargo.toml
|
||||||
currdir=$(pwd)
|
currdir=$(pwd)
|
||||||
cd "$tmp" && cargo publish
|
cd "$tmp" && cargo publish $DRY_RUN || exit 1
|
||||||
cd "$currdir" || exit
|
cd "$currdir" || exit 2
|
||||||
|
|
||||||
|
|
||||||
### Publish the 3D f64 version.
|
### Publish the 3D f64 version.
|
||||||
sed 's#\.\./\.\./src#src#g' crates/rapier3d-f64/Cargo.toml > "$tmp"/Cargo.toml
|
sed 's#\.\./\.\./src#src#g' crates/rapier3d-f64/Cargo.toml > "$tmp"/Cargo.toml
|
||||||
cp -r LICENSE README.md "$tmp"/.
|
cp -r LICENSE README.md "$tmp"/.
|
||||||
cd "$tmp" && cargo publish
|
cd "$tmp" && cargo publish $DRY_RUN || exit 1
|
||||||
|
|
||||||
rm -rf "$tmp"
|
rm -rf "$tmp"
|
||||||
34
scripts/publish-testbeds.sh
Executable file
34
scripts/publish-testbeds.sh
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
gsed -v >> /dev/null
|
||||||
|
if [ $? == 0 ]; then
|
||||||
|
gsed=gsed
|
||||||
|
else
|
||||||
|
# Hopefully installed sed is the gnu one.
|
||||||
|
gsed=sed
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp=$(mktemp -d)
|
||||||
|
|
||||||
|
echo "$tmp"
|
||||||
|
|
||||||
|
cp -r src "$tmp"/.
|
||||||
|
cp -r src_testbed "$tmp"/.
|
||||||
|
cp -r crates "$tmp"/.
|
||||||
|
cp -r LICENSE README.md "$tmp"/.
|
||||||
|
|
||||||
|
### Publish the 2D version.
|
||||||
|
$gsed 's#\.\./\.\./src#src#g' crates/rapier_testbed2d/Cargo.toml > "$tmp"/Cargo.toml
|
||||||
|
$gsed -i 's#\.\./rapier#./crates/rapier#g' "$tmp"/Cargo.toml
|
||||||
|
currdir=$(pwd)
|
||||||
|
cd "$tmp" && cargo publish $DRY_RUN
|
||||||
|
cd "$currdir" || exit
|
||||||
|
|
||||||
|
|
||||||
|
### Publish the 3D version.
|
||||||
|
$gsed 's#\.\./\.\./src#src#g' crates/rapier_testbed3d/Cargo.toml > "$tmp"/Cargo.toml
|
||||||
|
$gsed -i 's#\.\./rapier#./crates/rapier#g' "$tmp"/Cargo.toml
|
||||||
|
cp -r LICENSE README.md "$tmp"/.
|
||||||
|
cd "$tmp" && cargo publish $DRY_RUN
|
||||||
|
|
||||||
|
rm -rf "$tmp"
|
||||||
Reference in New Issue
Block a user