Skip to content

Commit

Permalink
complete the rebrand of executable-zips to archives
Browse files Browse the repository at this point in the history
  • Loading branch information
Gankra committed Sep 26, 2023
1 parent abf5b42 commit 2537fe9
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 41 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ That's a short list because "we make [installers][]" is doing a lot of heavy lif

## Distributing

As a distribution tool, cargo-dist gets to flex its biggest superpower: **it generates its own CI scripts**. All you need to do is enable the GitHub CI backend, and `cargo dist init` will generate release.yml, which implements the full pipeline of plan, build, host, publish, announce:
As a distribution tool, cargo-dist gets to flex its biggest superpower: **it generates [its own CI scripts][ci-providers]**. For instance, enabling [GitHub CI][github-ci] with `cargo dist init` will generate release.yml, which implements the full pipeline of plan, build, host, publish, announce:

* Plan
* Waits for you to push a git tag for a new version (v1.0.0, my-app-v1.0.0, my-app/1.0.0, ...)
Expand All @@ -69,6 +69,8 @@ As a distribution tool, cargo-dist gets to flex its biggest superpower: **it gen
[tarballs]: https://opensource.axo.dev/cargo-dist/book/artifacts/archives.html
[installers]: https://opensource.axo.dev/cargo-dist/book/installers/index.html
[manifest]: https://opensource.axo.dev/cargo-dist/book/reference/schema.html
[github-ci]: https://opensource.axo.dev/cargo-dist/book/ci/github.html
[ci-providers]: https://opensource.axo.dev/cargo-dist/book/ci/index.html

# Read The Book!

Expand Down
2 changes: 1 addition & 1 deletion book/src/artifacts/archives.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Archives

Archives are the primary output of cargo-dist: a 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.
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][apps] for [a platform][config-targets] we will always make an archive for it.

Expand Down
8 changes: 6 additions & 2 deletions book/src/artifacts/checksums.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Checksums

By default cargo-dist will generate a matching checksum file for each artifact 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][config-checksum].
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][config-checksum].

