smack icon indicating copy to clipboard operation
smack copied to clipboard

Build artifacts

Open michael-emmi opened this issue 5 years ago • 10 comments

It would be great to have build artifacts (binaries) uploaded with each release, i.e., automated with Travis. Particularly:

  • RedHat/Yum
  • Ubuntu/Apt
  • MacOS/Homebrew

Maybe we could start with creating a tap/PPA for one/each of these. Eventually convince, e.g., Ubuntu to integrate into main distro in the long run.

michael-emmi avatar Dec 06 '19 19:12 michael-emmi

Might be a good idea to start with Ubuntu 18.

michael-emmi avatar Dec 06 '19 19:12 michael-emmi

This is kind of related to https://github.com/smackers/smack/issues/509. It would be good to explore switching to github actions first.

zvonimir avatar Dec 06 '19 20:12 zvonimir

I would argue that figuring out how to build packages can be considered completely orthogonal its automation.

So far I’ve looked a bit at Homebrew and Ubuntu. It appears that the key steps here are:

  1. Identifying a source tarball, e.g., smack-2.4.0.tar.gz.
  2. Creating some fairly lightweight metadata (e.g., Homebrew formula) which points to that tarball and a few other things: e.g., checksum, dependencies.
  3. Transforming the source and that metadata into a binary package via a build (e.g., Homebrew bottle).
  4. Uploading those two artifacts (e.g., formula and bottle) somewhere.

At any rate, we need to agree on the details of each of these steps before moving on to automation, e.g., where to the artifacts live? what platforms do we want to build for? etc.

michael-emmi avatar Dec 10 '19 15:12 michael-emmi

In the meantime I’ve been looking at creating a Homebrew tap with a smack formula and a workflow to create bottles.

It seems that Homebrew on Linux might be an easy way to distribute Linux binaries (via bottles), which I guess should work on any Linux distro. Not sure if this would be a good or bad idea, i.e., versus per-distro packages.

Any thoughts on that?

michael-emmi avatar Dec 28 '19 19:12 michael-emmi

I don't know much about packaging, and so I have a very basic question. Would dependencies such as Corral be packaged as well?

zvonimir avatar Dec 28 '19 19:12 zvonimir

Related to your question, I have never seen anyone use homebrew on Linux. So my hunch is that Linux users typically don't rely on homebrew. So I would guess that requiring from them to install homebrew first might discourage them. No solid data to back this up though, just hunches.

zvonimir avatar Dec 28 '19 19:12 zvonimir

Would dependencies such as Corral be packaged as well?

Yes, we’d have to figure out how to do that. The end result should be that brew install smack results in all of its dependencies being present or installed too, including Corral, so that smack can just be run.

michael-emmi avatar Dec 28 '19 19:12 michael-emmi

I have never seen anyone use homebrew on Linux.

This is still pretty new, so not surprised that we don’t know people using it (especially in academia). And while I agree that more users generally indicates reliability, at the end of the day I just want to follow the simplest path for this goal: getting binaries installed on any machine quickly with one single command.

michael-emmi avatar Dec 28 '19 19:12 michael-emmi

Oh, this is really appealing: "The Homebrew package manager may be used on Linux and Windows Subsystem for Linux (WSL)." So it might work just on Windows as well! Anyhow, I read a bit more about it and it looks really nice. So let's give it a try.

zvonimir avatar Dec 28 '19 20:12 zvonimir

Update: I‘ve got this working completely on MacOS by following this blog post and lifting these workflows from the same author.

Long story short: on macOS Catalina you can run brew tap smackers/smack && brew install smack and end up with a working smack installation in less than 5 seconds (excluding download time, and dependency installation):

% time (brew tap smackers/smack && brew install smack && smack --version)
==> Tapping smackers/smack
Cloning into '/usr/local/Homebrew/Library/Taps/smackers/homebrew-smack'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 10 (delta 0), reused 8 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), done.
Tapped 1 formula (39 files, 35.4KB).
==> Installing smack from smackers/smack
==> Downloading https://dl.bintray.com/smackers/bottles-smack/smack-2.4.0.catalina.bottle.tar.gz
Already downloaded: /Users/mje/Library/Caches/Homebrew/downloads/53c1b0067416e4e55455ed2dcb1bc52d859a980466ed605b1f675d9d11e9711e--smack-2.4.0.catalina.bottle.tar.gz
==> Pouring smack-2.4.0.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/smack/2.4.0: 44 files, 46.9MB
SMACK version 2.4.0
( brew tap smackers/smack && brew install smack && smack --version; )  4.68s user 3.19s system 95% cpu 8.257 total

This also works on pre-Catalina systems, though it takes longer. We currently only build Homebrew bottles for Catalina, because GitHub only provides virtual environments for the latest MacOS. Without a bottle for a given system, you’ve got to actually build smack. In principle, we could build bottles for, e.g,. Mojave, on our own systems.

This magic currently works like this: we update the release url for the smack formula in our homebrew tap, create a PR, and a workflow automatically builds Homebrew bottles, uploads them (to Bintray), and adds these lines to the formula (in a separate branch). Once we merge the branch and click to publish the latest version on Bintray, the bottles are available to anybody who taps (or updates their tap) of smackers/smack.

michael-emmi avatar Dec 29 '19 13:12 michael-emmi