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
5 changes: 3 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
[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"
12 changes: 12 additions & 0 deletions .github/custom_build_setup/build-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- name: Install Just
uses: extractions/setup-just@v3
- name: Install HDF5
shell: bash
run: just init::install-hdf5-headers

- name: Run MSI installer (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd just\hdf
msiexec /i HDF5-1.14.0-win64.msi /quiet /qn /norestart
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ env:
RUSTDOCFLAGS: -D warnings
RUST_BACKTRACE: 1
RUST_LOG: debug
JUST_VERBOSE: 1
JUST_COLOR: always

jobs:
check:
Expand Down
42 changes: 32 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/
# This file was autogenerated by dist: https://github.com/astral-sh/cargo-dist
#
# Copyright 2022-2024, axodotdev
# Copyright 2025 Astral Software Inc.
# SPDX-License-Identifier: MIT or Apache-2.0
#
# CI that:
Expand Down Expand Up @@ -47,7 +48,7 @@ on:
jobs:
# Run 'dist plan' (or host) to determine what tasks we need to do
plan:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
outputs:
val: ${{ steps.plan.outputs.manifest }}
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
Expand All @@ -58,12 +59,13 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: recursive
- name: Install dist
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/cargo-dist/releases/download/v0.28.5/cargo-dist-installer.sh | sh"
- name: Cache dist
uses: actions/upload-artifact@v4
with:
Expand All @@ -76,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 > plan-dist-manifest.json
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json --allow-dirty > 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 @@ -117,6 +119,7 @@ jobs:
git config --global core.longpaths true
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: recursive
- name: Install Rust non-interactively if not already installed
if: ${{ matrix.container }}
Expand All @@ -125,12 +128,28 @@ 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)"
if: "runner.os == 'Windows'"
run: |
cd just\hdf
msiexec /i HDF5-1.14.0-win64.msi /quiet /qn /norestart
shell: "pwsh"
- 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 @@ -144,7 +163,7 @@ jobs:
- name: Build artifacts
run: |
# Actually do builds and make zips and whatnot
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --allow-dirty --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
echo "dist ran successfully"
- id: cargo-dist
name: Post-build
Expand Down Expand Up @@ -172,13 +191,14 @@ jobs:
needs:
- plan
- build-local-artifacts
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: recursive
- name: Install cached dist
uses: actions/download-artifact@v4
Expand All @@ -196,7 +216,7 @@ jobs:
- id: cargo-dist
shell: bash
run: |
dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
dist build ${{ needs.plan.outputs.tag-flag }} --allow-dirty --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 All @@ -222,12 +242,13 @@ jobs:
if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
outputs:
val: ${{ steps.host.outputs.manifest }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: recursive
- name: Install cached dist
uses: actions/download-artifact@v4
Expand All @@ -245,7 +266,7 @@ jobs:
- id: host
shell: bash
run: |
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --allow-dirty --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 Expand Up @@ -286,10 +307,11 @@ jobs:
# still allowing individual publish jobs to skip themselves (for prereleases).
# "host" however must run to completion, no skipping allowed!
if: ${{ always() && needs.host.result == 'success' }}
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: recursive
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [1.12.0]

### Changed

- Move from the discontinued original `cargo-dist` to the [fork maintained by astral](https://github.com/astral-sh/cargo-dist)
- Use the forked `cargo-dist` with the MSVC CRT linker configuration fix in the release workflow (astral [PR here](https://github.com/astral-sh/cargo-dist/pull/36))
- Avoid statically linking MSVC CRT to allow statically linking HDF5 on windows.
- Disallow bypassing updates in CI, to force tests to run update scenarios

### Dependencies

- `anyhow`: 1.0.97 β†’ 1.0.98 ([#228](https://github.com/luftkode/plotinator3000/pull/228))
Expand Down
16 changes: 8 additions & 8 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion 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.11.1"
version = "1.12.0"
edition = "2024"
rust-version = "1.85.0"
license = "MIT OR Apache-2.0"
Expand Down
10 changes: 3 additions & 7 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'just/mod.just'
# CI only recipes, `just -l ci` to list them
mod ci 'just/ci.just'
# init only recipes, `just -l init` to list them
mod init 'just/init.just'

set windows-shell := ["powershell.exe", "-c"]

PROJECT_NAME := "plotinator3000"

alias i := init
alias t := test
alias l := lint
alias fmt := format
Expand All @@ -24,12 +25,7 @@ export RUST_LOG := env_var_or_default("RUST_LOG", "info")
export PLOTINATOR_BYPASS_UPDATES := env_var_or_default("PLOTINATOR_BYPASS_UPDATES", "true")

@_default:
just --list --no-aliases

[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-header{{NORMAL}} to get HDF5 headers for developing HDF5 features on linux"
just --list

[doc("Checks both native and wasm"), group("Check"), no-exit-message]
check-all: check check-wasm
Expand Down
5 changes: 4 additions & 1 deletion dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = ["cargo:."]
# Config for 'dist'
[dist]
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.28.0"
cargo-dist-version = "0.28.5"
# CI backends to support
ci = "github"
# The installers to generate for each app
Expand All @@ -17,3 +17,6 @@ install-path = "CARGO_HOME"
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"
44 changes: 42 additions & 2 deletions just/init.just
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
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:
Expand All @@ -14,5 +22,37 @@ install-extra-devtools:
cargo install bacon --locked

[group("Init")]
apt-install-hdf5-header:
sudo apt install libhdf5-dev
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: 0 additions & 1 deletion just/mod.just
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import 'default_cmd.just'
import 'init.just'
import 'mqtt.just'
8 changes: 8 additions & 0 deletions src/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,15 @@ pub fn update_if_applicable() -> axoupdater::AxoupdateResult<bool> {

/// Check for the environment variable to bypass updates
fn bypass_updates() -> bool {
// This is generally set in the build environment (see config.toml)
if let Ok(value) = env::var(BYPASS_UPDATES_ENV_VAR) {
// If we're in the build environment and we detect CI, we don't allow bypassing updates
if let Ok(value) = env::var("GITHUB_ACTIONS") {
if value == "true" {
log::info!("GitHub actions detected, disabling bypass updates");
return false;
}
}
if value == "1" || value.eq_ignore_ascii_case("true") {
log::info!("Update bypassed due to environment variable.");
return true;
Expand Down
Loading