[Fetching installers][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. Updating all fetching installers to use these checksums is [still a work in progress][issue-checksum-backlog].
[Fetching installers][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][issue-checksum-backlog].



[issue-checksum-backlog]: https://github.com/axodotdev/cargo-dist/issues/439

[config-checksum]: ../reference/config.md#checksum

[archive]: ../artifacts/archives.md
[fetching-installers]: ../installers/index.md#fetching-installers
5 changes: 3 additions & 2 deletions book/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ That's a short list because "we make [installers][]" is doing a lot of heavy lif

## Distributing

As a distribution tool, cargo-dist gets to flex its biggest superpower: **it generates its own CI scripts**. All you need to do is enable the GitHub CI backend, and `cargo dist init` will generate release.yml, which implements the full pipeline of plan, build, host, publish, announce:
As a distribution tool, cargo-dist gets to flex its biggest superpower: **it generates [its own CI scripts][ci-providers]**. For instance, enabling [GitHub CI][github-ci] with `cargo dist init` will generate release.yml, which implements the full pipeline of plan, build, host, publish, announce:

* Plan
* Waits for you to push a git tag for a new version (v1.0.0, my-app-v1.0.0, my-app/1.0.0, ...)
Expand Down Expand Up @@ -77,11 +77,12 @@ You can also crank the pull-request mode up to include the "build" step, in whic
![A GitHub Workflow Summary from running cargo-dist's release.yml with an "artifacts" download link at the bottom][workflow-artifacts]



[simple-release]: ./img/simple-github-release.png
[simple-oranda]: ./img/simple-github-release.png
[workflow-artifacts]: ./img/workflow-artifacts.png

[github-ci]: ./ci/github.md
[ci-providers]: ./ci/index.md
[installers]: ./installers/index.md
[tarballs]: ./artifacts/archives.md
[manifest]: ./reference/schema.md
10 changes: 5 additions & 5 deletions book/src/reference/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ First the easy part: `profile.dist` is the profile cargo-dist will build everyth

The other 3 fields are defining the various Artifacts that should be produced for each App in the workspace (because this is `[workspace.metadata]` and not `[package.metadata]`).

For each entry in `targets` you will get a build of your App for [that platform][rust-platform] in the form of an [executable-zip][].
For each entry in `targets` you will get a build of your App for [that platform][rust-platform] in the form of an [archive][].

For each entry in `installers` you get that kind of [installer][installers] for your App. There are two classes of installer: "global" and "local". This will be explained further in [the section on artifact modes][artifact-modes-section], but the tl;dr is that "global" installers are one-per-App while "local" installers are one-per-platform-per-app, similar to a [Github CI Matrix](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs).

Expand Down Expand Up @@ -124,7 +124,7 @@ Normally cargo-dist will error out if the Announcement Tag selects no Apps, beca

Now that we have a coherent Announcement and therefore have selected what apps we want to Release, we need to select what artifacts we want to build (or get a manifest for). Enumerating the exact artifacts for each invocation of cargo-dist would be tedious and error-prone, so we provide the `--artifacts=...` flag to specify the *Artifact Mode*, which is a certain subset of the Universe of all Artifacts:

* "local": artifacts that are per-target platform ([executable-zips][executable-zip], symbols, msi installers...)
* "local": artifacts that are per-target platform ([archives][archive], symbols, msi installers...)
* "global": artifacts that are one-per-app (shell installer, npm package...)
* "all": both global and local (so the whole Universe)
* "host": the default mode that kind of breaks the rules to let you test things out locally
Expand Down Expand Up @@ -188,7 +188,7 @@ In my case it's "x86_64-pc-windows-msvc", so let's try that:
cargo dist build --tag=v0.5.0 --artifacts=local --target=x86_64-pc-windows-msvc --no-local-paths
```

![A local build producing only executable-zips for the current platform][local-build-example]
![A local build producing only archives for the current platform][local-build-example]

Note that you can pass `--target` multiple times to select more than one. Note also that `--target` is not allowed to select targets that aren't specified by the config your Cargo.toml. This ensures that global installers are consistently aware of all the platform-specific artifacts they can fetch. ("host" mode breaks this rule.) ((Also in theory `--installer` should work the same for selecting specific installers but it's not well tested because there isn't any reason to ever use that outside of `cargo dist init`.))

Expand Down Expand Up @@ -218,7 +218,7 @@ Ok so here's what goes through cargo-dist's brains when you run it:
3. Determine what Targets we're building for
3. Call the specific Version of each App a "Release" ("my-app-v1.0.0")
4. For each Release-Target pair, create a "ReleaseVariant" ("my-app-v1.0.0-x86_64-apple-darwin")
5. Add executable-zip Artifacts to each Release (broadcasted to each Variant, filtered by Artifact Mode)
5. Add archive Artifacts to each Release (broadcasted to each Variant, filtered by Artifact Mode)
6. Add all the enabled Installers to each Release (local ones broadcasted to each Variant, filtered by Artifact Mode)
7. Compute the Build Steps necessary to produce each Artifact ("run cargo, copy this file, ...")
8. Generate top-level Announcement info like the body for a Github Release
Expand All @@ -241,7 +241,7 @@ CI will just invoke cargo-dist in the following sequence:

[guide]: ../workspaces/index.md
[installers]: ../installers/index.md
[executable-zip]: ../artifacts/archives.md
[archive]: ../artifacts/archives.md
[announcements-section]: #announcements-selecting-apps
[artifact-modes-section]: #artifact-modes-selecting-artifacts
[defining-your-apps-section]: #defining-your-apps
Expand Down
16 changes: 8 additions & 8 deletions book/src/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ cargo-dist has an internal notion of an "artifact download URL" that is required

### readme

cargo-dist defaults to trying to include certain "important" static files in your executable-zips. A README is one of them.
cargo-dist defaults to trying to include certain "important" static files in your archives. A README is one of them.

If you specify a path to a README file, cargo-dist will use that for all the packages it affects. If you don't, then cargo-dist will search for a README* file in the package's root directory and the workspace's root directory (preferring the package).

### license-file

cargo-dist defaults to trying to include certain "important" static files in your executable-zips. A LICENSE is one of them.
cargo-dist defaults to trying to include certain "important" static files in your archives. A LICENSE is one of them.

If you specify a path to a license file, cargo-dist will use that for all packages it affects. Otherwise, cargo-dist will search for LICENSE* or UNLICENSE* files in the package's root directory and the workspace's root directory (preferring the package). If multiple are defined in the same directory, we will grab them all (this is necessary for the extremely common dual MIT/Apache license, which often results in two LICENSE-* files).

Expand Down Expand Up @@ -149,23 +149,23 @@ See the [installers documentation][homebrew-installer] for more information on H
Example: `include = ["my-cool-file.txt", "../other-cool-file.txt", "./some/dir/"]`

This is a list of additional *files* or *directories* to copy into the root of all [executable-zips][] that this setting affects. The paths are relative to the directory of the Cargo.toml that you placed this setting in. Globs are not supported.
This is a list of additional *files* or *directories* to copy into the root of all [archives][] that this setting affects. The paths are relative to the directory of the Cargo.toml that you placed this setting in. Globs are not supported.

### auto-includes

> since 0.0.3
Example: `auto-includes = false`

Allows you to specify whether cargo-dist should auto-include README, (UN)LICENSE, and CHANGELOG/RELEASES files in [executable-zips][]. Defaults to true.
Allows you to specify whether cargo-dist should auto-include README, (UN)LICENSE, and CHANGELOG/RELEASES files in [archives][]. Defaults to true.

### windows-archive

> since 0.0.5
Example: `windows-archive = ".tar.gz"`

Allows you to specify the file format to use for [executable-zips][] that target windows. The default is
Allows you to specify the file format to use for [archives][] that target windows. The default is
".zip". Supported values:

* ".zip"
Expand All @@ -181,7 +181,7 @@ See also unix-archive below.
Example: `unix-archive = ".tar.gz"`

Allows you to specify the file format to use for [executable-zips][] that target not-windows. The default is
Allows you to specify the file format to use for [archives][] that target not-windows. The default is
".tar.xz". See "windows-archive" above for a complete list of supported values.


Expand Down Expand Up @@ -212,7 +212,7 @@ If no scope is specified the package will be global.
Example: `checksum = "sha512"`

Specifies how to checksum [executable-zips][]. Supported values:
Specifies how to checksum [archives][]. Supported values:

* "sha256" (default) - generate a .sha256 file for each archive
* "sha512" - generate a .sha512 file for each archive
Expand Down Expand Up @@ -446,7 +446,7 @@ Caveat: the default "host" Artifact Mode does something fuzzier with `--target`
[npm installers]: ../installers/npm.md
[artifact-url]: ../reference/artifact-url.md
[generate]: ../reference/cli.md#cargo-dist-generate
[executable-zips]: ../artifacts/archives.md
[archives]: ../artifacts/archives.md
[artifact-modes]: ../reference/concepts.md#artifact-modes-selecting-artifacts

[workspace-metadata]: https://doc.rust-lang.org/cargo/reference/workspaces.html#the-metadata-table
Expand Down
4 changes: 2 additions & 2 deletions cargo-dist/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub struct BuildArgs {
/// Which subset of the Artifacts to build
///
/// Artifacts can be broken up into two major classes: "local" ones, which are
/// made for each target system (executable-zips, symbols, msi installers...); and "global" ones,
/// made for each target system (archives, symbols, msi installers...); and "global" ones,
/// which are made once per app (curl-sh installers, npm package, metadata...).
///
/// Having this distinction lets us run cargo-dist independently on
Expand All @@ -197,7 +197,7 @@ pub struct BuildArgs {
/// How we should select the artifacts to build
#[derive(ValueEnum, Copy, Clone, Debug)]
pub enum ArtifactMode {
/// Build target-specific artifacts like executable-zips and msi installers
/// Build target-specific artifacts like archives and msi installers
Local,
/// Build unique artifacts like curl-sh installers and npm packages
Global,
Expand Down
4 changes: 2 additions & 2 deletions cargo-dist/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub struct DistMetadata {
#[serde(skip_serializing_if = "Option::is_none")]
pub targets: Option<Vec<String>>,

/// Include the following static files in bundles like executable-zips.
/// Include the following static files in bundles like archives.
///
/// Paths are relative to the Cargo.toml this is defined in.
///
Expand Down Expand Up @@ -461,7 +461,7 @@ pub struct Config {
/// How we should select the artifacts to build
#[derive(Clone, Copy, Debug)]
pub enum ArtifactMode {
/// Build target-specific artifacts like executable-zips, symbols, msi installers
/// Build target-specific artifacts like archives, symbols, msi installers
Local,
/// Build globally unique artifacts like curl-sh installers, npm packages, metadata...
Global,
Expand Down
12 changes: 6 additions & 6 deletions cargo-dist/src/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! 4. for each TargetTriple, create a ReleaseVariant of each Release
//! 5. add target-specific Binaries to each ReleaseVariant
//! 6. add Artifacts to each Release, which will be propagated to each ReleaseVariant as necessary
//! 1. add executable-zips, propagated to ReleaseVariants
//! 1. add archives, propagated to ReleaseVariants
//! 2. add installers, each one decides if it's global or local
//! 7. compute actual BuildSteps from the current graph (a Binary will only induce an actual `cargo build`
//! here if one of the Artifacts that was added requires outputs from it!)
Expand Down Expand Up @@ -436,7 +436,7 @@ pub struct Archive {
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum ArtifactKind {
/// An executable zip
/// An Archive containing binaries (aka ExecutableZip)
ExecutableZip(ExecutableZip),
/// Symbols
Symbols(Symbols),
Expand All @@ -446,7 +446,7 @@ pub enum ArtifactKind {
Checksum(ChecksumImpl),
}

/// An ExecutableZip Artifact
/// An Archive containing binaries (aka ExecutableZip)
#[derive(Debug)]
pub struct ExecutableZip {
// everything important is already part of Artifact
Expand Down Expand Up @@ -505,7 +505,7 @@ pub struct Release {
pub checksum: ChecksumStyle,
/// The @scope to include in NPM packages
pub npm_scope: Option<String>,
/// Static assets that should be included in bundles like executable-zips
/// Static assets that should be included in bundles like archives
pub static_assets: Vec<(StaticAssetKind, Utf8PathBuf)>,
/// Strategy for selecting paths to install to
pub install_path: InstallPathStrategy,
Expand All @@ -523,7 +523,7 @@ pub struct ReleaseVariant {
pub id: String,
/// Binaries included in this Release Variant
pub binaries: Vec<BinaryIdx>,
/// Static assets that should be included in bundles like executable-zips
/// Static assets that should be included in bundles like archives
pub static_assets: Vec<(StaticAssetKind, Utf8PathBuf)>,
/// Artifacts that are "local" to this variant (binaries, symbols, msi-installer...)
pub local_artifacts: Vec<ArtifactIdx>,
Expand Down Expand Up @@ -937,7 +937,7 @@ impl<'pkg_graph> DistGraphBuilder<'pkg_graph> {
self.release(to_release).id
);

// Create an executable-zip for each Variant
// Create an archive for each Variant
let release = self.release(to_release);
let variants = release.variants.clone();
let checksum = release.checksum;
Expand Down
2 changes: 1 addition & 1 deletion cargo-dist/templates/ci/github_ci.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (executable-zips, installers, hashes)
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release™
{{%- if create_release %}}
Expand Down
2 changes: 1 addition & 1 deletion cargo-dist/tests/snapshots/akaikatana_basic.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ Install-Binary "$Args"
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (executable-zips, installers, hashes)
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ Install-Binary "$Args"
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (executable-zips, installers, hashes)
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release
#
Expand Down
2 changes: 1 addition & 1 deletion cargo-dist/tests/snapshots/axolotlsay_basic.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2174,7 +2174,7 @@ maybeInstall(true).then(run);
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (executable-zips, installers, hashes)
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release
#
Expand Down
2 changes: 1 addition & 1 deletion cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,7 @@ maybeInstall(true).then(run);
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (executable-zips, installers, hashes)
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,7 @@ maybeInstall(true).then(run);
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (executable-zips, installers, hashes)
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ Install-Binary "$Args"
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (executable-zips, installers, hashes)
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release
#
Expand Down
Loading

0 comments on commit 2537fe9

Please sign in to comment.