Closed cschol closed 1 year ago
Fixed!
Hey Bret, I think there might be a way to use GitHub Actions to automatically cross-compile your code for Linux, Mac, and Windows every time you push. Then you get an email if anything fails. I'm going to try to do this in my Sapphire repo soon. Let me know if you're interested in the results of my attempt.
Absolutely! I'd love to set that up! :-) Thanks Don! Would it be possible to set up cppcheck as well?
Cool! And yes, there is a GitHub Actions cppcheck plugin. You can do pretty much anything you want in GitHub Actions as long as you can script it (bash / Windows batch), and somebody provides a GitHub Actions plugin for installing the required software on their backend.
Actually, I should correct that. Even if there is no plugin, sometimes you can install stuff yourself. I did that in my Astronomy Engine project for Doxygen. For Windows, my GitHub Actions script uses wget to download a zip file right off the Doxygen website, unzips it, and then runs the executable, right on their backend!
I got it working! I started with BaconPaul's example yml file from:
https://github.com/baconpaul/BaconPlugs/blob/main/.github/workflows/build-plugin.yml
His yml file does lots of fancy stuff like automating nightly builds, changing version numbers in the plugin.json, and other stuff I didn't need. So I stripped it down to something generic:
https://github.com/cosinekitty/sapphire/blob/limiter/.github/workflows/build-plugin.yml
You can create a directory in your own repo called .github/workflows
. Then copy that file and put it in that directory and push it to GitHub. It should just start running. Be sure to review it first to make sure you are comfortable with its contents. I believe it will work right out of the box.
Here's what it does. Go look at my limiter
branch in Sapphire:
https://github.com/cosinekitty/sapphire/tree/limiter
Look for the line that shows the most recent change:
Toward the right side of that line, right before the commit hash, there will be one of three symbols:
No matter what the symbol is, you can click on it to see more information. A box pops up with a list of the tests. Then you can click on Details. If the tests are running, you can actually monitor them in real time!
This yml file I'm showing you also creates "artifacts", which are zip files that contain the resulting builds for Linux, Mac, and Windows. This is how you can provide pre-release tests for other people to try out, if you want.
Let me know if you have any questions. I know GitHub Actions has greatly reduced "oopsies" in Astronomy Engine, so I know it will help reduce delivering flawed builds to VCV Rack also.
I'm getting it up and running right now! I don't know if this is relevant, but have you considered adding a flag like "--jobs=30" to the make command?
I use:
make --jobs=30 install
... which speeds up my build considerably.
I guess my code is pretty small so far. The build finishes in a few seconds, so I don't worry about it. I will keep that in mind for the future though!
It seems to be working!!!
Quick question: Where are the artifacts placed?
I had to hunt for it too the first time. From the front page of your repo, click on the Actions tab:
Then click on the workflow run you want to grab artifacts from:
Then scroll to the bottom to grab links to the zip files:
Issue is mismatch of file names and source code.