From 0d2f14b9237c0eaa8131d1d1118768357ac8133b Mon Sep 17 00:00:00 2001 From: Rohit Kulshreshtha Date: Fri, 24 May 2024 14:25:22 -0700 Subject: [PATCH] docs: Updating CONTRIBUTING.md with some info about feature branches (#1236) Also updating GitHub workflows to run on feature branches as well. --- .github/workflows/build-cli.yml | 1 + .github/workflows/ci.yml | 4 ++- .github/workflows/examples-container.yml | 4 ++- CONTRIBUTING.md | 32 +++++++++++++++---- ...lattice_bimorphism__join@graphvis_dot.snap | 2 +- ...ice_bimorphism__join@graphvis_mermaid.snap | 2 +- hydroflow/tests/surface_lattice_bimorphism.rs | 2 +- lattices/src/map_union.rs | 21 ++++++------ 8 files changed, 47 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 517d20609833..82770a3f84d5 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - feature/** tags: - 'hydro_cli-v[0-9]+.[0-9]+.[0-9]+' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03738e1edd47..2508c6f4f366 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,9 @@ name: CI on: push: - branches: [main] + branches: + - main + - feature/** pull_request: schedule: - cron: "35 03 * * *" # Daily at 8:35 PM PDT, 7:35 PM PST. diff --git a/.github/workflows/examples-container.yml b/.github/workflows/examples-container.yml index 932167e22669..66dcfd76bf68 100644 --- a/.github/workflows/examples-container.yml +++ b/.github/workflows/examples-container.yml @@ -3,7 +3,9 @@ name: examples-container-build on: push: - branches: [main] + branches: + - main + - feature/** jobs: pre_job: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ade93d2d2bcc..cf7ccbd6969e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,15 +55,35 @@ later. On Mac, installing directly from python.org may work if `brew install` do cargo install wasm-bindgen-cli ``` -## Commit Messages +## Submitting Changes -Commit messages should follow the [Conventional Commits specification](https://www.conventionalcommits.org/) -when submitting a PR. Alternatively, GitHub's "Squash and merge" feature can be used to adjust the -commit message, however those messages are not checked by CI. +### Feature Branches +Prototypes should be committed to feature branches, rather than main. To create a feature branch: -Commit messages are used to generate changelogs. See [Releasing](#releasing) for more. +```shell +git fetch origin +git checkout -b feature/$FEATURE_NAME origin/main +git push origin HEAD +``` + +To add changes on top of feature branches: +```shell +git checkout -b $BRANCH_NAME `feature/$FEATURE_NAME` +.. make changes .. +git add ... # Add all changes +git commit # Commit changes +git push origin HEAD +``` + +### Commit Messages + +Pull request title and body should follow [Conventional Commits specification](https://www.conventionalcommits.org/). +The repository defaults to Squash+Merge commits, so individual commits are only useful for showing code evolution +during code-reviews. + +Pull request title and body are used to generate changelogs. See [Releasing](#releasing) for more. -## Pull Requests and `precheck.bash` +### Pull Requests and `precheck.bash` CI runs a comprehensive set of tests on PRs before they are merged. This includes format and lint checks. To run some checks locally, you can run `./precheck.bash` (or `./precheck.bash --quick` for diff --git a/hydroflow/tests/snapshots/surface_lattice_bimorphism__join@graphvis_dot.snap b/hydroflow/tests/snapshots/surface_lattice_bimorphism__join@graphvis_dot.snap index 112f7fc57da8..e085e15cb944 100644 --- a/hydroflow/tests/snapshots/surface_lattice_bimorphism__join@graphvis_dot.snap +++ b/hydroflow/tests/snapshots/surface_lattice_bimorphism__join@graphvis_dot.snap @@ -11,7 +11,7 @@ digraph { n4v1 [label="(n4v1) source_iter_delta([(7, 0), (7, 1), (7, 2)])", shape=invhouse, fillcolor="#88aaff"] n5v1 [label="(n5v1) map(|(k, v)| MapUnionSingletonMap::new_from((k, SetUnionSingletonSet::new_from(v))))", shape=invhouse, fillcolor="#88aaff"] n6v1 [label="(n6v1) state::<'static, MapUnionHashMap>>()", shape=invhouse, fillcolor="#88aaff"] - n7v1 [label="(n7v1) lattice_bimorphism(\l KeyedBimorphism::<\l HashMap<_, _>,\l _,\l >::from(CartesianProductBimorphism::>::default()),\l lhs,\l rhs,\l)\l", shape=invhouse, fillcolor="#88aaff"] + n7v1 [label="(n7v1) lattice_bimorphism(\l KeyedBimorphism::<\l HashMap<_, _>,\l _,\l >::new(CartesianProductBimorphism::>::default()),\l lhs,\l rhs,\l)\l", shape=invhouse, fillcolor="#88aaff"] n8v1 [label="(n8v1) lattice_reduce()", shape=invhouse, fillcolor="#88aaff"] n9v1 [label="(n9v1) for_each(|x| out_send.send(x).unwrap())", shape=house, fillcolor="#ffff88"] n10v1 [label="(n10v1) handoff", shape=parallelogram, fillcolor="#ddddff"] diff --git a/hydroflow/tests/snapshots/surface_lattice_bimorphism__join@graphvis_mermaid.snap b/hydroflow/tests/snapshots/surface_lattice_bimorphism__join@graphvis_mermaid.snap index 91608b95450c..9db266c98507 100644 --- a/hydroflow/tests/snapshots/surface_lattice_bimorphism__join@graphvis_mermaid.snap +++ b/hydroflow/tests/snapshots/surface_lattice_bimorphism__join@graphvis_mermaid.snap @@ -14,7 +14,7 @@ linkStyle default stroke:#aaa 4v1[\"(4v1) source_iter_delta([(7, 0), (7, 1), (7, 2)])"/]:::pullClass 5v1[\"(5v1) map(|(k, v)| MapUnionSingletonMap::new_from((k, SetUnionSingletonSet::new_from(v))))"/]:::pullClass 6v1[\"(6v1) state::<'static, MapUnionHashMap<usize, SetUnionHashSet<usize>>>()"/]:::pullClass -7v1[\"
(7v1)
lattice_bimorphism(
KeyedBimorphism::<
HashMap<_, _>,
_,
>::from(CartesianProductBimorphism::<HashSet<_>>::default()),
lhs,
rhs,
)
"/]:::pullClass +7v1[\"
(7v1)
lattice_bimorphism(
KeyedBimorphism::<
HashMap<_, _>,
_,
>::new(CartesianProductBimorphism::<HashSet<_>>::default()),
lhs,
rhs,
)
"/]:::pullClass 8v1[\"(8v1) lattice_reduce()"/]:::pullClass 9v1[/"(9v1) for_each(|x| out_send.send(x).unwrap())"\]:::pushClass 10v1["(10v1) handoff"]:::otherClass diff --git a/hydroflow/tests/surface_lattice_bimorphism.rs b/hydroflow/tests/surface_lattice_bimorphism.rs index b7064426e29e..164dbab98197 100644 --- a/hydroflow/tests/surface_lattice_bimorphism.rs +++ b/hydroflow/tests/surface_lattice_bimorphism.rs @@ -57,7 +57,7 @@ pub fn test_join() { lhs[items] -> [0]my_join; rhs[items] -> [1]my_join; - my_join = lattice_bimorphism(KeyedBimorphism::, _>::from(CartesianProductBimorphism::>::default()), #lhs, #rhs) + my_join = lattice_bimorphism(KeyedBimorphism::, _>::new(CartesianProductBimorphism::>::default()), #lhs, #rhs) -> lattice_reduce() -> for_each(|x| out_send.send(x).unwrap()); }; diff --git a/lattices/src/map_union.rs b/lattices/src/map_union.rs index fade888c1c0c..e2cfa516fe23 100644 --- a/lattices/src/map_union.rs +++ b/lattices/src/map_union.rs @@ -277,8 +277,9 @@ pub struct KeyedBimorphism { bimorphism: Bimorphism, _phantom: PhantomData MapOut>, } -impl From for KeyedBimorphism { - fn from(bimorphism: Bimorphism) -> Self { +impl KeyedBimorphism { + /// Create a `KeyedBimorphism` using `bimorphism` for handling values. + pub fn new(bimorphism: Bimorphism) -> Self { Self { bimorphism, _phantom: PhantomData, @@ -398,28 +399,28 @@ mod test { ]; check_lattice_bimorphism( - KeyedBimorphism::, _>::from( + KeyedBimorphism::, _>::new( CartesianProductBimorphism::>::default(), ), items_a, items_a, ); check_lattice_bimorphism( - KeyedBimorphism::, _>::from( + KeyedBimorphism::, _>::new( CartesianProductBimorphism::>::default(), ), items_a, items_b, ); check_lattice_bimorphism( - KeyedBimorphism::, _>::from( + KeyedBimorphism::, _>::new( CartesianProductBimorphism::>::default(), ), items_b, items_a, ); check_lattice_bimorphism( - KeyedBimorphism::, _>::from( + KeyedBimorphism::, _>::new( CartesianProductBimorphism::>::default(), ), items_b, @@ -427,28 +428,28 @@ mod test { ); check_lattice_bimorphism( - KeyedBimorphism::, _>::from( + KeyedBimorphism::, _>::new( CartesianProductBimorphism::>::default(), ), items_a, items_a, ); check_lattice_bimorphism( - KeyedBimorphism::, _>::from( + KeyedBimorphism::, _>::new( CartesianProductBimorphism::>::default(), ), items_a, items_b, ); check_lattice_bimorphism( - KeyedBimorphism::, _>::from( + KeyedBimorphism::, _>::new( CartesianProductBimorphism::>::default(), ), items_b, items_a, ); check_lattice_bimorphism( - KeyedBimorphism::, _>::from( + KeyedBimorphism::, _>::new( CartesianProductBimorphism::>::default(), ), items_b,