Skip to content

Commit

Permalink
chore: Preparing to use 'dist' for more releases.
Browse files Browse the repository at this point in the history
This relies on the upgrade to the latest version of 'dist'. Since
we now have plugins that we want to produce pre-built binaries for,
this updates our build configuration to support that. It'll need to
be tested.

Signed-off-by: Andrew Lilley Brinker <[email protected]>
  • Loading branch information
alilleybrinker committed Nov 8, 2024
1 parent 54eef22 commit 8be06d2
Show file tree
Hide file tree
Showing 32 changed files with 338 additions and 96 deletions.
38 changes: 4 additions & 34 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,52 +31,22 @@ members = [
"plugins/identity",
"plugins/linguist",
"plugins/review",
"plugins/typo"]
"plugins/typo",
]

# Make sure Hipcheck is run with `cargo run`.
#
# This means to use `xtask` with `cargo run` you need to specify the package.
# See `.cargo/config.toml` for how this is done.
default-members = ["hipcheck"]

# Config for 'dist'
[workspace.metadata.dist]
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.25.1"
# CI backends to support
ci = "github"
# The installers to generate for each app
installers = ["shell", "powershell"]
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
# Which actions to run on pull requests
pr-run-mode = "plan"
# Whether to install an updater program
install-updater = true
# Extra static files to include in each App (path relative to this Cargo.toml's dir)
include = ["config/"]
# Path that installers should place binaries in
install-path = "CARGO_HOME"

# Ubuntu build dependencies for `cargo-dist`
[workspace.metadata.dist.dependencies.apt]
protobuf-compiler = "*"

# macOS build dependencies for 'cargo-dist'
[workspace.metadata.dist.dependencies.homebrew]
protobuf = "*"

# Windows build dependencies for `cargo-dist`
[workspace.metadata.dist.dependencies.chocolatey]
protoc = "*"

# The profile that 'cargo dist' will build with
[profile.dist]

#
# For now this is just the release profile, but with "thin" Link-Time
# Optimization enabled. This performs _some_ LTO and tries to hit the
# right trade-off between the runtime performance improvements of more
# LTO and the compile time cost of doing LTO.
[profile.dist]
inherits = "release"
lto = "thin"

Expand Down
46 changes: 46 additions & 0 deletions dist-workspace.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[workspace]

# All the packages which 'cargo-dist' is responsible for.
# This is _only_ the binary packages in the overall project, so it excludes
# libraries including any SDKs and our supporting libraries.
members = [
"cargo:hipcheck",
"cargo:plugins/activity",
"cargo:plugins/affiliation",
"cargo:plugins/binary",
"cargo:plugins/churn",
"cargo:plugins/entropy",
"cargo:plugins/fuzz",
"cargo:plugins/git",
"cargo:plugins/github",
"cargo:plugins/identity",
"cargo:plugins/linguist",
"cargo:plugins/npm",
"cargo:plugins/review",
"cargo:plugins/typo",
]

[dist]

cargo-dist-version = "0.25.1"
ci = "github"
pr-run-mode = "plan"
install-path = ["~/.local/bin", "~/.hipcheck/bin"]
targets = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
]

# Make sure that both Hipcheck and all the plugins are built with the protobuf
# compiler present on their platform.

[dist.dependencies.apt]
protobuf-compiler = "*"

[dist.dependencies.homebrew]
protobuf = "*"

[dist.dependencies.chocolatey]
protoc = "*"
12 changes: 6 additions & 6 deletions hipcheck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ rustls = { version = "0.23.10", default-features = false, features = [
] }
rustls-native-certs = "0.8.0"
salsa = "0.16.1"
schemars = { version = "0.8.21", default-features = false, features = ["derive", "preserve_order", "chrono", "url"] }
schemars = { version = "0.8.21", default-features = false, features = [
"derive",
"preserve_order",
"chrono",
"url",
] }
semver = "1.0.9"
serde = { version = "1.0.214", features = ["derive", "rc"] }
serde_derive = "1.0.137"
Expand Down Expand Up @@ -151,8 +156,3 @@ which = { version = "7.0.0", default-features = false }
dirs = "5.0.1"
tempfile = "3.13.0"
test-log = "0.2.16"

[package.metadata.dist]

# Make sure that `cargo-dist` can find this binary.
dist = true
15 changes: 15 additions & 0 deletions hipcheck/dist.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

[dist]

# Make sure that 'dist' will handle releases for this. Otherwise, since
# the crate is set to 'publish = false', 'dist' would ignore it by default.
dist = true

# For now we'll only use these installers. In the future we might add others.
installers = ["shell", "powershell"]

# Yes we want the updater.
install-updater = true

# Make sure to include the configuration.
include = ["../config/"]
14 changes: 14 additions & 0 deletions plugins/activity/dist.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

[dist]

# Make sure that 'dist' will handle releases for this. Otherwise, since
# the crate is set to 'publish = false', 'dist' would ignore it by default.
dist = true

# We explicitly *don't* want 'dist' to produce installers; just to prebuild
# the binaries for us and bundle everything together. Hipcheck itself will
# handle people getting the prebuilt binaries based on the download manifest.
installers = []

# Make sure to include the plugin manifest.
include = ["plugin.kdl"]
12 changes: 7 additions & 5 deletions plugins/activity/plugin.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ publisher "mitre"
name "activity"
version "0.1.0"
license "Apache-2.0"

entrypoint {
on arch="aarch64-apple-darwin" "./target/debug/activity"
on arch="x86_64-apple-darwin" "./target/debug/activity"
on arch="x86_64-unknown-linux-gnu" "./target/debug/activity"
on arch="x86_64-pc-windows-msvc" "./target/debug/activity.exe"
on arch="aarch64-apple-darwin" "activity"
on arch="x86_64-apple-darwin" "activity"
on arch="x86_64-unknown-linux-gnu" "activity"
on arch="x86_64-pc-windows-msvc" "activity.exe"
}

dependencies {
plugin "mitre/git" version="0.1.0" manifest="./plugins/git/plugin.kdl"
plugin "mitre/git" version="0.1.0" manifest="./plugins/git/plugin.kdl"
}
14 changes: 14 additions & 0 deletions plugins/affiliation/dist.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

[dist]

# Make sure that 'dist' will handle releases for this. Otherwise, since
# the crate is set to 'publish = false', 'dist' would ignore it by default.
dist = true

# We explicitly *don't* want 'dist' to produce installers; just to prebuild
# the binaries for us and bundle everything together. Hipcheck itself will
# handle people getting the prebuilt binaries based on the download manifest.
installers = []

# Make sure to include the plugin manifest.
include = ["plugin.kdl"]
9 changes: 5 additions & 4 deletions plugins/affiliation/plugin.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ publisher "mitre"
name "affiliation"
version "0.1.0"
license "Apache-2.0"

entrypoint {
on arch="aarch64-apple-darwin" "./target/debug/affiliation"
on arch="x86_64-apple-darwin" "./target/debug/affiliation"
on arch="x86_64-unknown-linux-gnu" "./target/debug/affiliation"
on arch="x86_64-pc-windows-msvc" "./target/debug/affiliation.exe"
on arch="aarch64-apple-darwin" "affiliation"
on arch="x86_64-apple-darwin" "affiliation"
on arch="x86_64-unknown-linux-gnu" "affiliation"
on arch="x86_64-pc-windows-msvc" "affiliation.exe"
}

