dprint: enable doCheck with some skips

For a preparation task, replace fetchCrate with fetchFromGitHub

- https://github.com/dprint/dprint/blob/0.47.6/Cargo.lock
- https://github.com/dprint/dprint/tree/0.47.6/crates/test-plugin

And skips some tests which cannot be succeeded even if setting DPRINT_CACHE_DIR
This commit is contained in:
Kenichi Kamiya
2024-12-08 09:43:05 +09:00
parent bf56fff260
commit c329f0625c
+18 -9
View File
@@ -1,7 +1,7 @@
{
lib,
stdenv,
fetchCrate,
fetchFromGitHub,
rustPlatform,
installShellFiles,
testers,
@@ -13,21 +13,30 @@ rustPlatform.buildRustPackage rec {
pname = "dprint";
version = "0.47.6";
src = fetchCrate {
inherit pname version;
hash = "sha256-7tGzSFp7Dnu27L65mqFd7hzeFFDfe1xJ6cMul3hGyJs=";
# Prefer repository rather than crate here
# - They have Cargo.lock in the repository
# - They have WASM files in the repository which will be used in checkPhase
src = fetchFromGitHub {
owner = "dprint";
repo = "dprint";
rev = "refs/tags/${version}";
hash = "sha256-zyiBFZbetKx0H47MAU4JGauAmthcuEdJMl93M6MobD8=";
};
cargoHash = "sha256-y3tV3X7YMOUGBn2hCmxsUUc9QQleKEioTIw7SGoBvSQ=";
# Tests fail because they expect a test WASM plugin. Tests already run for
# every commit upstream on GitHub Actions
doCheck = false;
cargoHash = "sha256-XuzxoJgJJl4Blw1lDnCG3faEqL9U40MhZEb9LYjiaSs=";
nativeBuildInputs = lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
installShellFiles
];
checkFlags = [
# Require creating directory and network access
"--skip=plugins::cache_fs_locks::test"
"--skip=utils::lax_single_process_fs_flag::test"
# Require cargo is running
"--skip=utils::process::test"
];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
export DPRINT_CACHE_DIR="$(mktemp -d)"
installShellCompletion --cmd dprint \