Introducing swiftly, a new Swift toolchain installer and manager

I wasn't aware that the os-release file contained information about the Ubuntu version a derived distribution is based off of (thanks @harlanhaskins!). In that case, yeah swiftly-install.sh should be able to support most/all of them out of the box, provided they populate the os-release file with sufficient information. It looks like Linux Mint and Pop_OS do at the very least.

For other platforms (e.g. Debian), we'll still need the user to select which one they think will be the most supported though.

1 Like

I used to use swiftbox maintained by @stevapple on my Linux machine which is a lightweight shell script wrapper for swift installer and manager. Can we also consider mentioning it on the FAQ?

The first impression when switching to swiftly is its big binary size (~50MB currently).

The second problem I encounter is I got a 403 forbidden message and failed to use it.

➜  kyle swiftly install latest
Fetching the latest stable Swift release...
Error: received status "403 Forbidden" when reaching https://api.github.com/repos/apple/swift/releases?per_page=100&page=1: {"message":"API rate limit exceeded for 203.208.167.146. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}

Filed to a GitHub issue to track it.

Oh cool, I hadn't heard of swiftbox--it looks like it shares a lot of the goals of swiftly (easy install, supports snapshots). I think one of the main differences at this stage is that swiftly is written in Swift, which we think is important for maintainability and fostering community contributions. Regarding the FAQ, I think it's okay if the FAQ doesn't address every alternative manager, since the differences would largely be the same as those listed with swiftenv.

In order to support the quick install flow across different Linux distributions, the precompiled swiftly binaries statically link the Swift runtime libraries and libarchive, which adds to the size. Recompiling on your machine can reduce this if binary size is an issue.

Yeah, this is a known consequence of using the GitHub API. You can use the --token argument to supply a GitHub token to bypass the default low limit (the token doesn't need any priviledges). It can also be supplied via the SWIFTLY_GITHUB_TOKEN environment variable.

1 Like

For those interested in using swiftly on other platforms: I've just deployed an update to swiftly-install.sh which includes support for detecting derived platforms such as Linux Mint or Pop!_OS, as well as the option to manually select a platform, either interactively or via the --platform command line option. Hopefully this should make it easy to install swiftly on platforms other than those listed on swift.org.

cc @futurejones @jhoughjr @harlanhaskins

5 Likes

Thank you!

1 Like

That's great. Thanks very much!

At the time of writing (Sept 2023), Raspberry Pi OS is based on Debian Bullseye (Debian 11).
Ubuntu 20.04 Focal (which is based on Debian Bullseye) is an installation option in Swiftly.

I have successfully installed Swift (in as much as it installed and compiled a simple 'hello world' binary) onto a Raspberry Pi 4 running the latest Raspberry Pi OS using Swiftly and using the 20.04 Focal option.

:tada:

7 Likes

This is great news.

One thing this post highlights is that it would be nice if Swiftly were to support some kind of standardized self-test to run a minimal test suite on the installation: something more comprehensive than checking if Hello World works.

1 Like

That sounds like something that could be built up as a standalone wrapper package that pulls in tons of dependencies and run their test suites…

1 Like

Have a look at GitHub - swift-actions/setup-swift: GitHub Action that setup a Swift environment for Github Actions

I'm happy to announce that the 0.2.0 version of swiftly has been released! Notable changes include the new update and self-update commands. Check out the release page for full release notes: Release 0.2.0 · swift-server/swiftly · GitHub

To update, simply redownload and run the swiftly-install.sh script:

curl -L https://swift-server.github.io/swiftly/swiftly-install.sh | bash

Going forward, future swiftly updates can be performed through the self-update command within swiftly itself, but since swiftly 0.1.0 didn't have that command, swiftly-install.sh was updated to support updating swiftly without erasing the existing installation. If you do wish to overwrite the existing installation as part of installing swiftly (matching the previous swiftly-install.sh behavior), you can now provide the --overwrite flag.

Please check it out and let me know if you run into any issues!

10 Likes

The 0.3.0 version of swiftly has been released! The most notable change is that swiftly now supports (by default) verifying the PGP signature of the downloaded toolchain before installing it. Verification can be skipped by passing the --no-verify option to either install or update. While verifying by default is technically a breaking change, we felt it was important to have more secure defaults from the beginning, particularly because swiftly is still a ways away from being 1.0. Sorry in advance for any inconvenience this may cause.

Another notable change is that the self-update command was fixed in this release (thanks @kebo!). The original implementation was unfortunately broken in 0.2.0, so you'll need to use swiftly-install.sh to update your installation of swiftly.

We've also released swiftly-install.sh 0.4.0, which now includes support for the fish shell (thanks again @kebo!). It has also been updated to install Swift's PGP keys, which swiftly will use during toolchain verification.

Check out the full release notes here, and please let us know if you run into any issues! Release v0.3.0 · swift-server/swiftly · GitHub

9 Likes

Hey guy, this is awesome! I use the fish shell so I'll give 0.4.0 a shot. Thanks again!

4 Likes