Skip to content

Commit

Permalink
ci(toml): Use taplo for toml formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Dec 13, 2024
1 parent a951311 commit 641e48c
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ path = "junit.xml"
# - lower retry count as a compromise between speed and resilience
# - no fail-fast to at least keep coverage percentages accurate.
[profile.coverage]
retries = 1
fail-fast = false
retries = 1
12 changes: 4 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,8 @@ jobs:
- name: cargo clippy
run: cargo clippy --tests --workspace -- -D warnings

#- name: cargo sort
# run: cargo sort --workspace --check
# # Don't run cargo-sort on windows, as the formatting behavior seems to be slightly different:
# # https://github.com/DevinR528/cargo-sort/issues/56
# if: matrix.target != 'x86_64-pc-windows-msvc'
- name: Install taplo-cli
run: cargo install taplo-cli || exit 0

#- name: Install cargo-sort
# run: cargo install cargo-sort || exit 0
# if: matrix.target != 'x86_64-pc-windows-msvc'
- name: cargo sort
run: ~/.cargo/bin/taplo format --check
4 changes: 4 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[formatting]
indent_string = " "
reorder_arrays = true
reorder_keys = true
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ resolver = "2"

[workspace.package]
authors = ["Arne Beer <[email protected]>"]
edition = "2021"
homepage = "https://github.com/nukesor/pueue"
repository = "https://github.com/nukesor/pueue"
license = "MIT OR Apache-2.0"
edition = "2021"
repository = "https://github.com/nukesor/pueue"
rust-version = "1.70"

[workspace.dependencies]
# Chrono version is hard pinned to a specific version.
# See https://github.com/Nukesor/pueue/issues/534
anyhow = "1"
better-panic = "0.3"
chrono = { version = "0.4", features = ["serde"] }
command-group = "5"
handlebars = "5.1"
log = "0.4"
pretty_assertions = "1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
snap = "1.1"
strum = { version = "0.26", features = ["derive"] }
tokio = { version = "1.36", features = ["rt-multi-thread", "time", "io-std"] }
handlebars = "5.1"
anyhow = "1"
better-panic = "0.3"
pretty_assertions = "1"
tokio = { version = "1.36", features = ["io-std", "rt-multi-thread", "time"] }

[profile.release]
codegen-units = 1
Expand Down
24 changes: 8 additions & 16 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
[target.x86_64-unknown-linux-musl]
image = "ghcr.io/cross-rs/x86_64-unknown-linux-musl:main"
pre-build = [
"""
pre-build = ["""
dpkg --add-architecture amd64 && \
apt-get update && \
apt-get install --assume-yes lld clang
"""
]
"""]

[target.aarch64-unknown-linux-musl]
image = "ghcr.io/cross-rs/aarch64-unknown-linux-musl:main"
pre-build = [
"""
pre-build = ["""
apt-get update && \
apt-get install --assume-yes lld clang
"""
]
"""]

[target.armv7-unknown-linux-musleabihf]
image = "ghcr.io/cross-rs/armv7-unknown-linux-musleabihf:main"
pre-build = [
"""
pre-build = ["""
apt-get update && \
apt-get install --assume-yes lld clang
"""
]
"""]

[target.arm-unknown-linux-musleabihf]
image = "ghcr.io/cross-rs/arm-unknown-linux-musleabihf:main"
pre-build = [
"""
pre-build = ["""
apt-get update && \
apt-get install --assume-yes lld clang
"""
]
"""]
38 changes: 23 additions & 15 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
# Bump all deps, including incompatible version upgrades
bump:
just ensure_installed upgrade
just ensure-command cargo-upgrade
cargo update
cargo upgrade --incompatible
cargo test --workspace

# Run the test suite with nexttest
# Run the test suite with nextest
nextest:
just ensure_installed nextest
just ensure-command cargo-nextest
cargo nextest run --workspace

