Skip to content
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

Proposal to Include Post-Merge Hook for Automatic Make Install #2985

Closed
mous1985 opened this issue Oct 19, 2024 · 3 comments
Closed

Proposal to Include Post-Merge Hook for Automatic Make Install #2985

mous1985 opened this issue Oct 19, 2024 · 3 comments

Comments

@mous1985
Copy link

Description

I would like to propose the inclusion of a post-merge hook to automate the make install process after performing a git pull. This would streamline the setup process for new users and avoids errors caused by forgetting to make install.

Here are the instructions I propose to add to the documentation:

After cloning the repository it, please follow these steps to add the post-merge hook:

  1. Navigate to the hooks directory:
cd .git/hooks
  1. Create the post-merge file
touch post-merge
nano post-merge
  1. Copy and paste the following script into the post-merge file:
#!/bin/sh

# This script runs `make install` after a successful `git pull`

# Navigate to the root of the repository
REPO_ROOT=$(git rev-parse --show-toplevel)
cd "$REPO_ROOT"

# Run `make install`
if make install; then
	echo "Installation successful."
else
	echo "Installation failed." >&2
	exit 1
fi
  1. Make the script executable :
chmod +x post-merge

5.Now, every time you run a git pull, make install will be executed automatically.

@leohhhn Please let me know what you think!

@thehowl
Copy link
Member

thehowl commented Oct 21, 2024

I don't think this should be something we recommend. If anything, we can consider a make upgrade as a shorthand in the root makefile to git pull + make install; but I'm not sure if that's going to be particularly useful (I like a more explicit git pull && make install)

Also, personally I use an alias for running the gno command when working locally:

alias gnox="go run github.com/gnolang/gno/gnovm/cmd/gno"

I was adding this in the CONTRIIBUTING guide in #2477, but I've been lagging on updating it (also because the command I posted there actually doesn't work as intended). Anyway, IMO using go run to run the latest code is a better idea than always running make install.

Can you try to point out your use case? Having an up-to-date gno command when working on projects outside monorepo?

@mous1985
Copy link
Author

Hi @thehowl

I encountered an issue when testing a dapp outside the gno repo after pulling the latest updates without running make install.

The error was: panic: strconv/atof.gno:249:3: cannot find branch label "" I had to go back and check the atof.gno to figure out what was wrong, and it turned out that the issue was simply due to me forgetting to run make install

That’s why I was suggesting adding the post-merge hook as a potential solution to automate this step.

Thank you I appreciate the feedback!

@thehowl
Copy link
Member

thehowl commented Oct 22, 2024

Yeah, I prefer if we recommend an explicit go run which is run in the context of the repo, rather than a hook.

I haven't figured out a good way to make it work outside of the repo, as the -C flag I suggested in #2477 actually changes the PR for the command as well; which means that go test . won't refer to the current directory of the user. Maybe we need to use -modfile or something similar; anyway, I think that's what we should recommend instead if you want to take on that.

I'll close the issue for house-keeping; feel free to make a PR, otherwise I'll tackle it when I get around to updating CONTRIBUTING.

@thehowl thehowl closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants