Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
[env]
# We generally want to bypass updates in the build, they should only really be run in CI as they touch many parts of the host
PLOTINATOR_BYPASS_UPDATES = "true"

# Avoid linking with vcruntime140.dll by statically linking everything,
# and then explicitly linking with ucrtbase.dll dynamically.
# We do this, because vcruntime140.dll is an optional Windows component.
# NOTE: Endorsed by Microsoft devs: https://github.com/microsoft/edit/blob/d74c330f2b74134a7fd5f97f78933472049129d3/.cargo/release.toml
[target.'cfg(target_os = "windows")']
rustflags = [
"-Ctarget-feature=+crt-static",
"-Clink-args=/DEFAULTLIB:ucrt.lib",
"-Clink-args=/NODEFAULTLIB:vcruntime.lib",
"-Clink-args=/NODEFAULTLIB:msvcrt.lib",
"-Clink-args=/NODEFAULTLIB:libucrt.lib",
]
17 changes: 6 additions & 11 deletions .github/custom_build_setup/build-setup.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
- name: Install Just
uses: extractions/setup-just@v3
- name: Install HDF5
shell: bash
run: just init::install-hdf5-headers

- name: Run MSI installer (windows)
# A workaround for
# https://github.com/axodotdev/cargo-dist/issues/1571
# See the .cargo/config.toml for more information about these flags.
- name: Update RUSTFLAGS with custom windows linker flags
if: runner.os == 'Windows'
shell: pwsh
run: |
cd just\hdf
msiexec /i HDF5-1.14.0-win64.msi /quiet /qn /norestart
shell: bash
run: echo RUSTFLAGS="$RUSTFLAGS -Clink-args=/DEFAULTLIB:ucrt.lib -Clink-args=/NODEFAULTLIB:vcruntime.lib -Clink-args=/NODEFAULTLIB:msvcrt.lib -Clink-args=/NODEFAULTLIB:libucrt.lib" >> "$GITHUB_ENV"
26 changes: 7 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
# but also really annoying to build CI around when it needs secrets to work right.)
- id: plan
run: |
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json --allow-dirty > plan-dist-manifest.json
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
echo "dist ran successfully"
cat plan-dist-manifest.json
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -128,28 +128,16 @@ jobs:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
fi
- name: "Install Just"
uses: "extractions/setup-just@v3"
- name: "Install HDF5"
run: "just init::install-hdf5-headers"
shell: "bash"
- name: "Run MSI installer (windows)"
- name: "Update RUSTFLAGS with custom windows linker flags"
if: "runner.os == 'Windows'"
run: |
cd just\hdf
msiexec /i HDF5-1.14.0-win64.msi /quiet /qn /norestart
shell: "pwsh"
run: "echo RUSTFLAGS=\"$RUSTFLAGS -Clink-args=/DEFAULTLIB:ucrt.lib -Clink-args=/NODEFAULTLIB:vcruntime.lib -Clink-args=/NODEFAULTLIB:msvcrt.lib -Clink-args=/NODEFAULTLIB:libucrt.lib\" >> \"$GITHUB_ENV\""
shell: "bash"
- uses: swatinem/rust-cache@v2
with:
key: ${{ join(matrix.targets, '-') }}
cache-provider: ${{ matrix.cache_provider }}
- name: Install dist
run: ${{ matrix.install_dist.run }}

# Need to overwrite it to fix: https://github.com/astral-sh/cargo-dist/pull/36
- name: Use patched cargo-dist version (windows)
if: runner.os == 'Windows'
run: cargo install cargo-dist --git https://github.com/CramBL/cargo-dist --branch fix-ignored-msvc-crt-static-flag --rev a4cabb10395c7b275ea40d1636cd2d0e58be8af6 --force
# Get the dist-manifest
- name: Fetch local artifacts
uses: actions/download-artifact@v4
Expand All @@ -163,7 +151,7 @@ jobs:
- name: Build artifacts
run: |
# Actually do builds and make zips and whatnot
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --allow-dirty --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
echo "dist ran successfully"
- id: cargo-dist
name: Post-build
Expand Down Expand Up @@ -216,7 +204,7 @@ jobs:
- id: cargo-dist
shell: bash
run: |
dist build ${{ needs.plan.outputs.tag-flag }} --allow-dirty --output-format=json "--artifacts=global" > dist-manifest.json
dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
echo "dist ran successfully"

# Parse out what we just built and upload it to scratch storage
Expand Down Expand Up @@ -266,7 +254,7 @@ jobs:
- id: host
shell: bash
run: |
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --allow-dirty --output-format=json > dist-manifest.json
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
echo "artifacts uploaded and released successfully"
cat dist-manifest.json
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ target
dist
**/tests/snapshots/**/*.diff.png
**/tests/snapshots/**/*.new.png
**/tests/snapshots/**/*.old.png
.firebase
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [1.13.0]

### Added

- Discover broker `$SYS`-topics
- Show reachable broker's version if available
- Better UX for the MQTT connection window
- Add additional distribution targets: `ARM64 Linux` & `x64 MUSL Linux`.

### Changed

Expand Down
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ members = ["crates/*"]

[workspace.package]
authors = ["SkyTEM Surveys", "Marc Beck KΓΆnig"]
version = "1.12.0"
version = "1.13.0"
edition = "2024"
rust-version = "1.85.0"
license = "MIT OR Apache-2.0"
Expand All @@ -33,7 +33,7 @@ test_util.path = "crates/test_util"
skytem_logs.path = "crates/skytem_logs"
log_if.path = "crates/log_if"
plot_util.path = "crates/plot_util"
skytem_hdf.path = "crates/skytem_hdf"
skytem_hdf5.path = "crates/skytem_hdf5"
plotinator_mqtt.path = "crates/plotinator_mqtt"
plotinator_macros.path = "crates/plotinator_macros"
egui = { version = "0.31", features = ["rayon", "callstack"] }
Expand Down Expand Up @@ -71,7 +71,7 @@ reqwest = "0.12.15"
skytem_logs.workspace = true
log_if.workspace = true
plot_util.workspace = true
skytem_hdf = { workspace = true, optional = true }
skytem_hdf5.workspace = true
test_util.workspace = true
plotinator_macros.workspace = true
egui_plot.workspace = true
Expand Down Expand Up @@ -108,12 +108,14 @@ egui_kittest = { version = "0.31.1", features = ["eframe", "snapshot", "wgpu", "
env_logger = "0.11"
zip = "3.0.0"
axoupdater = { version = "0.9.0", features = ["blocking"], optional = true}
mimalloc = "0.1.46"
plotinator_mqtt = { workspace = true, optional = true}
profiling = { workspace = true, optional = true}
puffin = { workspace = true, optional = true}
puffin_http = { workspace = true, optional = true}

# native (except aarch64-linux):
[target.'cfg(all(not(target_arch = "wasm32"), not(all(target_arch = "aarch64", target_os = "linux"))))'.dependencies]
mimalloc = "0.1.46"

# web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand All @@ -125,8 +127,8 @@ web-sys = "0.3.70"
elevated-command.workspace = true

[features]
default = ["selfupdater", "mqtt"]
hdf = ["dep:skytem_hdf"]
default = ["selfupdater", "mqtt", "hdf5"]
hdf5 = []
selfupdater = ["dep:axoupdater"]
mqtt = ["dep:plotinator_mqtt"]
profiling = ["dep:profiling", "dep:puffin", "dep:puffin_http"]
Expand Down
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ serve *ARGS:
run *ARGS:
cargo {{run}} {{ARGS}}

# Run tests
# Run all tests
[group("Check"), no-exit-message]
test *ARGS="--workspace":
cargo {{test}} {{ARGS}}
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,22 @@ All the boilerplate and workflows etc. is pulled from [this eframe template](htt

[cargo-dist](https://github.com/axodotdev/cargo-dist) handles the complexities of setting up build/releases for various platforms.

Read their documentation!!
> [!IMPORTANT]
> [uv](https://github.com/astral-sh/uv) also uses `cargo-dist` and since the original project ran out of funding, the [uv fork](https://github.com/astral-sh/cargo-dist) is used instead

Generating the first instance of CI for the release workflow is done via

```shell
cargo dist init
dist init
```
... And then following the instructions/prompts.

A (very complicated) [release.yml](.github/workflows/release.yml) is generated and metadata is added to [Cargo.toml](Cargo.toml), if distributing for windows, a [main.wxs](wix/main.wxs) is also generated. To update these with changes to the project, simply rerun `cargo dist init`, don't edit the workflow manually, there's a [section on CI customization](https://opensource.axo.dev/cargo-dist/book/ci/customizing.html) in the `cargo dist` docs.
A (very complicated) [release.yml](.github/workflows/release.yml) is generated and metadata is added to [dist-workspace.toml](dist-workspace.toml), if distributing for windows, a [main.wxs](wix/main.wxs) is also generated. To update these with changes to the project, simply rerun `dist init`, don't edit the workflow manually, there's section on CI customizations in their docs, but as of this writing the site is down, Astral (uv authors) will probably host the docs again at some point.

When developing/trouble shooting the release pipeline adding `pr-run-mode = "upload"` like this

```toml
[workspace.metadata.dist]
[dist]
pr-run-mode = "upload"
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "skytem_hdf"
name = "skytem_hdf5"
authors.workspace = true
version.workspace = true
edition.workspace = true
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ pub(crate) mod util;
#[cfg(not(target_arch = "wasm32"))]
pub mod bifrost;

// File extensions we recognize as hdf files.
const POSSIBLE_HDF_EXTENSIONS_CASE_INSENSITIVE: [&str; 3] = ["h5", "hdf", "hdf5"];
// File extensions we recognize as hdf5 files.
const POSSIBLE_HDF5_EXTENSIONS_CASE_INSENSITIVE: [&str; 3] = ["h5", "hdf5", "hdf"];

pub fn path_has_hdf_extension(path: &std::path::Path) -> bool {
pub fn path_has_hdf5_extension(path: &std::path::Path) -> bool {
let Some(extension) = path.extension() else {
return false;
};

for possible_extension in POSSIBLE_HDF_EXTENSIONS_CASE_INSENSITIVE {
for possible_extension in POSSIBLE_HDF5_EXTENSIONS_CASE_INSENSITIVE {
if extension.eq_ignore_ascii_case(possible_extension) {
return true;
}
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ ci = "github"
# The installers to generate for each app
installers = ["shell", "powershell", "msi"]
# 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"]
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
# Path that installers should place binaries in
install-path = "CARGO_HOME"
# Whether to install an updater program
install-updater = false
# Which actions to run on pull requests
pr-run-mode = "upload"
# Whether +crt-static should be used on msvc
msvc-crt-static = false
github-build-setup = "../custom_build_setup/build-setup.yml"
40 changes: 2 additions & 38 deletions just/init.just
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ set windows-shell := ["powershell.exe", "-c"]
[group("Init")]
init: install-devtools
@echo "Run {{BOLD + YELLOW}}install-extra-devtools{{NORMAL}} for some adittional productivity tools that fit into the existent workflow"
@echo "Run {{BOLD + YELLOW}}apt-install-hdf5-headers{{NORMAL}} to get HDF5 headers for developing HDF5 features on linux"


# Trunk is used to serve the app with a webserver, cargo-dist is used to generate and update workflows for distributing installers for various platforms
[group("Init"), doc("Install the required tools for performing all dev tasks for the project")]
install-devtools:
cargo install trunk --locked
cargo install cargo-dist --locked
# Use the uv fork that is still maintained
cargo install cargo-dist --locked --git https://github.com/astral-sh/cargo-dist.git --tag v0.28.5
cargo install typos-cli --locked
cargo install cargo-audit --locked

Expand All @@ -20,39 +20,3 @@ install-extra-devtools:
cargo install cargo-nextest --locked
cargo install cargo-limit --locked
cargo install bacon --locked

[group("Init")]
apt-install-hdf5-headers:
sudo apt install libhdf5-dev

[windows]
msi-install-hdf5-headers:
#!/usr/bin/env bash
set -eo pipefail
VERSION="1.14.0"
DL_URL="https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-${VERSION}/bin/windows/hdf5-${VERSION}-Std-win10_64-vs16.zip"
# Download and extract HDF5
curl -L -o hdf5.zip "${DL_URL}"
unzip hdf5.zip
if [[ "${GITHUB_ACTIONS}" == "true" ]]; then
just init::set-github-hdf5-env-vars "${VERSION}"
fi


[windows]
set-github-hdf5-env-vars VERSION:
echo "HDF5_DIR=C:\\Program Files\\HDF_Group\\HDF5\\{{VERSION}}" >> $GITHUB_ENV
echo "C:\\Program Files\\HDF_Group\\HDF5\\{{VERSION}}\\bin" >> $GITHUB_PATH

[macos]
brew-install-hdf5-headers:
brew install hdf5

[linux]
install-hdf5-headers: apt-install-hdf5-headers

[macos]
install-hdf5-headers: brew-install-hdf5-headers

[windows]
install-hdf5-headers: msi-install-hdf5-headers
1 change: 1 addition & 0 deletions just/mod.just
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import 'default_cmd.just'
import 'mqtt.just'
import 'snapshots.just'
Loading