# If you change anything in here, make sure to also adjust the lint CI job!
lint:
just ensure_installed sort
just ensure-command cargo-nextest
cargo fmt --all -- --check
cargo sort --workspace --check
taplo format --check
cargo clippy --tests --workspace -- -D warnings

format:
just ensure_installed sort
just ensure-command taplo
cargo fmt
cargo sort --workspace

ensure_installed *args:
#!/bin/bash
cargo --list | grep -q {{ args }}
if [[ $? -ne 0 ]]; then
echo "error: cargo-{{ args }} is not installed"
exit 1
fi
taplo format


# Ensures that one or more required commands are installed
ensure-command +command:
#!/usr/bin/env bash
set -euo pipefail
read -r -a commands <<< "{{ command }}"

for cmd in "${commands[@]}"; do
if ! command -v "$cmd" > /dev/null 2>&1 ; then
printf "Couldn't find required executable '%s'\n" "$cmd" >&2
exit 1
fi
done

24 changes: 12 additions & 12 deletions pueue/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[package]
name = "pueue"
version = "4.0.0-rc.1"
description = "A cli tool for managing long running shell commands."
keywords = ["shell", "command", "parallel", "task", "queue"]
readme = "../README.md"
authors.workspace = true
description = "A cli tool for managing long running shell commands."
edition.workspace = true
homepage.workspace = true
repository.workspace = true
keywords = ["command", "parallel", "queue", "shell", "task"]
license.workspace = true
edition.workspace = true
name = "pueue"
readme = "../README.md"
repository.workspace = true
rust-version.workspace = true
version = "4.0.0-rc.1"

[badges]
maintenance = { status = "actively-developed" }

[dependencies]
anyhow = "1.0"
chrono.workspace = true
clap = { version = "4.5.1", features = ["derive", "cargo", "help"] }
clap = { version = "4.5.1", features = ["cargo", "derive", "help"] }
clap_complete = "4.5.1"
clap_complete_nushell = "4.5.1"
comfy-table = "7"
Expand Down Expand Up @@ -62,14 +62,14 @@ crossterm = { version = "0.28", default-features = false }
crossterm = { version = "0.28", default-features = false, features = [
"windows",
] }
windows-service = "0.7.0"
windows = { version = "0.58.0", features = [
"Win32_System_RemoteDesktop",
"Win32_Security",
"Win32_System_Threading",
"Win32_System_SystemServices",
"Win32_System_Environment",
"Win32_System_RemoteDesktop",
"Win32_System_SystemServices",
"Win32_System_Threading",
] }
windows-service = "0.7.0"

# Test specific dev-dependencies
[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))'.dependencies]
Expand Down
22 changes: 11 additions & 11 deletions pueue_lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "pueue-lib"
version = "0.27.0"
authors.workspace = true
description = "The shared library to work with the Pueue client and daemon."
edition.workspace = true
homepage.workspace = true
keywords = ["pueue"]
license.workspace = true
name = "pueue-lib"
readme = "README.md"
authors = { workspace = true }
homepage.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
version = "0.27.0"

[badges]
maintenance = { status = "actively-developed" }
Expand All @@ -27,8 +27,8 @@ rand = "0.8"
rcgen = "0.13"
rev_buf_reader = "0.3"
rustls = { version = "0.23", features = [
"ring",
"logging",
"ring",
"std",
"tls12",
], default-features = false }
Expand All @@ -41,7 +41,7 @@ shellexpand = "3.1"
snap.workspace = true
strum.workspace = true
thiserror = "2"
tokio = { workspace = true, features = ["macros", "net", "io-util"] }
tokio = { workspace = true, features = ["io-util", "macros", "net"] }
tokio-rustls = { version = "0.26", default-features = false }

[dev-dependencies]
Expand All @@ -56,11 +56,11 @@ tokio.workspace = true
# Windows
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = [
"tlhelp32",
"errhandlingapi",
"processthreadsapi",
"minwindef",
"impl-default",
"minwindef",
"processthreadsapi",
"tlhelp32",
] }

# Unix
Expand Down

0 comments on commit 641e48c

Please sign in to comment.