sbt: Add test
This commit is contained in:
parent
8d279bbf67
commit
23be792bad
|
@ -310,6 +310,7 @@ in
|
|||
rxe = handleTest ./rxe.nix {};
|
||||
samba = handleTest ./samba.nix {};
|
||||
sanoid = handleTest ./sanoid.nix {};
|
||||
sbt = handleTest ./sbt.nix {};
|
||||
sddm = handleTest ./sddm.nix {};
|
||||
service-runner = handleTest ./service-runner.nix {};
|
||||
shadowsocks = handleTest ./shadowsocks {};
|
||||
|
|
18
nixos/tests/sbt.nix
Normal file
18
nixos/tests/sbt.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
import ./make-test-python.nix ({ pkgs, ...} : {
|
||||
name = "sbt";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ nequissimus ];
|
||||
};
|
||||
|
||||
machine = { pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.sbt ];
|
||||
};
|
||||
|
||||
testScript =
|
||||
''
|
||||
machine.succeed(
|
||||
"(sbt --offline --version 2>&1 || true) | grep 'getting org.scala-sbt sbt ${pkgs.sbt.version} (this may take some time)'"
|
||||
)
|
||||
'';
|
||||
})
|
|
@ -1,5 +1,5 @@
|
|||
{ stdenv, fetchurl, jre, autoPatchelfHook, zlib, writeScript
|
||||
, common-updater-scripts, git, nixfmt, nix, coreutils, gnused }:
|
||||
, common-updater-scripts, git, nixfmt, nix, coreutils, gnused, nixosTests }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "sbt";
|
||||
|
@ -36,30 +36,34 @@ stdenv.mkDerivation rec {
|
|||
platforms = platforms.unix;
|
||||
};
|
||||
|
||||
passthru.updateScript = writeScript "update.sh" ''
|
||||
#!${stdenv.shell}
|
||||
set -o errexit
|
||||
PATH=${
|
||||
stdenv.lib.makeBinPath [
|
||||
common-updater-scripts
|
||||
git
|
||||
nixfmt
|
||||
nix
|
||||
coreutils
|
||||
gnused
|
||||
]
|
||||
}
|
||||
passthru = {
|
||||
tests = { inherit (nixosTests) sbt; };
|
||||
|
||||
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion sbt" | tr -d '"')"
|
||||
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:sbt/sbt.git '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')"
|
||||
updateScript = writeScript "update.sh" ''
|
||||
#!${stdenv.shell}
|
||||
set -o errexit
|
||||
PATH=${
|
||||
stdenv.lib.makeBinPath [
|
||||
common-updater-scripts
|
||||
git
|
||||
nixfmt
|
||||
nix
|
||||
coreutils
|
||||
gnused
|
||||
]
|
||||
}
|
||||
|
||||
if [ ! "$oldVersion" = "$latestTag" ]; then
|
||||
update-source-version sbt "$latestTag" --version-key=version --print-changes
|
||||
nixpkgs="$(git rev-parse --show-toplevel)"
|
||||
default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix"
|
||||
nixfmt "$default_nix"
|
||||
else
|
||||
echo "sbt is already up-to-date"
|
||||
fi
|
||||
'';
|
||||
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion sbt" | tr -d '"')"
|
||||
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:sbt/sbt.git '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')"
|
||||
|
||||
if [ ! "$oldVersion" = "$latestTag" ]; then
|
||||
update-source-version sbt "$latestTag" --version-key=version --print-changes
|
||||
nixpkgs="$(git rev-parse --show-toplevel)"
|
||||
default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix"
|
||||
nixfmt "$default_nix"
|
||||
else
|
||||
echo "sbt is already up-to-date"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue