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

Generate Bindata iff TAGS="bindata" and not up-to-date #10004

Merged
merged 12 commits into from Jan 27, 2020

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Jan 26, 2020

  • Ensure build tags are passed to go generate
  • Move bindata go:generate to files that require build bindata
  • Remove duplicate main.go and move to single script in scripts
  • Add hash of fileinfo checking to bindata files

@zeripath zeripath added the topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile label Jan 26, 2020
@zeripath zeripath added this to the 1.12.0 milestone Jan 26, 2020
@zeripath
Copy link
Contributor Author

This should not be skip-changelog as the build command is changed - and users who use go generate instead of make may need to change how they generate.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 26, 2020
@codecov-io
Copy link

codecov-io commented Jan 26, 2020

Codecov Report

Merging #10004 into master will increase coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10004      +/-   ##
==========================================
+ Coverage   42.26%   42.27%   +<.01%     
==========================================
  Files         610      610              
  Lines       80372    80372              
==========================================
+ Hits        33966    33974       +8     
+ Misses      42228    42220       -8     
  Partials     4178     4178
Impacted Files Coverage Δ
models/repo_sign.go 36.2% <0%> (ø) ⬆️
models/pull_sign.go 34.86% <0%> (ø) ⬆️
models/repo.go 49.66% <0%> (-0.14%) ⬇️
services/pull/patch.go 67.92% <0%> (ø) ⬆️
models/pull.go 43.49% <0%> (+0.58%) ⬆️
modules/log/event.go 65.64% <0%> (+1.02%) ⬆️
models/unit.go 39.5% <0%> (+2.46%) ⬆️
services/pull/temp_repo.go 34.18% <0%> (+2.56%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c930141...ee57d80. Read the comment docs.

Makefile Show resolved Hide resolved
@6543
Copy link
Member

6543 commented Jan 26, 2020

without

real    0m19,695s
user    0m9,189s
sys     0m5,747s

with patch

real    0m14,875s
user    0m4,250s
sys     0m4,771s

@6543
Copy link
Member

6543 commented Jan 26, 2020

where is the benchmark CI task ;)

Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

nice refactor ... the time imprufement is not that mouch for me ...

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 26, 2020
@6543
Copy link
Member

6543 commented Jan 26, 2020

@zeripath can you make needsUpdate to hash files in paralel ?

@zeripath
Copy link
Contributor Author

The order is important in SHA hashes. I guess we could generate a list and sort it at the end?

If you want to see the biggest improvement repeatedly build without tags=bindata as currently we enforce building it even if you don't want it.

There's another side effect here - some small machines have problems building bindata so without the earliest part of this pr they won't be able to build.

Copy link
Member

@guillep2k guillep2k left a comment

Choose a reason for hiding this comment

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

Sorry I couldn't see this earlier.

Just a couple of nits, but otherwise LGTM.

Makefile Outdated Show resolved Hide resolved

hasher := sha1.New()

err = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
Copy link
Member

Choose a reason for hiding this comment

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

So, we're basically doing make's job. 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup. That's what you get when you mix two competing build systems ...

scripts/generate-bindata.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 26, 2020
zeripath and others added 2 commits January 26, 2020 23:50
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
@zeripath zeripath merged commit 48abe41 into go-gitea:master Jan 27, 2020
@zeripath zeripath deleted the only-genbindata-if-necessary branch January 27, 2020 13:50
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants