-
Notifications
You must be signed in to change notification settings - Fork 3
Feat(support): mac os + stacks node from commit #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
BowTiedRadone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening the PR! I believe it brings much value. Left a few comments, but I'd also wait for @wileyj to check as well 🙏
| $(CHAINSTATE_DIR): | ||
| @if [ ! -d "$(CHAINSTATE_DIR)" ]; then \ | ||
| mkdir -p $(CHAINSTATE_DIR); \ | ||
| if [ "$(TARGET)" = "up" ]; then \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we re-add @ and remove all the nested \s? It's visually better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the backslashes manually because they make the intent explicit by defining how multi-line commands are interpreted. I've followed the documented convention https://www.gnu.org/software/make/manual/html_node/Splitting-Recipe-Lines.html
The previous implementation was functioning correctly, so we can keep it as it was if you prefer.
| docker compose -f docker/docker-compose.yml --profile default -p $(PROJECT) down | ||
| @if [ -f .current-chainstate-dir ]; then \ | ||
| rm -f .current-chainstate-dir | ||
| rm -f .current-chainstate-dir; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this addition needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically no, since it's the end of the conditional
| docker compose -f docker/docker-compose.yml --profile default -p $(PROJECT) down | ||
| @if [ -f .current-chainstate-dir ]; then \ | ||
| rm -f .current-chainstate-dir | ||
| rm -f .current-chainstate-dir; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here regarding \.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess all these side changes were created by a formatter. I'm curious what's the formatter, maybe we can take it into account for our CI. We're currently using dclint for docker-compose related files, but one for Makefile would be a great idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makefile linter would be great! i think it would be challenging since we use a "shell-ified" makefile though
| # Clone efficiently: shallow for branches/tags, targeted fetch for commits | ||
| # This avoids downloading the full 2GB+ history | ||
| RUN git init /code/stacks-core && \ | ||
| cd /code/stacks-core && \ | ||
| git remote add origin https://github.com/stacks-network/stacks-core.git && \ | ||
| git fetch --depth=1 origin $STACKS_CORE_BASE_BRANCH && \ | ||
| git checkout FETCH_HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this a lot! 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively, what about cloning a single branch and then checkout? this will work, but wouldn't git clone --single-branch work and use less lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would require in the setup to specify for a wanted commit both the commit and the branch where the commit can be found, as otherwise it would not have it locally to checkout to.
ASuciuX
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can restore the format for the shell lines, as you think it would make more sense.
Also, I've seen that .ONESHELL can be used and that would mean that '' would not be used, it would treat all indented lines below as a single shell script, but I haven't used it before.
| $(CHAINSTATE_DIR): | ||
| @if [ ! -d "$(CHAINSTATE_DIR)" ]; then \ | ||
| mkdir -p $(CHAINSTATE_DIR); \ | ||
| if [ "$(TARGET)" = "up" ]; then \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the backslashes manually because they make the intent explicit by defining how multi-line commands are interpreted. I've followed the documented convention https://www.gnu.org/software/make/manual/html_node/Splitting-Recipe-Lines.html
The previous implementation was functioning correctly, so we can keep it as it was if you prefer.
Co-authored-by: Radu Bahmata <92028479+BowTiedRadone@users.noreply.github.com>
Description
This PR adds support for running this environment on mac os.
It also adds support to run the nodes from a given commit, as until now it was only working with branches and github tags.
Type of Change
Does this introduce a breaking change?
It shouldn't break anything.
Testing information
Provide context on how tests should be performed.
Run each functionality on both linux and mac os and check the environment is behaving as it was before(on linux).