Skip to content

Commit 55fe7d4

Browse files
authored
Merge pull request #766 from plebhash/docs-releases
docs releases
2 parents 74b3c49 + 2c4cc3f commit 55fe7d4

File tree

3 files changed

+66
-53
lines changed

3 files changed

+66
-53
lines changed

.github/workflows/release-libs.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# This workflow is used to publish SV2 crates to cratesio
2-
# The workflow try to update all the library crates so if a crate is not to updated, the step will fail
1+
# This workflow is used to publish SV2 crates to crates.io
2+
# The workflow tries to update all the library crates, so if a crate is not to updated, the step will fail
33
# for that each step have continue-on-error set to true.
4-
# Since each step can fail the output ot the action must be manually check to macke sure that all
4+
# Since each step can fail, the output ot the action must be manually checked to make sure that all
55
# the library intended to be published are published.
6-
# Runing cargo release in the various workspace help to prepare the version number and everything.
6+
# Running cargo release in the various workspace help to prepare the version number and everything.
77
# ATTENTION
88
# Is very important to check the output manually cause when too many crates are updated crates.io could fail
99
# and ask to rerun the action later

RELEASE.md

Lines changed: 62 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,79 @@
1-
# Releasing Roles Binaries and Publishing
1+
# Versioning
22

3-
The github binary releases of the roles and the publishing of the SRI crates are both handled in the `release.yaml` workflow. This workflow must be manually
4-
started by navigating to the "Actions" tab in the SRI repo, then navigating to the Release workflow section, and clicking "Run Workflow".
3+
SRI releases follow [SemVer 2.0.0](https://semver.org/).
54

6-
## Crates Publishing
5+
Given a version number `MAJOR.MINOR.PATCH`, we increment the:
6+
- `MAJOR` version when incompatible API changes are introduced
7+
- `MINOR` version when functionality is added in a backward compatible manner
8+
- `PATCH` version when backward compatible bug fixes are introduced
79

8-
For publishing crates we use the `cargo-release` tools because it easily handles the order in which crates can be published. Crates are published
9-
in the `crates_publish` job. Currently, crates.io rate limits the publishing of more than 5 NEW crates. This means that if we have more than 5 crates
10-
to publish, that are not currently published to crates.io, this workflow will not publish anything. To bypass this we will need to add the `--exclude [crate_name]`
11-
flag for as many crates as needed to the `cargo-release` command in the "Publish" step. For example, if there are 7 new crates to publish, we will need to add
12-
`--exclude [crate_1] --exclude [crate_2]` to the command. This is not an issue for publishing version updates since the crates are not NEW publishes.
10+
SRI has a global version, which uses git tags and keeps track of how the codebase evolves across time as a whole.
1311

14-
### Current Successful Publishes
12+
Every internal SRI crate also follows SemVer 2.0.0, but each crate version is only set on the respective `Cargo.toml`,
13+
(no git tags), and it evolves independently of the global release version.
1514

16-
Due to either github dependencies or a crate failing the build stage during publish not all crates are being published.
15+
Whenever a `PATCH` is introduced, it is applied to all the latest `MAJOR` releases.
16+
For example: imagine there's releases `v1.0.0`, `v1.1.0`, and `v2.0.0`. A bug is found, dating back all the way to `v1.0.0`.
17+
A patch is applied such that the following new tags are introduced: `v1.1.1` and `v2.0.1`.
1718

18-
- [x] buffer_sv2
19-
- [x] binary_codec_sv2
20-
- [x] binary_sv2
21-
- [x] common_messages_sv2
22-
- [x] const_sv2
23-
- [x] derive_codec_sv2
24-
- [x] framing_sv2
25-
- [x] serde_sv2
26-
- [x] sv1_api
27-
- [] noise_sv2 - github depependency (ed25519-dalek)
28-
- [] codec_sv2 - noise dependency
29-
- [] template_distribution_sv2 - build failure
30-
- [] mining_sv2 - publishes after template_distribution_sv2
31-
- [] job-declaration_sv2 - publishes after template_distribution_sv2
32-
- [] roles_logic_sv2 - publishes after template_distribution_sv2
33-
- [] network_helpers - publishes after template_distribution_sv2
34-
- [] error_handling - had to exclude to bypass rate limit but will probably publish now
35-
- [] sv2_ffi - had to exclude to bypass rate limit but will probably publish now
36-
- [] all roles - noise dependency
19+
# Git Branching Strategy
3720

38-
## Github Roles Releases
21+
We follow a simplified [gitflow](https://nvie.com/posts/a-successful-git-branching-model/) branching strategy.
3922

40-
The roles binaries are released in github in all jobs other than the `crates_publish` job. To be able to publish,
41-
the job must be able to find a new tag (one that hasnt already been released), matching the crate name of the role to be
42-
released. For example, imagine there is currently a release for pool_sv2-v1.0.0. For the jobs releasing a new pool version to succeed,
43-
it must be able to find a tag containing the string "pool_sv2" with a version greater than 1.0.0. This should not be an issue since the tags
44-
are automatically created by the `autoversion.yaml` workflow, and moved into main when the generated PR is merged.
23+
Although our strategy is very similar to the classic gitflow model, we do not keep release branches.
4524

46-
### Github Release Issue
25+
![](git-branching.png)
4726

48-
Currently we do not support windows releases because we are unable to run the step to return the last tag for a given crate name. See the section above
49-
for an explaination of the process.
27+
## Principal Branches
5028

29+
The SRI repo holds two principal branches with an infinite lifetime:
30+
- `main`
31+
- `dev`
5132

33+
We consider `main` to be the branch where the source code of `HEAD` always reflects a production-ready state.
5234

53-
## Github Binary Releases
35+
We consider `dev` to be the branch where the source code of `HEAD` always reflects a state with the latest delivered development changes for the next release.
5436

55-
# Versioning
37+
The SRI team will decide the appropriate time when the changes to `dev` are merged back into `main` and then tagged with a release number while bumping `MAJOR` and/or `MINOR`.
38+
39+
## Feature Branches
40+
41+
New features are developed into separate branches that only live in the contributor's forks.
42+
43+
- branch off from: `dev`
44+
- merge back into: `dev`
45+
- naming convention: `feat-x`, where `x` describes the feature
46+
47+
## Patch Branches
48+
49+
Bugs are patched into separate branches that only live in the contributor's forks.
50+
51+
- branch off from: `main`
52+
- merge back into: `main` + `dev`
53+
- naming convention: `patch-x`, where `x` describes the bug/patch
54+
55+
# Releasing Roles Binaries
56+
57+
The [release page of SRI repo](https://github.com/stratum-mining/stratum/releases) provides executable binaries for all SRI roles, targeting popular hardware architectures.
58+
59+
The GitHub binary releases of the roles are handled in the `release-bin.yaml` workflow.
60+
61+
This workflow is manually started by navigating to the "Actions" tab in the SRI repo, then navigating to the Release workflow section, and clicking "Run Workflow".
62+
63+
Note: in order to be able to manually trigger the "Run Workflow" button, the user needs to have "Write" permissions on the repository, otherwise the button will not show up on the UI.
64+
65+
# Publishing Library Crates
66+
67+
Although SRI has a global release cycle, which is attached to the binaries, each internal crate also has its own versioning history.
68+
69+
Lib crates are published to crates.io in the `release-lib.yaml` workflow. The workflow tries to update all the library crates.
70+
71+
If a crate is not updated successfully, the step will fail, but since all steps have `continue-on-error` set to true, the workflow will continue.
72+
73+
Since steps can fail, the output of the action must be manually checked.
5674

57-
Versioning is handled by the `autorelease.yaml` workflow. The workflow will will auto detect changes in crates and auto bump the patch versions
58-
in the target crate, as well as any crate that uses the target crate as a dependency, if changes are detected. It will then push a new commit with the
59-
versioning changes to the `bot/versioning` branch, and Lastly, it will auto create a PR (bot/versioning -> main). Since cargo-smart-release does not yet
60-
support autodetection of MAJOR and MINOR changes with regards to Semver, any MAJOR/MINOR versioning will need to be manually changed in the package Cargo.toml.
75+
Every PR to `main` (either coming from `dev`, or a patch) needs to increase the version of whatever crate it is touching. Otherwise, we will mess up the dependency chain of whoever is fetching from crates.io
6176

62-
## Versioning Notes
77+
Manually running `cargo release` in the various workspaces helps to prepare the version number before the releases are published.
6378

64-
This workflow should not run if the push is resulting from this workflow, but this not necessarily guaranteed since the
65-
a developer could make a minor change to the bot/versioning PR, and the latest author would no longer be "Github Actions Bot".
66-
If the workflow does run again, there will just be no changes, and the PR can be closed.
79+
Every time we bump some crate's version, `release-libs.yaml` needs to be manually triggered in order to update crates.io.

git-branching.png

60.2 KB
Loading

0 commit comments

Comments
 (0)