Document not found (404)
+This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +diff --git a/artifacts.js b/artifacts.js new file mode 100644 index 000000000..2dbfc7072 --- /dev/null +++ b/artifacts.js @@ -0,0 +1,245 @@ +/* Code modified from the blender website + * https://www.blender.org/wp-content/themes/bthree/assets/js/get_os.js?x82196 + */ + +let options = { + windows64: "x86_64-pc-windows", + windows32: "i686-pc-windows", + windowsArm: "aarch64-pc-windows", + + mac64: "x86_64-apple", + mac32: "i686-apple", + macSilicon: "aarch64-apple", + + linux64: "x86_64-unknown-linux", + linux32: "i686-unknown-linux", + linuxArm: "aarch64-unknown-linux", + + // ios: "ios", + // android: "linux-android", + // freebsd: "freebsd", +}; + +function isAppleSilicon() { + try { + var glcontext = document.createElement("canvas").getContext("webgl"); + var debugrenderer = glcontext + ? glcontext.getExtension("WEBGL_debug_renderer_info") + : null; + var renderername = + (debugrenderer && + glcontext.getParameter(debugrenderer.UNMASKED_RENDERER_WEBGL)) || + ""; + if (renderername.match(/Apple M/) || renderername.match(/Apple GPU/)) { + return true; + } + + return false; + } catch (e) {} +} + +function getOS() { + var OS = options.windows64.default; + var userAgent = navigator.userAgent; + var platform = navigator.platform; + + if (navigator.appVersion.includes("Win")) { + if ( + !userAgent.includes("Windows NT 5.0") && + !userAgent.includes("Windows NT 5.1") && + (userAgent.indexOf("Win64") > -1 || + platform == "Win64" || + userAgent.indexOf("x86_64") > -1 || + userAgent.indexOf("x86_64") > -1 || + userAgent.indexOf("amd64") > -1 || + userAgent.indexOf("AMD64") > -1 || + userAgent.indexOf("WOW64") > -1) + ) { + OS = options.windows64; + } else { + if ( + window.external && + window.external.getHostEnvironmentValue && + window.external + .getHostEnvironmentValue("os-architecture") + .includes("ARM64") + ) { + OS = options.windowsArm; + } else { + try { + var canvas = document.createElement("canvas"); + var gl = canvas.getContext("webgl"); + + var debugInfo = gl.getExtension("WEBGL_debug_renderer_info"); + var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL); + if (renderer.includes("Qualcomm")) OS = options.windowsArm; + } catch (e) {} + } + } + } + + //MacOS, MacOS X, macOS + if (navigator.appVersion.includes("Mac")) { + if ( + navigator.userAgent.includes("OS X 10.5") || + navigator.userAgent.includes("OS X 10.6") + ) { + OS = options.mac32; + } else { + OS = options.mac64; + + const isSilicon = isAppleSilicon(); + if (isSilicon) { + OS = options.macSilicon; + } + } + } + + // linux + if (platform.includes("Linux")) { + OS = options.linux64; + // FIXME: Can we find out whether linux 32-bit or ARM are used? + } + + // if ( + // userAgent.includes("iPad") || + // userAgent.includes("iPhone") || + // userAgent.includes("iPod") + // ) { + // OS = options.ios; + // } + // if (platform.toLocaleLowerCase().includes("freebsd")) { + // OS = options.freebsd; + // } + + return OS; +} + +let os = getOS(); +window.os = os; + +// Unhide and hydrate selector with events +const archSelect = document.querySelector(".arch-select"); +if (archSelect) { + archSelect.classList.remove("hidden"); + const selector = document.querySelector("#install-arch-select"); + if (selector) { + selector.addEventListener("change", onArchChange); + } +} + +// Hydrate tab buttons with events +Array.from(document.querySelectorAll(".install-tab[data-id]")).forEach((tab) => { + tab.addEventListener("click", onTabClick); +}); + +function onArchChange(evt) { + // Get target + const target = evt.currentTarget.value; + // Find corresponding installer lists + const newContentEl = document.querySelector(`.arch[data-arch=${target}]`); + const oldContentEl = document.querySelector(`.arch[data-arch]:not(.hidden)`); + // Hide old content element (if applicable) + if (oldContentEl) { + oldContentEl.classList.add("hidden"); + } + // Show new content element + newContentEl.classList.remove("hidden"); + // Show the first tab's content if nothing was selected before + if (newContentEl.querySelectorAll(".install-tab.selected").length === 0) { + const firstContentChild = newContentEl.querySelector(".install-content:first-of-type"); + const firstTabChild = newContentEl.querySelector(".install-tab:first-of-type"); + firstContentChild.classList.remove("hidden"); + if (firstTabChild) { + firstTabChild.classList.add("selected"); + } + } + // Hide "no OS detected" message + const noDetectEl = document.querySelector(".no-autodetect"); + noDetectEl.classList.add("hidden"); + // Hide Mac hint + document.querySelector(".mac-switch").classList.add("hidden"); +} + +function onTabClick(evt) { + // Get target and ID + const {triple, id} = evt.currentTarget.dataset; + if (triple) { + // Find corresponding content elements + const newContentEl = document.querySelector(`.install-content[data-id="${String(id)}"][data-triple=${triple}]`); + const oldContentEl = document.querySelector(`.install-content[data-triple=${triple}][data-id]:not(.hidden)`); + // Find old tab to unselect + const oldTabEl = document.querySelector(`.install-tab[data-triple=${triple}].selected`); + // Hide old content element + if (oldContentEl && oldTabEl) { + oldContentEl.classList.add("hidden"); + oldTabEl.classList.remove("selected"); + } + + // Unhide new content element + newContentEl.classList.remove("hidden"); + // Select new tab element + evt.currentTarget.classList.add("selected"); + } +} + +const allPlatforms = Array.from(document.querySelectorAll(`.arch[data-arch]`)); +let hit = allPlatforms.find( + (a) => { + // Show Intel Mac downloads if no M1 Mac downloads are available + if ( + a.attributes["data-arch"].value.includes(options.mac64) && + os.includes(options.macSilicon) && + !allPlatforms.find(p => p.attributes["data-arch"].value.includes(options.macSilicon))) { + // Unhide hint + document.querySelector(".mac-switch").classList.remove("hidden"); + return true; + } + return a.attributes["data-arch"].value.includes(os); + } +); + +if (hit) { + hit.classList.remove("hidden"); + const selectEl = document.querySelector("#install-arch-select"); + selectEl.value = hit.dataset.arch; + const firstContentChild = hit.querySelector(".install-content:first-of-type"); + const firstTabChild = hit.querySelector(".install-tab:first-of-type"); + firstContentChild.classList.remove("hidden"); + if (firstTabChild) { + firstTabChild.classList.add("selected"); + } +} else { + const noDetectEl = document.querySelector(".no-autodetect"); + if (noDetectEl) { + const noDetectElDetails = document.querySelector(".no-autodetect-details"); + if (noDetectElDetails) { + noDetectElDetails.innerHTML = `We detected you're on ${os} but there don't seem to be installers for that. ` + } + noDetectEl.classList.remove("hidden"); + } +} + +let copyButtons = Array.from(document.querySelectorAll("[data-copy]")); +if (copyButtons.length) { + copyButtons.forEach(function (element) { + element.addEventListener("click", () => { + navigator.clipboard.writeText(element.attributes["data-copy"].value); + }); + }); +} + +// Toggle for pre releases +const checkbox = document.getElementById("show-prereleases"); + +if (checkbox) { + checkbox.addEventListener("click", () => { + const all = document.getElementsByClassName("pre-release"); + + if (all) { + for (var item of all) { + item.classList.toggle("hidden"); + } + } + }); +} \ No newline at end of file diff --git a/artifacts.json b/artifacts.json new file mode 100644 index 000000000..9bfa4521f --- /dev/null +++ b/artifacts.json @@ -0,0 +1 @@ +{"format_version":"0.6.2","tag":"0.12.0-prerelease.1","formatted_date":null,"platforms_with_downloads":[{"target":["aarch64-apple-darwin"],"display_name":"macOS Apple Silicon","installers":[0]},{"target":["x86_64-apple-darwin"],"display_name":"macOS Intel","installers":[0]},{"target":["x86_64-pc-windows-msvc"],"display_name":"Windows x64","installers":[0]},{"target":["x86_64-unknown-linux-gnu"],"display_name":"Linux x64","installers":[0]}],"downloadable_files":[],"release":{"artifacts":{"files":[],"installers":[{"label":"crates.io","description":"","app_name":null,"method":{"type":"Run","file":null,"run_hint":"cargo install cargo-dist"}}],"targets":{"aarch64-apple-darwin":[0],"aarch64-pc-windows-msvc":[0],"aarch64-unknown-linux-gnu":[0],"aarch64-unknown-linux-musl":[0],"i686-apple-darwin":[0],"i686-pc-windows-msvc":[0],"i686-unknown-linux-gnu":[0],"i686-unknown-linux-musl":[0],"x86_64-apple-darwin":[0],"x86_64-pc-windows-msvc":[0],"x86_64-unknown-linux-gnu":[0],"x86_64-unknown-linux-musl":[0]}}},"os_script":"/cargo-dist/artifacts.js","has_checksum_files":false} \ No newline at end of file diff --git a/artifacts/index.html b/artifacts/index.html new file mode 100644 index 000000000..03edc3eec --- /dev/null +++ b/artifacts/index.html @@ -0,0 +1,133 @@ + + +
+
+cargo install cargo-dist
+
+
+
+
+File | +Platform | + +
---|
This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +Archives are the primary output of cargo-dist: a single file (zip or tarball) containing prebuilt executables/binaries for an app, along with additional static files like READMEs, LICENSEs, and CHANGELOGs. The docs previously referred to these as "executable-zips", so if you ever see that term floating around, this is what's being talked about.
+When you tell us to build an app for a platform we will always make an archive for it.
+Fetching installers will fetch and unpack archives from wherever you uploaded them. Bundling installers will use an exact copy of the binary stored in the archive, but may differ on other included files.
+We will always auto-detect READMEs, LICENSES, and CHANGELOGs with the following logic (described more below):
+README*
LICENSE*
/UNLICENSE*
CHANGELOG*
/RELEASES*
"Find XYZ*
" means we will look for a file whose name starts with "XYZ" in the same directory as the Cargo.toml for a package that defines the app. If no such file is found, we will also search for it in the same directory as the workspace's Cargo.toml (so packages "inherit" these files from the workspace).
It is generally assumed that a directory only contains one of each kind of file. If multiple possible matches are in the same directory we will arbitrarily pick the first one we saw, so don't rely on that.
+Auto-detected files are first and foremost auto-included into the archive, however they can also be used for other things. For instance, the autodetected CHANGELOG is fed into our CHANGELOG features.
+The "root" of an archive is either the actual root directory of the archive (zips); or a directory with the same name as the archive, but without the extension (tarballs). This difference is for compatibility/legacy reasons, and can be smoothed away by unpacking tarballs with tar's --strip-components=1
.
An app's archive always includes its binaries at the root.
+By default auto-detected files for a package are auto-included into its archives at the root of the package. The auto-includes config controls this behaviour.
+The include can be used to manually add specific files/directories to the root of the archive.
+Archives can be zips or tarballs (gz, xz, or zstd).
+By default we make .zip on windows and .tar.xz elsewhere, but this can be configured with windows-archive and unix-archive features.
+We currently always build with --profile=dist
By default we build with --workspace
to keep things consistent, but this can be configured with the precise-builds config (see those docs for details on when precise-builds will be force-enabled).
By default we build your packages with default features, but this can be configured with the features, default-features, and all-features configs.
+When targeting windows-msvc we will unconditionally append "-Ctarget-feature=+crt-static" to your RUSTFLAGS, which should just be the default for rustc but isn't for legacy reasons.
+We don't really support cross-compilation, but we'll faithfully attempt the compile by telling rustup to install the toolchain and passing --target
to cargo as instructed -- it will probably just fail. On macOS cross-compiles between Intel and Apple Silicon will work. linux-musl is slated for a future version.
"Code Signing" is a very overloaded term, with wildly varying implementations that accomplish different goals. For instance, Linux users are currently very big on sigstore as a fairly turn-key code signing solution, but neither Windows nor macOS acknowledge its existence (and likely never will, as the benefits of sigstore completely defeat the stated purpose of code signing requirements on those platforms).
+Roughly speaking, codesigning can be broken up into "Is this app made by the developer?" and "Can I trust apps made by this developer?". Tools like sigstore are focused on the former, while Windows/macOS only care about the latter. They want you to pay some money and jump through administrative hoops. They also expect you to pay completely different groups and go through completely different hoops, so each platform requires a completely different solution.
+ +By default cargo-dist will generate a matching checksum file for each archive it generates. The default checksum is sha256, so for instance my-app-x86_64-pc-windows-msvc.zip
will also come with my-app-x86_64-pc-windows-msvc.zip.sha256
that tools like sha256sum
can use. This can be configured with the checksum config.
Fetching installers can also use these checksums (or ones baked into them) to validate the integrity of the files they download. With https and unsigned checksums the security benefit is minimal, but it can catch more boring problems like data corruption.
+The homebrew installer actually ignores your checksum setting and always uses sha256 hashes that are baked into it, as required by homebrew itself.
+Updating the other fetching installers to use these checksums is still a work in progress.
+ +cargo-dist exists to help you distribute your binaries, which involves generating a lot of different files which we call Artifacts. Archives are the baseline artifacts that contain your binaries, and installers are the fancy artifacts that make it easy to install or run the binaries.
+This feature is currently disabled pending a rework, but basically we want to save your debuginfo/symbols/sourcemaps in the form of pdbs, dSYMs, etc. This will automatically happen as a side-effect of building archives.
+ +cargo-dist's generated CI configuration can be extended in several ways: it can be configured to install extra packages before the build begins, and it's possible to add extra jobs to run at specific lifecycle moments.
+In the past, you may have customized cargo-dist's generated CI configuration and used the allow-dirty = ["ci"]
configuration option. With these new customization options, you may well not need to directly hand-edit cargo-dist's config any longer; we encourate migrating to these new tools.
++since 0.4.0
+
Sometimes, you may need extra packages from the system package manager to be installed before in the builder before cargo-dist begins building your software. Cargo-dist can do this for you by adding the dependencies
setting to your Cargo.toml
. When set, the packages you request will be fetched and installed in the step before build
. Additionally, on macOS, the cargo build
process will be wrapped in brew bundle exec
to ensure that your dependencies can be found no matter where Homebrew placed them.
Sometimes, you may want to make sure your users also have these dependencies available when they install your software. If you use a package manager-based installer, cargo-dist has the ability to specify these dependencies. By default, cargo-dist will examine your program to try to detect which dependencies it thinks will be necessary. At the moment, Homebrew is the only supported package manager installer. You can also specify these dependencies manually.
+For more information, see the configuration syntax.
+++since 0.3.0 (publish-jobs) and 0.7.0 (other steps)
+
cargo-dist's CI can be configured to call additional jobs on top of the ones it has builtin. Currently, we support adding extra jobs to the the following list of steps:
+plan-jobs
(the beginning of the build process)build-local-artifacts-jobs
build-global-artifacts-jobs
host-jobs
(pre-publish)publish-jobs
post-announce-jobs
(after the release is created)Custom jobs have access to the plan, produced via the "plan" step. This is a JSON document containing information about the project, planned steps, and its outputs. It's the same format contained as the "dist-manifest.json" that will be included with your release. You can use this in your custom jobs to obtain information about what will be built. For more details on the format of this file, see the schema reference.
+To add a custom job, you need to follow two steps:
+Cargo.toml
's cargo-dist config, prefixed with a ./
. For example, if your job name is .github/workflows/my-publish.yml
, you would write it like this:publish-jobs = ["./my-publish"]
+
+Here's an example reusable workflow written using GitHub Actions. It won't do any real publishing, just echo text to the CI output. First, create a file named .github/workflows/publish-greeter.yml
with these contents:
name: Greeter
+
+on:
+ # Defining workflow_call means that this workflow can be called from
+ # your main workflow job
+ workflow_call:
+ # cargo-dist exposes the plan from the plan step, as a JSON string,
+ # to your job if it needs it
+ inputs:
+ plan:
+ required: true
+ type: string
+
+jobs:
+ greeter:
+ runs-on: ubuntu-latest
+ # This is optional; it exposes the plan to your job as an environment variable
+ env:
+ PLAN: ${{ inputs.plan }}
+ steps:
+ - name: Step 1
+ run: |
+ echo "Hello!"
+ echo "Plan is: ${PLAN}"
+
+Then, add the following to your publish-jobs
array:
publish-jobs = ["./publish-greeter"]
+
+Running cargo-dist init
for your tool will update your GitHub Actions configuration to make use of the new reusable workflow during the publish step.
(since 0.6.0)
+By default, cargo-dist uses the following runners:
+ubuntu-20.04
macos-12
macos-12
windows-2019
It's possible to configure alternate runners for these jobs, or runners for targets not natively supported by GitHub actions. To do this, use the github-custom-runners
configuration setting in Cargo.toml
. Here's an example which adds support for Linux (aarch64) using runners from Buildjet:
[workspace.metadata.dist.github-custom-runners]
+aarch64-unknown-linux-gnu = "buildjet-8vcpu-ubuntu-2204-arm"
+aarch64-unknown-linux-musl = "buildjet-8vcpu-ubuntu-2204-arm"
+
+In addition to adding support for new targets, some users may find it useful to use this feature to fine-tune their builds for supported targets. For example, some projects may wish to build on a newer Ubuntu runner or alternate Linux distros, or may wish to opt into building for Apple Silicon from a native runner by using the macos-14
runner. Here's an example which uses macos-14
for native Apple Silicon builds:
[workspace.metadata.dist.github-custom-runners]
+aarch64-apple-darwin = "macos-14"
+
+
+ ++since 0.0.3
+
The GitHub CI backend provides a "Release" Workflow that is triggered by pushing a tagged commit to your repository. It uses the tag to determine which packages you're trying to publish, and builds and uploads them to a GitHub Release.
+cargo-dist is currently very eager to setup the GitHub CI backend, so it's pretty easy to do! Most likely it was automatically setup the first time you ran cargo dist init
. If you followed the way-too-quickstart, then you should also have it setup.
You probably already have it set, but if you don't, now's the time to do it. We need to know the URL of your GitHub repository for several features, and the next step will fail without it.
+Run cargo dist init
on your project.
If you did the previous step, you should get prompted to "enable Github CI and Releases?", with the default answer being "yes". Choose yes.
+You will also get prompted to "check your release process in pull requests?", with the default answer being "plan - run 'cargo dist plan' on PRs (recommended)". Choose that option.
+Once init completes, some changes will be made to your project, check all of them in:
+ci = ["github"]
should be added to [workspace.metadata.dist]
./github/workflows/release.yml
should be created, this is your Release WorkflowSee the quickstart's testing guide for the various testing options.
+The easiest testing option for this is to open a pull-request for everything you checked in -- it should run the plan
step of your release CI as part of the PR.
Here are some more advanced things you can do with GitHub CI.
+++since 0.3.0
+
By default, cargo-dist will run the plan step on every pull request but won't perform a full release build. If these builds are turned on, the resulting pull request artifacts won't be uploaded to a release but will be available as a download from within the CI job. To enable this, select the "upload" option from the "check your release process in pull requests" question in cargo-dist-init
or set the pr-run-mode
key to "upload"
in Cargo.toml
's cargo-dist config. For example:
pr-run-mode = "upload"
+
+++since 0.2.0
+
By default, cargo-dist will want to create its own GitHub Release and set the title/body with things like your CHANGELOG/RELEASES and some info about how to install the release. However if you have your own process for generating the contents of GitHub Release, we support that.
+If you set create-release = false
in your cargo-dist config, cargo-dist will assume a draft Github Release for the current git tag already exists with the title/body you want, and just upload artifacts to it. At the end of a successful publish it will undraft the GitHub Release for you.
++since 0.3.0
+
The happy-path of cargo-dist has us completely managing release.yml, and since 0.3.0 we will actually consider it an error for there to be any edits or out of date information in release.yml.
+If there's something that cargo-dist can't do that makes you want to hand-edit the file, we'd love to hear about it so that you can stay on the happy-path!
+However we know you sometimes really need to do those hand-edits, so there is a way to opt into it. If you set allow-dirty = ["ci"]
in your cargo-dist config, cargo-dist will stop trying to update the file and stop checking if it's out of date.
Although you're not "using cargo-dist wrong" if you do this, be aware that you are losing access to a lot of the convenience and UX benefits of cargo-dist. Every piece of documentation that says "just run cargo dist init" may not work correctly, as a new feature may require the CI template to be updated. Even things as simple as "updating cargo-dist" will stop working.
+We have put a lot of effort into minimizing those situations, with plan
increasingly being responsible for dynamically computing what the CI should do, but that's not perfect, and there's no guarantees that future versions of cargo-dist won't completely change the way CI is structured.
++since 0.0.1
+
Here's a grab-bag of more random settings you probably don't want to use, but exist in case you need them.
+By default cargo-dist lets all the build tasks keep running even if one of them fails, to try to get you as much as possible when things go wrong. fail-fast = true
can be set to disable this.
By default cargo-dist breaks build tasks onto more machines than strictly necessary to create the maximum opportunities for concurrency and to increase fault-tolerance. For instance if you want to build for both arm64 macOS and x64 macOS, that could be done on the same machine, but we put it on two machines so they can be in parallel and succeed/fail independently. merge-tasks = true
can be set to disable this.
++since 0.4.0
+
Although most Rust builds are statically linked and contain their own Rust dependencies, some crates will end up dynamically linking against system libraries. It's useful to know what your software picked up—sometimes this will help you catch things you may not have intended, like dynamically linking to OpenSSL, or allow you to check for package manager-provided libraries your users will need to have installed in order to be able to run your software.
+cargo-dist provides a linkage report during your CI build in order to allow you to check for this. For macOS and Linux, it's able to categorize the targets it linked against to help you gauge whether or not it's likely to cause problems for your users. To view this, check the detailed view of your CI build and consult the "Build" step from the upload-local artifacts
jobs.
This feature is defined for advanced users; most users won't need to use it. It's most useful for developers with specialized build setups who want to ensure that their binaries will be safe for all of their users. A few examples of users who may need to use it:
+The report is divided into categories to help you make sense of where these libraries are from and what it might mean for your users. These categories are:
+/System
directory come with the operating system and are available to all users.Here's an example of what a linkage report looks like for a Linux binary;
+axolotlsay (x86_64-unknown-linux-gnu):
+
+┌────────────────────┬─────────────────────────────────────────────────┐
+│ Category ┆ Libraries │
+╞════════════════════╪═════════════════════════════════════════════════╡
+│ System ┆ /lib/x86_64-linux-gnu/libgcc_s.so.1 (libgcc-s1) │
+│ ┆ /lib/x86_64-linux-gnu/libpthread.so.0 (libc6) │
+│ ┆ /lib/x86_64-linux-gnu/libc.so.6 (libc6) │
+├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+│ Homebrew ┆ │
+├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+│ Public (unmanaged) ┆ │
+├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+│ Frameworks ┆ │
+├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
+│ Other ┆ │
+└────────────────────┴─────────────────────────────────────────────────┘
+
+While the linkage report can be run locally, the report for Linux artifacts can only be run on Linux.
+The Windows report is currently unable to provide information about the sources of libraries.
+ +All of the distribute functionality of cargo-dist depends on some kind of CI integration to provide things like file hosting, secret keys, and the ability to spin up multiple machines.
+A CI backend can be enabled with the ci config. cargo-dist's core CI job can be customized using several extra features.
+The CI process is divided into several stages which happen in order. Understanding these steps will help you follow the release process and, if necessary, debug failures.
+dist-manifest.json
.The following CI providers have been requested, and we're open to supporting them, but we have no specific timeline for when they will be implemented. Providing additional info/feedback on them helps us prioritize the work:
+ + +++since 0.5.0
+
Although cargo-dist was originally designed specifically for Cargo-based builds, we've introduced experimental features to allow you to use it to build and distribute any software written in any language. This feature is currently a prerelease: details may change before it becomes stable.
+In order for cargo-dist to recognize your application, it requires a TOML configuration file named dist.toml
. This file is similar to Cargo's Cargo.toml
, so users who are already familiar with Cargo should feel comfortable right away. Many of dist.toml
's fields are identical to Cargo.toml
, but there are a few extra fields specific to this file.
dist.toml
has two mandatory sections: package
, which you write yourself and which contains information about your application; and dist
, which contains cargo-dist's configuration and which cargo-dist init
generates for you.
To get started, write a dist.toml
containing just a package
section. A simple one looks like this:
[package]
+# Your app's name
+name = "my_app"
+# The current version; make sure to keep this up to date!
+version = "0.1.0"
+# The URL to the git repository; this is used
+repository = "https://example.com"
+# The executables your app produces
+binaries = ["main"]
+# The build command cargo-dist runs to produce those binaries
+build-command = ["make"]
+
+Once you've produced a configuration file, you can run cargo dist init
and let cargo-dist generate its own configuration. From here, the build and usage process looks very much like the normal cargo-dist setup; for more information, check the main quickstart documentation.
Build commands are the core difference between these builds and regular cargo-dist. Since we don't have Cargo to rely on to tell us how to build your package, it's up to you to tell us how instead.
+As an example, the above application is a C program with a simple makefile-based buildsystem. All you need to run to build this program is make
, so we specified build-command = ["make"]
. If your app has a more complex build that will require multiple commands to run, it may be easier for you to add a build script to your repository. In that case, build-command
can simply be a reference to executing it:
build-command = ["./build.sh"]
+
+We expose a special environment variable called CARGO_DIST_TARGET
into your build. It contains a Rust-style target triple for the platform we expect your build to build for. Depending on the language of the software you're building, you may need to use this to set appropriate cross-compilation flags. For example, when cargo-dist is building for an Apple Silicon Mac, we'll set aarch64-apple-darwin
in order to allow your build to know when it should build for aarch64 even if the host is x86_64.
On macOS, we expose several additional environment variables to help your buildsystem find dependencies. In the future, we may add more environment variables on all platforms.
+CFLAGS
/CPPFLAGS
: Flags used by the C preprocessor and C compiler while building.LDFLAGS
: Flags used by the C linker.PKG_CONFIG_PATH
/PKG_CONFIG_LIBDIR
: Paths for pkg-config
to help it locate packages.CMAKE_INCLUDE_PATH
/CMAKE_LIBRARY_PATH
: Paths for cmake
to help it locate packages' configuration files.These package fields are mandatory for cargo-dist to be able to build your package:
+name
: Your application's name.version
: The application's version. Currently, this must be in a Semver-compatible format.repository
: The URL to a git repository containing your application's source code.binaries
: An array of one or more executables your application's build will produce. The strings within this array are paths relative to your application's build directory; for example, if you produce a binary named main
within the ./src
directory, you can specify ["src/main"]
.build-command
: The command cargo-dist should run in order to build your application. This is an array of one or more strings; the first string is the command cargo-dist will run, and any subsequent strings are arguments to pass to that command.All of these fields and their definitions are identical to the ones defined by [Cargo.lock
][cargo-lock].
cstaticlibs
: An array of one or more C static libraries (.a
files) produced by your application's build.cdynamiclibs
: An array of one or more C dynamic libraries produced by your application's build.changelog
: The path to the application's changelog within its source code. This will be used for the text of release announcements.documentation
: The URL to where the application's documentation can be accessed.description
: A human-readable description of the application.readme
: The path to the application's README within its source code.authors
: An array containing the names of the application's developers.license
: The application's license, as an SPDX identifier.license-files
: An array containing a list of one or more license files within the source code.cargo-dist distributes your binaries
+The TL;DR is that with cargo-dist setup, just doing this:
+git commit -am "release: 0.2.0"
+git tag "v0.2.0"
+git push
+git push --tags
+
+Will make this Github Release:
+ +Or if you're using oranda, you'll get this website:
+ +Cutting releases of your apps and distributing binaries for them has a lot of steps, and cargo-dist is quickly growing to try to cover them all!
+To accomplish this, cargo-dist functionality can be broken up into two parts:
+The build functionality can be used on its own if you just want some tarballs and installers, but everything really comes together when you use the distribution functionality too.
+As a build tool, cargo-dist can do the following:
+That's a short list because "we make installers" is doing a lot of heavy lifting. Each installer could be (and sometimes is!) an entire standalone tool with its own documentation and ecosystem.
+As a distribution tool, cargo-dist gets to flex its biggest superpower: it generates its own CI scripts. For instance, enabling GitHub CI with cargo dist init
will generate release.yml, which implements the full pipeline of plan, build, host, publish, announce:
(Ideally "host" would come cleanly before "publish", but GitHub Releases doesn't really properly support this kind of staging, so we're forced to race the steps a bit here. Future work may provide a more robust release process.)
+Most of the scripts roughly amount to "install cargo-dist", "run it exactly once", "upload the artifacts it reported". We want you to be able to copy that one cargo-dist invocation CI did, run it on your machine, and get the same results without any fuss (not to bit-level precision, but to the kinds of precision normal people expect from cargo builds). No setting up docker, no weird linux-only shell scripts that assume a bunch of tools were setup in earlier CI steps.
+Of course even if we perfectly achieve this ideal, "you can run it locally" and "you want to run it locally" are different statements.
+To that point, release.yml can now run partially in pull-requests. The default is to only run the "plan" step, which includes many integrity checks to help prevent "oops the release process is broken and we only found out when we tried to cut a release".
+ +You can also crank the pull-request mode up to include the "build" step, in which case the PR Workflow Summary will include an artifacts.zip containing all the build results. We don't recommend keeping this on all the time (it's slow and wasteful), but it can be useful to temporarily turn on while testing a PR.
+ + +