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..6710bb5cd --- /dev/null +++ b/artifacts.json @@ -0,0 +1 @@ +{"format_version":"0.6.5","tag":"v0.28.0","formatted_date":"Jan 8 2025 at 18:10 UTC","platforms_with_downloads":[{"target":["aarch64-apple-darwin"],"display_name":"macOS Apple Silicon","installers":[5,0,1]},{"target":["aarch64-unknown-linux-gnu"],"display_name":"Linux arm64","installers":[5,0,2]},{"target":["aarch64-unknown-linux-musl"],"display_name":"musl Linux arm64","installers":[5,0,3]},{"target":["x86_64-apple-darwin"],"display_name":"macOS Intel","installers":[5,0,6]},{"target":["x86_64-pc-windows-msvc"],"display_name":"Windows x64","installers":[4,0,7]},{"target":["x86_64-unknown-linux-gnu"],"display_name":"Linux x64","installers":[5,0,8]},{"target":["x86_64-unknown-linux-musl"],"display_name":"musl Linux x64","installers":[5,0,9]}],"downloadable_files":[[0,{"name":"cargo-dist-aarch64-apple-darwin.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-aarch64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},["macOS Apple Silicon"]],[2,{"name":"cargo-dist-aarch64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-aarch64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},["Linux arm64"]],[4,{"name":"cargo-dist-aarch64-unknown-linux-musl.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-aarch64-unknown-linux-musl.tar.xz","view_path":null,"checksum_file":null},["musl Linux arm64"]],[9,{"name":"cargo-dist-x86_64-apple-darwin.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},["macOS Intel"]],[11,{"name":"cargo-dist-x86_64-pc-windows-msvc.zip","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-pc-windows-msvc.zip","view_path":null,"checksum_file":null},["Windows x64"]],[13,{"name":"cargo-dist-x86_64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},["Linux x64"]],[15,{"name":"cargo-dist-x86_64-unknown-linux-musl.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-unknown-linux-musl.tar.xz","view_path":null,"checksum_file":null},["musl Linux x64"]]],"release":{"artifacts":{"files":[{"name":"cargo-dist-aarch64-apple-darwin.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-aarch64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},{"name":"cargo-dist-aarch64-apple-darwin.tar.xz.sha256","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-aarch64-apple-darwin.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"cargo-dist-aarch64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-aarch64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},{"name":"cargo-dist-aarch64-unknown-linux-gnu.tar.xz.sha256","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-aarch64-unknown-linux-gnu.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"cargo-dist-aarch64-unknown-linux-musl.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-aarch64-unknown-linux-musl.tar.xz","view_path":null,"checksum_file":null},{"name":"cargo-dist-aarch64-unknown-linux-musl.tar.xz.sha256","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-aarch64-unknown-linux-musl.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"cargo-dist-installer.ps1","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.ps1","view_path":"cargo-dist-installer.ps1.txt","checksum_file":null},{"name":"cargo-dist-installer.sh","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh","view_path":"cargo-dist-installer.sh.txt","checksum_file":null},{"name":"cargo-dist-npm-package.tar.gz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-npm-package.tar.gz","view_path":null,"checksum_file":null},{"name":"cargo-dist-x86_64-apple-darwin.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-apple-darwin.tar.xz","view_path":null,"checksum_file":null},{"name":"cargo-dist-x86_64-apple-darwin.tar.xz.sha256","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-apple-darwin.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"cargo-dist-x86_64-pc-windows-msvc.zip","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-pc-windows-msvc.zip","view_path":null,"checksum_file":null},{"name":"cargo-dist-x86_64-pc-windows-msvc.zip.sha256","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-pc-windows-msvc.zip.sha256","view_path":null,"checksum_file":null},{"name":"cargo-dist-x86_64-unknown-linux-gnu.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-unknown-linux-gnu.tar.xz","view_path":null,"checksum_file":null},{"name":"cargo-dist-x86_64-unknown-linux-gnu.tar.xz.sha256","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-unknown-linux-gnu.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"cargo-dist-x86_64-unknown-linux-musl.tar.xz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-unknown-linux-musl.tar.xz","view_path":null,"checksum_file":null},{"name":"cargo-dist-x86_64-unknown-linux-musl.tar.xz.sha256","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-x86_64-unknown-linux-musl.tar.xz.sha256","view_path":null,"checksum_file":null},{"name":"cargo-dist.rb","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist.rb","view_path":null,"checksum_file":null},{"name":"dist-manifest-schema.json","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/dist-manifest-schema.json","view_path":null,"checksum_file":null},{"name":"dist-manifest.json","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/dist-manifest.json","view_path":null,"checksum_file":null},{"name":"sha256.sum","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/sha256.sum","view_path":null,"checksum_file":null},{"name":"source.tar.gz","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/source.tar.gz","view_path":null,"checksum_file":null},{"name":"source.tar.gz.sha256","download_url":"https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/source.tar.gz.sha256","view_path":null,"checksum_file":null}],"installers":[{"label":"crates.io","description":"","app_name":null,"method":{"type":"Run","file":null,"run_hint":"cargo install cargo-dist"}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":0}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":2}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":4}},{"label":"powershell","description":"","app_name":null,"method":{"type":"Run","file":6,"run_hint":"powershell -c \"irm https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.ps1 | iex\""}},{"label":"shell","description":"","app_name":null,"method":{"type":"Run","file":7,"run_hint":"curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh | sh"}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":9}},{"label":"zip","description":"","app_name":null,"method":{"type":"Download","file":11}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":13}},{"label":"tarball","description":"","app_name":null,"method":{"type":"Download","file":15}}],"targets":{"aarch64-apple-darwin":[5,0,1],"aarch64-pc-windows-msvc":[4,0],"aarch64-unknown-linux-gnu":[5,0,2],"aarch64-unknown-linux-musl":[5,0,3],"i686-apple-darwin":[5,0],"i686-pc-windows-msvc":[4,0],"i686-unknown-linux-gnu":[5,0],"i686-unknown-linux-musl":[5,0],"x86_64-apple-darwin":[5,0,6],"x86_64-pc-windows-msvc":[4,0,7],"x86_64-unknown-linux-gnu":[5,0,8],"x86_64-unknown-linux-musl":[5,0,9]}}},"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..943bd8369 --- /dev/null +++ b/artifacts/index.html @@ -0,0 +1,293 @@ + + +
+
+cargo install cargo-dist
+
+
+
+
++powershell -c "irm https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.ps1 | iex"+ + + + + + + + + Source + +
+curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh | sh+ + + + + + + + + Source + +
File | +Platform | + +
---|---|
cargo-dist-aarch64-apple-darwin.tar.xz | ++ + + macOS Apple Silicon + + + | + +
cargo-dist-aarch64-unknown-linux-gnu.tar.xz | ++ + + Linux arm64 + + + | + +
cargo-dist-aarch64-unknown-linux-musl.tar.xz | ++ + + musl Linux arm64 + + + | + +
cargo-dist-x86_64-apple-darwin.tar.xz | ++ + + macOS Intel + + + | + +
cargo-dist-x86_64-pc-windows-msvc.zip | ++ + + Windows x64 + + + | + +
cargo-dist-x86_64-unknown-linux-gnu.tar.xz | ++ + + Linux x64 + + + | + +
cargo-dist-x86_64-unknown-linux-musl.tar.xz | ++ + + musl Linux x64 + + + | + +
This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +Archives are the primary output of 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.
+"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 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.
+++since 0.24.0
+
cargo-dist also generates a "unified" checksum file, like sha256.sum
, which contains the checksums for all the archives it has generated, in a format that can be checked with sha256sum -c
, for example.
Individual checksums will be deprecated in a future version in favor of that unified checksum file.
+Although you can pick other checksum algorithms, since you can only pick one, be aware that not every macOS/Linux/Windows system may have tools installed that are able to check blake2b
, for example.
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.
+ +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.
+++since 0.4.0
+
Sometimes, you may need extra packages from the system package manager to be installed before in the builder before dist begins building your software. dist can do this for you by adding the dependencies
setting to your dist config. 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.
By default, we run Apple silicon (aarch64) builds for macOS on the macos-13
runner, which is Intel-based. If your build process needs to link against C libraries from Homebrew using the dependencies
feature, you will need to switch to an Apple silicon-native runner to ensure that you have access to Apple silicon-native dependencies from Homebrew. You can do this using the custom runners feature. Currently, macos-14
is the oldest GitHub-provided runner for Apple silicon.
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, dist has the ability to specify these dependencies. By default, 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)
+
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:
+./
. 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:
+ # 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 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, dist uses the following runners:
+ubuntu-20.04
macos-13
macos-13
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 your dist config. Here's an example which adds support for Linux (aarch64) using runners from Buildjet:
# in `dist-workspace.toml`
+
+[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:
# in `dist-workspace.toml`
+
+[dist.github-custom-runners]
+aarch64-apple-darwin = "macos-14"
+
+++since 0.26.0
+
dist will transparently use either of:
+ +To try and build for the target you specified, from the host you specified.
+dist hardcodes knowledge of which cargo wrappers are better suited for which cross: cargo-zigbuild
+handles x86_64-unknown-linux-gnu
to aarch64-unknown-linux-gnu
handsomely, for example.
So if you ask for aarch64-unknown-linux-gnu
artifacts, because at the time of this writing
+there are no free aarch64
GitHub runners, dist will assume you meant this:
[dist.github-custom-runners]
+aarch64-unknown-linux-gnu = "ubuntu-20.04"
+
+Which really means this:
+[dist.github-custom-runners.aarch64-unknown-linux-gnu]
+runner = "ubuntu-20.04"
+host = "x86_64-unknown-linux-gnu"
+
+...since dist knows which platform GitHub's own runner +images are.
+So you really only need to specify the host
if you use third-party GitHub Actions
+runners (Namespace, Buildjet, etc.)
If you don't specify the host, dist will just assume it's the same platform as +the target, which is why this works:
+[dist.github-custom-runners]
+aarch64-unknown-linux-gnu = "buildjet-8vcpu-ubuntu-2204-arm"
+
+Building aarch64-pc-windows-msvc
binaries from a x86_64-pc-windows-msvc
runner (like
+windows-2019
) is surprisingly hard. But building both binaries from an x86_64-unknown-linux-gnu
+runner is surprisingly easy via cargo-xwin
This will work, eventually:
+# in `dist-workspace.toml`
+
+[dist]
+targets = ["x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"]
+
+[dist.github-custom-runners.x86_64-pc-windows-msvc]
+runner = "ubuntu-20.04"
+
+[dist.github-custom-runners.aarch64-pc-windows-msvc]
+runner = "ubuntu-20.04"
+
+...because dist can install cargo-xwin
via pip
. However, it will take
+forever. It's probably best to use a docker image that already has
+cargo-xwin
installed, and other dependencies you probably want:
# in `dist-workspace.toml`
+
+[dist]
+targets = ["x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"]
+
+[dist.github-custom-runners.x86_64-pc-windows-msvc]
+container = "messense/cargo-xwin"
+
+[dist.github-custom-runners.aarch64-pc-windows-msvc]
+container = "messense/cargo-xwin"
+
+Which is short for:
+# cut: the rest of the config file
+
+[dist.github-custom-runners.x86_64-pc-windows-msvc]
+container = { image = "messense/cargo-xwin", host = "x86_64-unknown-linux-gnu" }
+
+# etc.
+
+...but unfortunately, GitHub Actions's "run workflows in container" feature doesn't
+support emulation yet. We'd have to set up qemu, run docker manually, etc. — which
+dist doesn't do as of now. So the host
just defaults to x86_64-unknown-linux-gnu
+right now, because that's all the GitHub runners support anywyay.
So, because we're only specifying one feature, it's probably easier to just write this:
+[dist]
+targets = ["x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"]
+
+[dist.github-custom-runners]
+x86_64-pc-windows-msvc.container = "messense/cargo-xwin"
+aarch64-pc-windows-msvc.container = "messense/cargo-xwin"
+
+# (yes, that /is/ valid TOML)
+
+Note that you can use containers for non-cross reasons: maybe you want your binaries to be +compatible with really old versions of glibc, older than Ubuntu 20.04: in this case, you +can do something like:
+[dist.github-custom-runners.x86_64-unknown-linux-gnu]
+container = { image = "quay.io/pypa/manylinux_2_28_x86_64", host = "x86_64-unknown-linux-musl" }
+
+[dist.github-custom-runners.aarch64-unknown-linux-gnu]
+container = { image = "quay.io/pypa/manylinux_2_28_x86_64", host = "x86_64-unknown-linux-musl" }
+
+Note that here, the host triple for those container images is overridden to be x86_64-unknown-linux-musl
, because dist itself (which must run in the container) might be using a too-recent version of glibc.
Because of dist's cross-compilation support, if you have both cargo-zigbuild
and cargo-xwin
+installed on a macOS machine, you can build pretty much every target dist supports, by running
+dist build --artifacts all
— in fact, this is used to develop dist itself!
++since 0.3.0
+
By default, 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 dist init
or set the pr-run-mode
key to "upload"
in Cargo.toml
's dist config. For example:
pr-run-mode = "upload"
+
+These features are specialized to very particular usecases, but may be useful for some users.
+++since 0.20.0
+
This is an experimental feature.
+In the event that installing platform dependencies using dist's system dependency feature
+doesn't work for your needs, for example a build dependency for your project isn't provided by the
+system's package manager, dist provides a method for injecting build steps into the
+build-local-artifacts
job to prepare the container.
To do this, use the github-build-setup setting which
+should be a path relative to your .github/workflows/
directory, and which should point to a
+.yml
file containing the github workflow steps just as you would normally write them in a workflow.
+(don't forget that leading -
!)
For example, if you needed the Lua programming language installed you could update your Cargo.toml
with the following:
[workspace.metadata.dist]
+# ...
+github-build-setup = "build-setup.yml"
+
+An then include in the root of your repository a file named .github/workflows/build-setup.yml
containing the
+following.
- name: Install Lua
+ uses: xpol/setup-lua@v1
+ with:
+ lua-version: "5.3"
+- name: Check lua installation
+ run: lua -e "print('hello world!')"
+
+This would generate a build-local-artifacts
job with the following modifications.
# ...
+jobs:
+# ...
+ build-local-artifacts:
+ # ...
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: recursive
+ - name: Install Lua
+ uses: xpol/setup-lua@v1
+ with:
+ lua-version: "5.3"
+ - name: Check lua installation
+ run: lua -e "print('hello world!')"
+# ...
+
+Notice that we include the steps right after the actions/checkout
step meaning that we are doing
+this as early in the build job as possible.
Currently the use of folding (>
) and
+chomping (-
) multi-line string
+modifiers will probably generate a surprising outputs. This is particularly important for any
+actions that use the run
keyword and it is recommended to use the literal (|
) string modifier for
+multi-line strings.
++since 0.2.0
+
By default, 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 dist config, 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.14.0
+
You can change which repository a GitHub Release gets published to with the github-releases-repo setting.
+++since 0.3.0
+
The happy-path of 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 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 dist config, dist will stop trying to update the file and stop checking if it's out of date.
Although you're not "using dist wrong" if you do this, be aware that you are losing access to a lot of the convenience and UX benefits of dist. Every piece of documentation that says "just run dist init" may not work correctly, as a new feature may require the CI template to be updated. Even things as simple as "updating 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 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 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 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.
Redirecting to... ./index.html.
+ + diff --git a/book/ci/index.html b/book/ci/index.html new file mode 100644 index 000000000..a098b5634 --- /dev/null +++ b/book/ci/index.html @@ -0,0 +1,275 @@ + + + + + +All of the distribute functionality of dist depends on some kind of CI integration to provide things like file hosting, secret keys, and the ability to spin up multiple machines.
+dist enables CI for you by default the first time you dist init
. dist's core CI job can be customized using several extra features.
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:
+ +The default CI configuration covers most users' needs. For more advanced needs, we have an extensive guide on how to customize your CI pipeline.
+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 most important output of your build is your release, but there's more advanced information in the logs for users who need it.
+++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.
+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.
+ +++since 0.5.0
+
When releasing software in languages other than Rust or JavaScript, you'll need to tell dist how to build it — there are more buildsystems than stars in the sky, and dist can't know how to run all of them (or how to figure out what to release from them).
+This guide assumes you've already initialized the dist config; check the quickstart guide for how to get started.
+Build commands are the core difference between these builds and Rust builds. 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, let's imagine a C program with a simple makefile-based buildsystem. Its dist.toml
looks something 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 for publishing releases
+repository = "https://github.com/example/example"
+# The executables produced by your app
+binaries = ["main"]
+# The build command dist runs to produce those binaries
+build-command = ["make"]
+
+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 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.Redirecting to... ./custom-builds.html.
+ + diff --git a/book/highlight.css b/book/highlight.css new file mode 100644 index 000000000..ba57b82b2 --- /dev/null +++ b/book/highlight.css @@ -0,0 +1,82 @@ +/* + * An increased contrast highlighting scheme loosely based on the + * "Base16 Atelier Dune Light" theme by Bram de Haan + * (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) + * Original Base16 color scheme by Chris Kempson + * (https://github.com/chriskempson/base16) + */ + +/* Comment */ +.hljs-comment, +.hljs-quote { + color: #575757; +} + +/* Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #d70025; +} + +/* Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #b21e00; +} + +/* Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #008200; +} + +/* Blue */ +.hljs-title, +.hljs-section { + color: #0030f2; +} + +/* Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #9d00ec; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f6f7f6; + color: #000; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-addition { + color: #22863a; + background-color: #f0fff4; +} + +.hljs-deletion { + color: #b31d28; + background-color: #ffeef0; +} diff --git a/book/highlight.js b/book/highlight.js new file mode 100644 index 000000000..3256c00ed --- /dev/null +++ b/book/highlight.js @@ -0,0 +1,53 @@ +/* + Highlight.js 10.1.1 (93fd0d73) + License: BSD-3-Clause + Copyright (c) 2006-2020, Ivan Sagalaev +*/ +var hljs=function(){"use strict";function e(n){Object.freeze(n);var t="function"==typeof n;return Object.getOwnPropertyNames(n).forEach((function(r){!Object.hasOwnProperty.call(n,r)||null===n[r]||"object"!=typeof n[r]&&"function"!=typeof n[r]||t&&("caller"===r||"callee"===r||"arguments"===r)||Object.isFrozen(n[r])||e(n[r])})),n}class n{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data}ignoreMatch(){this.ignore=!0}}function t(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function r(e,...n){var t={};for(const n in e)t[n]=e[n];return n.forEach((function(e){for(const n in e)t[n]=e[n]})),t}function a(e){return e.nodeName.toLowerCase()}var i=Object.freeze({__proto__:null,escapeHTML:t,inherit:r,nodeStream:function(e){var n=[];return function e(t,r){for(var i=t.firstChild;i;i=i.nextSibling)3===i.nodeType?r+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:r,node:i}),r=e(i,r),a(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:r,node:i}));return r}(e,0),n},mergeStreams:function(e,n,r){var i=0,s="",o=[];function l(){return e.length&&n.length?e[0].offset!==n[0].offset?e[0].offsetdist distributes your binaries
+The TL;DR is that with 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 dist is quickly growing to try to cover them all!
+To accomplish this, 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, 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, dist gets to flex its biggest superpower: it generates its own CI scripts. For instance, enabling GitHub CI with 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 dist", "run it exactly once", "upload the artifacts it reported". We want you to be able to copy that one 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.
+