Skip to content

Conversation

@hoffie
Copy link
Member

@hoffie hoffie commented Feb 21, 2022

Short description of changes

The Mac build installs create-dmg via brew. The install is already version-pinned.
This PR caches the resulting install and adds the file which does the version pinning to the cache key.

Context: Fixes an issue?

Fixes #2412

Does this change need documentation? What needs to be documented and how?

No
CHANGELOG: SKIP
(I've included this PR in #2207 (comment))

Status of this Pull Request

Ready.

What is missing until this pull request can be merged?

Reviews.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@hoffie hoffie added this to the Release 3.9.0 milestone Feb 21, 2022
@hoffie hoffie requested review from ann0see and pljones February 21, 2022 00:03
@hoffie hoffie force-pushed the actions-cache-create-dmg branch 2 times, most recently from 0223724 to 2fa0a6c Compare February 21, 2022 00:38
@hoffie
Copy link
Member Author

hoffie commented Feb 21, 2022

Doesn't work yet, probably some path missing:
https://github.com/jamulussoftware/jamulus/runs/5267841353?check_suite_focus=true#step:9:1294

@hoffie hoffie marked this pull request as draft February 21, 2022 01:00
@hoffie hoffie force-pushed the actions-cache-create-dmg branch 5 times, most recently from 29c78fb to 1167911 Compare February 21, 2022 11:37
@hoffie

This comment was marked as outdated.

@hoffie hoffie force-pushed the actions-cache-create-dmg branch 11 times, most recently from 3420e35 to 276fb61 Compare February 21, 2022 19:48
@pljones
Copy link
Collaborator

pljones commented Feb 21, 2022

Mac installs mean nothing to me. Was there something specific you were thinking of?

@hoffie hoffie force-pushed the actions-cache-create-dmg branch from 276fb61 to 8afb73c Compare February 21, 2022 20:38
@hoffie
Copy link
Member Author

hoffie commented Feb 21, 2022

Mac installs mean nothing to me. Was there something specific you were thinking of?

Hm, if I only knew... I might have confused this PR with another one. Sorry. Will ping softins once all problems with this PR are fixed.

@hoffie hoffie force-pushed the actions-cache-create-dmg branch 3 times, most recently from df9c00a to 10b6e8f Compare February 21, 2022 22:12
Comment on lines 81 to 84
brew extract --version="${create_dmg_version}" create-dmg homebrew/cask
brew install --build-bottle --formula "${formula}"
brew bottle "${formula}"
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it duplicate work if we run reinstall?

Why can't we just use an if/else?

Copy link
Member Author

@hoffie hoffie Feb 23, 2022

Choose a reason for hiding this comment

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

The problem is that --build-bottle seems to disable postinst scripts. I'm not sure if aqt uses those at all, but it might at some point, so I'd rather be on the safe side here.
There's also the option of running the postinst scripts explicitly. I chose the reinstall path though as it most closely ensures that both paths are really similar.

I should probably add a comment though.

The plain (re)install is really small, btw. Cloning the repo and searching for the right version seems to be the resource-intensive part.

Side note: The PR still doesn't work as it should, therefore it's still a draft again. When testing with a fake build (no compile), the logic works, while in the real build it doesn't (= always a fresh build). I'm probably missing something.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed that part now to make it clearer (uninstall package & add comment + regular install later).
Testing still not finalized, will continue tomorrow.

@hoffie hoffie force-pushed the actions-cache-create-dmg branch 2 times, most recently from 9cf292f to 10c6cdc Compare February 27, 2022 01:15
@hoffie
Copy link
Member Author

hoffie commented Feb 27, 2022

@hoffie hoffie marked this pull request as ready for review February 27, 2022 11:28
@hoffie hoffie requested a review from ann0see February 27, 2022 11:28
Copy link
Collaborator

@pljones pljones left a comment

Choose a reason for hiding this comment

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

I can't find the Action in hoffie:actions-cache-create-dmg for this to check but it seems clean in the PR build.

Copy link
Member

@ann0see ann0see left a comment

Choose a reason for hiding this comment

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

To me it still seems a bit strange to install and then uninstall the thing. But I'll probably need to be happy with that. Another possible step would be to ask on the brew forum how they do caching.

@hoffie
Copy link
Member Author

hoffie commented Feb 27, 2022

I can't find the Action in hoffie:actions-cache-create-dmg for this to check but it seems clean in the PR build.

The links I provided pointed to two different runs as part of this PR.
I don't think the branch as its own runs in my repo as the branch name doesn't start with autobuild*.

To me it still seems a bit strange to install and then uninstall the thing.

If you felt better with the other path (if (no package) { download; build; install; manual postinstall } else { install }) I can adjust that. The downside would be that the gap between cache-hit and cache-miss runs would be larger. Should I change it?

Another possible step would be to ask on the brew forum how they do caching.

The cache part isn't that complex at all. What makes most of the lines is the version-specific download, build and packaging.

@ann0see
Copy link
Member

ann0see commented Feb 27, 2022

Hmm. If your approach is better performance wise, we should go with that (and make the comment even clearer why we didn't choose the other approach).

Comment on lines 110 to 112
# uninstall again to ensure that we can install the package freshly without leftovers afterwards:
brew uninstall "${pkg_version}"
Copy link
Member

Choose a reason for hiding this comment

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

Something like "since brew install doesn't run postinst scripts, we are uninstalling it before later on installing it again [...]"

Copy link
Member Author

Choose a reason for hiding this comment

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

I've reworked the comment again.

(It's not about performance, it's more about correctness)

Failing to do so will lead to a missing cache reset when updating e.g.
create-dmg's vesion.

Related: jamulussoftware#2412
@hoffie hoffie force-pushed the actions-cache-create-dmg branch from 8cd1b29 to 6b48f6d Compare February 28, 2022 15:12
Copy link
Member

@softins softins left a comment

Choose a reason for hiding this comment

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

I looked at the workflow log and could see that on the first run, no cached files were found.

I then selected "Re-run all jobs" and observed the Mac build. This time it found the cached files, and the build continued successfully.

@hoffie hoffie mentioned this pull request Feb 28, 2022
5 tasks
@hoffie hoffie merged commit 259545f into jamulussoftware:master Feb 28, 2022
@hoffie hoffie deleted the actions-cache-create-dmg branch February 28, 2022 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build: Cache Mac's brew install (create-dmg)

4 participants