-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Check if cheatsheets are up to date on CI #374
Check if cheatsheets are up to date on CI #374
Conversation
pkg/utils/utils.go
Outdated
|
||
// GetLazydockerRootDirectory finds lazydocker root directory. | ||
// | ||
// It's used for our cheatsheet script and integration tests. Not to be confused with finding the | ||
// root directory of _any_ random repo. | ||
func GetLazydockerRootDirectory() string { | ||
path, err := os.Getwd() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
for { | ||
_, err := os.Stat(filepath.Join(path, ".git")) | ||
if err == nil { | ||
return path | ||
} | ||
|
||
if !os.IsNotExist(err) { | ||
panic(err) | ||
} | ||
|
||
path = filepath.Dir(path) | ||
|
||
if path == "/" { | ||
log.Fatal("must run in lazydocker folder or child folder") | ||
} | ||
} | ||
} |
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 copied over from lazygit
, but I was wondering if a shared package would fit this case (Maybe lazyutils
?). There seems to be quite a bit of overlap between lazygit
and lazydocker
. Even these scripts for cheatsheets could be used in both projects. Let me know your thoughts 😄.
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.
@gusandrioli I actually made a repo for this exact purpose over the weekend: https://github.com/jesseduffield/lazycore. If you would like to raise a PR on that repo for shared cheatsheet functionality, I'll happily review :) Also happy to give pointers
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.
Ah neat! I'll open a PR there then 😄.
@jesseduffield This one is ready for review as well! |
af4add5
to
c562563
Compare
@jesseduffield Added a PR on lazycore: jesseduffield/lazycore#3. Also, investigating why the failure on |
@gusandrioli nice, I've merged that PR. There's a I'm not sure why windows-latest ci would be failing. I am aware of it being slow but not failing |
@gusandrioli actually I bet it's because windows uses different line ending characters than unix. I'm not sure how that's possible when the script is only using newlines though |
@jesseduffield No luck yet here. Seems like on |
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.
@jesseduffield CI passing now :)
- name: Check Cheatsheet | ||
run: | | ||
go run scripts/cheatsheet/main.go check | ||
- name: Check Vendor Directory | ||
# ensure our vendor directory matches up with our go modules | ||
run: | | ||
go mod vendor && git diff --exit-code || (echo "Unexpected change to vendor directory. Run 'go mod vendor' locally and commit the changes" && exit 1) |
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.
Now we check for cheatsheet diffs here and ensure our vendor dir matches the modules (same job as lazygit).
# github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 | ||
## explicit | ||
github.com/golang-collections/collections/stack |
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.
Ran go mod vendor
as now there's validation on CI.
Amazing work @gusandrioli ! Merging :) |
This PR resolves #370
Changes
pkg/cheatsheet/generate.go
.pkg/cheatsheet/check.go
to validate if cheatsheets are up to date.ci.yaml
.