-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
GitHub Actions pr_ci.yml improvements #12589
Conversation
f3dade7
to
28404a1
Compare
It is the first time I hear about https://nuke.build/ |
I'll create a PR to show the thing. Just yesterday I just wanted to delete all binaries in OC build folders (netcoreapp3.1 and net5.0) leftovers, |
I generally do |
I suffered a lot in the paste, but I did what Jasmin suggested with clean everyting which is too much ;) |
I think we need to discuss to support NUKE or not, or we can use programmable MSBuild tasks like what I started long time ago |
NUKE has the advantage that you can debug it too when needed using the IDE. |
Sounds good, can we open a discussion for this one, so others can add thier comments and ideas |
.github/workflows/pr_ci.yml
Outdated
path: ~/.nuget/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- |
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.
Could you do some repeated measurements before/after (just with the caching change) so we can see an average for the total workflow runtime (or cache+build)? Two GHA builds can vary wildly between two runs, so any two builds are not really comparable.
We've experimented around for NuGet and NPM caching with our OSOCE solution, which uses OrchardCore.Application.Cms.Targets
(so basically every Orchard package) and some, so it should be comparable in terms of NuGet restore requirements. It turned out that restoring the cache under Windows is so slow that it cancels out the savings.
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'll check with some verbose output...
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.
The comment I made at the end shows the results, with no restore it's faster to have the cache in use. Restore is I/O intensive even when nothing needs to be restored (NuGet cache contains items).
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.
If you mean this comment then I only see a single measurement. Sorry for being a pain here, it's just that a +-10% jitter in the performance of GitHub Actions builds is usual, with particularly (un)lucky ones even hitting outside of that, so while this is promising, I'd like to see with multiple runs whether the speedup persists.
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.
Interesting things, thank you! I'll check out the hard link build in our workflows too, I'm curious about the impact.
.github/workflows/pr_ci.yml
Outdated
- uses: actions/setup-node@v2 | ||
- uses: actions/cache@v3 | ||
with: | ||
node-version: "15" | ||
- name: Setup .NET 6.0 | ||
uses: actions/setup-dotnet@v1 | ||
with: |
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'm not sure about these. While it's great to save on having to do these, but we also take a dependency on ubuntu-latest
and windows-latest
containing the version we want, and if the images are updated, our build can break without us touching it. Perhaps these actions could instead be optimized not to do the installation if it's already available?
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.
Could you reply, please?
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.
Definitely no need to install Node 15 when 16 is LTS, seems that for Windows image every unnecessary step will be slow. Using -latest
already makes building unpredictable - it can be Windows 2032 some day.
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.
We definitely shouldn't use v15 of Node, I agree. However, that doesn't necessarily mean we should use the version provided by the image, which is not really something contributors would keep in mind. While using the "latest" images indeed poses a similar issue, I'd say that the chance that a Node or .NET SDK version update brings issues is at least an order of magnitude larger, than that of other image updates, especially OS ones. It's anecdotal, but we even had minor .NET SDK versions breaking the build here (and I've seen that many times with our other apps at Lombiq too), while I can't remember OS updates breaking anything like this.
Similar to setup-dotnet
, setup-node
won't install anything if the version already exists locally. So if we target v16 (since the 3 latest LTS versions are pre-installed) then this shouldn't be significantly slower than not doing anything, while retaining that the version we use for the build is known.
.github/workflows/pr_ci.yml
Outdated
- name: Setup .NET 6.0 | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 6.0.x | ||
include-prerelease: true |
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.
v3 of actions/setup-dotnet
already includes a feature not to install a given version if it already exists on the VM. So, using it should be enough for us to use the version we want if it exists on the image but still get the speedup: https://github.com/Lombiq/GitHub-Actions/pull/67/files#diff-7978921ed7153ba992ebf38332bdd64fe6f3acb10a452b2978859c5a835ea74bR30 (note the comment above, I initially understood the behavior differently).
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.
Ideally build system would handle this. For example NUKE checks solution's global.json for required SDK version and downloads if needed. Works also outside of GitHub. But probably upgrading actions is the way to go when we can't use the best tools..
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.
Well, we can have something fancy, but in the short term, just pointing this action to v3 will optimize this :).
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.
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.
That's supposed to be a lot faster... In practice I've seen <20s for this (vs ~3 minutes for a full install). So, I don't know.
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.
The build you're showing was perhaps a one-time fluke. I again checked our builds, and these restores are ~15s when using a preinstalled SDK. See e.g.:
- https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/actions/runs/3257120788/jobs/5348182484#step:3:1
- https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/actions/runs/3257120788/jobs/5348182424#step:3:1
- https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/actions/runs/3256910188/jobs/5347817613#step:3:1
- https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/actions/runs/3256910188/jobs/5347817671#step:3:1
- https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/actions/runs/3257569220/jobs/5348910654#step:3:1
- https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions/actions/runs/3257569220/jobs/5348910715#step:3: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.
15 seconds is quite long time for no-op?
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.
That's what I initially thought as well, but as someone kindly explained in the mentioned thread it's not a no-op :). It's also checking the latest released 6.0.x
version online, and if it's newer than the pre-installed one, installs that instead.
Go to hell Marko |
Don't merge, see my comments. |
8cc1361
to
4ab6ce4
Compare
So because changes requested status I can't get builds to run? Not so convenient... |
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 dont know why the build is not running, I think it should (I certainly don't see any way to let it run). I'll add an approval to see if it helps but please note that still, I don't think this should yet be merged.
Still nothing. I don't know... Please try to push again and let's see if the build kicks off. |
460a297
to
bc5b166
Compare
Sorry, by bad. The YAML had indent problem, this is why tools like NUKE generate the YAML for you... |
dd5f008
to
227b396
Compare
144e584
to
c77ac62
Compare
9b8f83c
to
7129dfc
Compare
7129dfc
to
d2619c0
Compare
d2619c0
to
233f62a
Compare
Is this something you'd like to revisit @lahma or should we close? |
Relates to #12583 , checking how to make PR CI build faster on GH actions side.
Probably not a common thing to see Windows build completing faster than the Linux one?
I'd so much love to have NUKE used in this project, but I guess that's way too far-fetched...