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

feat: add gno version command #3002

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kazai777
Copy link
Contributor

I've added the version command to gno to get the version of gno that is installed

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests

@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Oct 22, 2024
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

Project coverage is 63.14%. Comparing base (2a2be39) to head (12d9c71).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
gnovm/cmd/gno/version.go 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3002      +/-   ##
==========================================
+ Coverage   63.09%   63.14%   +0.04%     
==========================================
  Files         548      549       +1     
  Lines       78514    78644     +130     
==========================================
+ Hits        49541    49659     +118     
- Misses      25627    25639      +12     
  Partials     3346     3346              
Flag Coverage Δ
contribs/gnodev 60.57% <ø> (ø)
contribs/gnofaucet 14.82% <ø> (-0.95%) ⬇️
gno.land 63.82% <ø> (ø)
gnovm 67.89% <94.73%> (+0.01%) ⬆️
misc/genstd 79.72% <ø> (ø)
tm2 62.41% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jefft0 jefft0 added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Oct 23, 2024
@jefft0
Copy link
Contributor

jefft0 commented Oct 23, 2024

Can you fix the failed CI test?

=== RUN   TestVersionApp/versiontestdata~gno_version~gopath_version.txtar
    main_test.go:129: 
        	Error Trace:	/home/runner/work/gno/gno/gnovm/cmd/gno/main_test.go:129
        	Error:      	Expected nil, but got: &errors.errorString{s:"unable to determine gno version"}
        	Test:       	TestVersionApp/versiontestdata~gno_version~gopath_version.txtar
        	Messages:   	err should be nil
=== RUN   TestVersionApp/versiontestdata~gno_version~git_version.txtar
    main_test.go:129: 
        	Error Trace:	/home/runner/work/gno/gno/gnovm/cmd/gno/main_test.go:129
        	Error:      	Expected nil, but got: &errors.errorString{s:"unable to determine gno version"}
        	Test:       	TestVersionApp/versiontestdata~gno_version~git_version.txtar
        	Messages:   	err should be nil
--- FAIL: TestVersionApp (0.00s)
    --- FAIL: TestVersionApp/versiontestdata~gno_version~gopath_version.txtar (0.00s)
    --- FAIL: TestVersionApp/versiontestdata~gno_version~git_version.txtar (0.00s)

@thehowl
Copy link
Member

thehowl commented Oct 23, 2024

Please, be aware of this -> #2755 (comment)

@kazai777
Copy link
Contributor Author

kazai777 commented Oct 29, 2024

Please, be aware of this -> #2755 (comment)

I've modified gno version so that the output is like the one you proposed in this issue #3005. The output is in this format [branch].[N]+[hash] or [tag] for when there is a specific tag pointing to the commit. Is this what you expect from the gno version command? @thehowl

Screenshot 2024-10-29 at 17 28 33

Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few notes:

  • Instead of having this in cmd/gno, make a package gnovm/pkg/version, with var Version = "develop"
    • This will default to "develop" as a version, when somebody uses go install / go build directly.
    • It also allows us to eventually have this as gnoland version, too.
  • The ldflag should also go in the goreleaser set up: .github/goreleaser.yml

########################################
# Dev tools
.PHONY: build
build:
go build $(GOBUILD_FLAGS) -o build/gno ./cmd/gno
go build -ldflags="-X main.buildVersion=$(VERSION) -X main.commitHash=$(VCS_REF) -X github.com/gnolang/gno/gnovm/pkg/gnoenv._GNOROOT=$(GNOROOT_DIR)" -o build/gno ./cmd/gno
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you extend the existing GOBUILD_FLAGS?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These txtars test nothing :P

@thehowl thehowl removed the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: No status
Status: In Review
Development

Successfully merging this pull request may close these issues.

3 participants