dependencies {
Expand Down
14 changes: 14 additions & 0 deletions plugins/binary/dist.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

[dist]

# Make sure that 'dist' will handle releases for this. Otherwise, since
# the crate is set to 'publish = false', 'dist' would ignore it by default.
dist = true

# We explicitly *don't* want 'dist' to produce installers; just to prebuild
# the binaries for us and bundle everything together. Hipcheck itself will
# handle people getting the prebuilt binaries based on the download manifest.
installers = []

# Make sure to include the plugin manifest.
include = ["plugin.kdl"]
9 changes: 5 additions & 4 deletions plugins/binary/plugin.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ publisher "mitre"
name "binary"
version "0.1.0"
license "Apache-2.0"

entrypoint {
on arch="aarch64-apple-darwin" "./target/debug/binary"
on arch="x86_64-apple-darwin" "./target/debug/binary"
on arch="x86_64-unknown-linux-gnu" "./target/debug/binary"
on arch="x86_64-pc-windows-msvc" "./target/debug/binary.exe"
on arch="aarch64-apple-darwin" "binary"
on arch="x86_64-apple-darwin" "binary"
on arch="x86_64-unknown-linux-gnu" "binary"
on arch="x86_64-pc-windows-msvc" "binary.exe"
}
14 changes: 14 additions & 0 deletions plugins/churn/dist.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

[dist]

# Make sure that 'dist' will handle releases for this. Otherwise, since
# the crate is set to 'publish = false', 'dist' would ignore it by default.
dist = true

# We explicitly *don't* want 'dist' to produce installers; just to prebuild
# the binaries for us and bundle everything together. Hipcheck itself will
# handle people getting the prebuilt binaries based on the download manifest.
installers = []

# Make sure to include the plugin manifest.
include = ["plugin.kdl"]
9 changes: 5 additions & 4 deletions plugins/churn/plugin.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ publisher "mitre"
name "churn"
version "0.1.0"
license "Apache-2.0"

entrypoint {
on arch="aarch64-apple-darwin" "./target/debug/churn"
on arch="x86_64-apple-darwin" "./target/debug/churn"
on arch="x86_64-unknown-linux-gnu" "./target/debug/churn"
on arch="x86_64-pc-windows-msvc" "./target/debug/churn.exe"
on arch="aarch64-apple-darwin" "churn"
on arch="x86_64-apple-darwin" "churn"
on arch="x86_64-unknown-linux-gnu" "churn"
on arch="x86_64-pc-windows-msvc" "churn.exe"
}

dependencies {
Expand Down
14 changes: 14 additions & 0 deletions plugins/entropy/dist.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

[dist]

# Make sure that 'dist' will handle releases for this. Otherwise, since
# the crate is set to 'publish = false', 'dist' would ignore it by default.
dist = true

# We explicitly *don't* want 'dist' to produce installers; just to prebuild
# the binaries for us and bundle everything together. Hipcheck itself will
# handle people getting the prebuilt binaries based on the download manifest.
installers = []

# Make sure to include the plugin manifest.
include = ["plugin.kdl"]
14 changes: 8 additions & 6 deletions plugins/entropy/plugin.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ publisher "mitre"
name "entropy"
version "0.1.0"
license "Apache-2.0"

entrypoint {
on arch="aarch64-apple-darwin" "./target/debug/entropy"
on arch="x86_64-apple-darwin" "./target/debug/entropy"
on arch="x86_64-unknown-linux-gnu" "./target/debug/entropy"
on arch="x86_64-pc-windows-msvc" "./target/debug/entropy.exe"
on arch="aarch64-apple-darwin" "entropy"
on arch="x86_64-apple-darwin" "entropy"
on arch="x86_64-unknown-linux-gnu" "entropy"
on arch="x86_64-pc-windows-msvc" "entropy.exe"
}

dependencies {
plugin "mitre/git" version="0.1.0" manifest="./plugins/git/plugin.kdl"
}
plugin "mitre/git" version="0.1.0" manifest="./plugins/git/plugin.kdl"
}
14 changes: 14 additions & 0 deletions plugins/fuzz/dist.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

[dist]

# Make sure that 'dist' will handle releases for this. Otherwise, since
# the crate is set to 'publish = false', 'dist' would ignore it by default.
dist = true

# We explicitly *don't* want 'dist' to produce installers; just to prebuild
# the binaries for us and bundle everything together. Hipcheck itself will
# handle people getting the prebuilt binaries based on the download manifest.
installers = []

# Make sure to include the plugin manifest.
include = ["plugin.kdl"]
12 changes: 7 additions & 5 deletions plugins/fuzz/plugin.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ publisher "mitre"
name "fuzz"
version "0.1.0"
license "Apache-2.0"

entrypoint {
on arch="aarch64-apple-darwin" "./target/debug/fuzz"
on arch="x86_64-apple-darwin" "./target/debug/fuzz"
on arch="x86_64-unknown-linux-gnu" "./target/debug/fuzz"
on arch="x86_64-pc-windows-msvc" "./target/debug/fuzz.exe"
on arch="aarch64-apple-darwin" "fuzz"
on arch="x86_64-apple-darwin" "fuzz"
on arch="x86_64-unknown-linux-gnu" "fuzz"
on arch="x86_64-pc-windows-msvc" "fuzz.exe"
}

dependencies {
plugin "mitre/github" version="0.1.0" manifest="./plugins/github/plugin.kdl"
plugin "mitre/github" version="0.1.0" manifest="./plugins/github/plugin.kdl"
}
14 changes: 14 additions & 0 deletions plugins/git/dist.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

[dist]

# Make sure that 'dist' will handle releases for this. Otherwise, since
# the crate is set to 'publish = false', 'dist' would ignore it by default.
dist = true

# We explicitly *don't* want 'dist' to produce installers; just to prebuild
# the binaries for us and bundle everything together. Hipcheck itself will
# handle people getting the prebuilt binaries based on the download manifest.
installers = []

# Make sure to include the plugin manifest.
include = ["plugin.kdl"]
9 changes: 5 additions & 4 deletions plugins/git/plugin.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ publisher "mitre"
name "git"
version "0.1.0"
license "Apache-2.0"

entrypoint {
on arch="aarch64-apple-darwin" "./target/debug/git"
on arch="x86_64-apple-darwin" "./target/debug/git"
on arch="x86_64-unknown-linux-gnu" "./target/debug/git"
on arch="x86_64-pc-windows-msvc" "./target/debug/git.exe"
on arch="aarch64-apple-darwin" "git"
on arch="x86_64-apple-darwin" "git"
on arch="x86_64-unknown-linux-gnu" "git"
on arch="x86_64-pc-windows-msvc" "git.exe"
}
14 changes: 14 additions & 0 deletions plugins/github/dist.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

[dist]

# Make sure that 'dist' will handle releases for this. Otherwise, since
# the crate is set to 'publish = false', 'dist' would ignore it by default.
dist = true

# We explicitly *don't* want 'dist' to produce installers; just to prebuild
# the binaries for us and bundle everything together. Hipcheck itself will
# handle people getting the prebuilt binaries based on the download manifest.
installers = []

# Make sure to include the plugin manifest.
include = ["plugin.kdl"]
Loading

0 comments on commit 8be06d2

Please sign in to comment.