hexagonal-sun / bic

A C interpreter and API explorer.
GNU General Public License v2.0
815 stars 36 forks source link

Nightly homebrew build #42

Closed zbeekman closed 4 years ago

zbeekman commented 4 years ago

Create a nightly test build using the Homebrew build formula.

This will let you know if someone makes a change in homebrew, macOS, or a dependency that breaks bic and will also let you know if changes made to bic will require fixing/updating the homebrew formula. (Or changes made to bic introduced bugs that manifest themselves when installed via the formula.)

zbeekman commented 4 years ago

I have no idea why macOS on Travis-CI is failing. FWIW, I've found macOS on Travis-CI to be pretty unreliable.

I haven't touched any actual code, so there's no reason that this should fail.

hexagonal-sun commented 4 years ago

Many thanks for the PR! Will the nightly build happen on this repo or do I have to check the build status somewhere else?

Why Travis is failing is a mystery to me and I've had problems with it too. What would you recommend for MacOS CI?

zbeekman commented 4 years ago

Will the nightly build happen on this repo or do I have to check the build status somewhere else?

The nightly build will show up in the "actions" tab of this repository. For an example of what it looks like you can see it in action on my fork: https://github.com/zbeekman/bic/actions?query=workflow%3ANightly-Homebrew-Build

If you create a personal access token with gist and public repo scopes (this link will do it: https://github.com/settings/tokens/new?scopes=gist,public_repo&description=Homebrew) and then save that in a secret named HOMEBREW_GIST_TOKEN this action should™️ also post the homebrew logs and detailed debug information to a new gist when there is a failure.

As it stands, this action will run on a schedule at 06:45 (AM) UTC daily (late at night across the US), and also on pushes when the workflow file is touched, and pull requests against master when the workflow file is touched.

To prevent slamming the Bintray and Github API endpoints at a regular time scheduled jobs sleep for a random amount of time, between 0 and 10 minutes before proceeding. (But not pushes or PRs that touch the workflow file.)

Unless a PR is being tested (in which case, you want to get a quick result) Homebrew's package index is updated before proceeding.

The build process includes creation of a binary bottle which is homebrew's binary package format, and uploads it as a build artifact. You can find it posted on the workflow run page (the link will be in this repo though, not my fork, once you merge) and download it to investigate and test its functionality. It can be installed with brew install --force --force-bottle ./path/to/bic--HEAD-<short-sha>.catalina.bottle.tar.gz on macOS system matching the GitHub actions macOS major version (Catalina) after unzipping it, and/or you can fully extract the tarball to explore the contents.

It also shows and tests the linkage. This is effectively like running otool -L and seeing which libraries are system libraries and which libraries are from other homebrew formulae, and whether or not there's a missing dependency because an additional formula is being linked in or if there's a broken link.

Next it tests and audits the formula in a manner similar to what would be done during the Homebrew CI and bottling process. If a problem is encountered due to the audit, then it uses the actions warning annotation to post an annotation to this workflow file. The example linked is an error annotation, but it will be a warning going forwards.

Finally, if there was a failure (other than audit failure), it will upload the logs to a gist if the github token was added as a secret as described above.

Why Travis is failing is a mystery to me and I've had problems with it too. What would you recommend for MacOS CI?

I like using GitHub actions for macOS (and Linux and Windows) testing. In ~ 1-1.5 weeks I could try to help with setting this up.

zbeekman commented 4 years ago

Anything else needed from me to merge this?

hexagonal-sun commented 4 years ago

This looks good. Thanks for working on this and the thorough explanation.

Merging.