mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 09:04:12 +02:00
automatic phpunit version
This commit is contained in:
parent
86a68339b4
commit
57dd81faf9
2 changed files with 54 additions and 19 deletions
|
|
@ -29,9 +29,11 @@
|
|||
su,
|
||||
which,
|
||||
clamav,
|
||||
jq,
|
||||
debug ? false,
|
||||
writeShellApplication,
|
||||
}: let
|
||||
inherit (builtins) toString;
|
||||
inherit (lib) readFile getExe concatStringsSep splitString take;
|
||||
|
||||
phpVersion = concatStringsSep "." (take 2 (splitString "." php.version));
|
||||
|
|
@ -65,7 +67,46 @@
|
|||
'';
|
||||
configs = callPackage ./configs.nix {};
|
||||
scripts = callPackage ./scripts.nix {};
|
||||
phpunit = callPackage ./phpunit.nix {php = phpEnv;};
|
||||
phpunitUnwrapped = majorVersion:
|
||||
callPackage ./phpunit.nix {
|
||||
inherit majorVersion;
|
||||
php = phpEnv;
|
||||
};
|
||||
|
||||
phpunitWrapped = majorVersion:
|
||||
writeShellApplication {
|
||||
name = "phpunit${toString majorVersion}";
|
||||
text = ''
|
||||
${phpunitUnwrapped (toString majorVersion)}/bin/phpunit "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
phpunit = writeShellApplication {
|
||||
name = "phpunit";
|
||||
runtimeInputs = [jq];
|
||||
text = ''
|
||||
MAJOR=$(jq -r 'first(.require."phpunit/phpunit" | scan("[[:digit:]]+"))' vendor-bin/phpunit/composer.json)
|
||||
case "$MAJOR" in
|
||||
9)
|
||||
PKG=${phpunitUnwrapped "9"}
|
||||
;;
|
||||
10)
|
||||
PKG=${phpunitUnwrapped "10"}
|
||||
;;
|
||||
11)
|
||||
PKG=${phpunitUnwrapped "11"}
|
||||
;;
|
||||
12)
|
||||
PKG=${phpunitUnwrapped "12"}
|
||||
;;
|
||||
*)
|
||||
PKG=${phpunitUnwrapped "10"}
|
||||
;;
|
||||
esac
|
||||
"$PKG"/bin/phpunit "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
redis-certificates = runCommand "scripts" {} ''
|
||||
mkdir -p $out
|
||||
cp -r ${../../redis-certificates} $out/redis-certificates
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
php,
|
||||
majorVersion,
|
||||
phpunit,
|
||||
testers,
|
||||
versionCheckHook,
|
||||
|
|
@ -10,22 +11,22 @@
|
|||
inherit (lib) concatStringsSep splitString take;
|
||||
phpVersion = concatStringsSep "." (take 2 (splitString "." php.version));
|
||||
versions = {
|
||||
"8.1" = {
|
||||
"9" = {
|
||||
version = "9.6.25";
|
||||
hash = "sha256-DKbInG8zsIa2DFNY5eqW8CKWUhGM0yc3/wppUiizYbg=";
|
||||
vendorHash = "sha256-pvP2ULwnDbPb9bIaNKkQ7cvyMpgZiFfoJfUFRGzojBQ=";
|
||||
};
|
||||
"10" = {
|
||||
version = "10.5.46";
|
||||
hash = "sha256-DtQ6CR4RAGKpZcJA9WZ5ud5ztIBTr8MeVTIhFwbGHYc=";
|
||||
vendorHash = "sha256-fNv9pWFwYTyw3KEGtmbKNzXFsiDE6oZjRCWhypa/k0A=";
|
||||
};
|
||||
"8.2" = {
|
||||
"11" = {
|
||||
version = "11.5.22";
|
||||
hash = "sha256-oXoh/2G0bqPPyvVoQUUdUz8XGyNtRJE3taUFGu2UIsc=";
|
||||
vendorHash = "sha256-9gLTJe2ft90qGr/d8/Zc/ua7EWyNZ16wPEZRe9sKZf0=";
|
||||
};
|
||||
"8.3" = {
|
||||
version = "12.2.1";
|
||||
hash = "sha256-D5WI1kv05L8X3Gfw/MCxGdIcqWyWJg68GL9I24z/zIY=";
|
||||
vendorHash = "sha256-H+XMRMvbUz/WCUdPRmL8nSCqa5YE3Qb1+goEQjjDK70=";
|
||||
};
|
||||
"8.4" = {
|
||||
"12" = {
|
||||
version = "12.2.1";
|
||||
hash = "sha256-D5WI1kv05L8X3Gfw/MCxGdIcqWyWJg68GL9I24z/zIY=";
|
||||
vendorHash = "sha256-H+XMRMvbUz/WCUdPRmL8nSCqa5YE3Qb1+goEQjjDK70=";
|
||||
|
|
@ -34,23 +35,16 @@
|
|||
in
|
||||
php.buildComposerProject2 (finalAttrs: {
|
||||
pname = "phpunit";
|
||||
inherit (versions.${phpVersion}) version vendorHash;
|
||||
inherit (versions.${majorVersion}) version vendorHash;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "sebastianbergmann";
|
||||
repo = "phpunit";
|
||||
tag = finalAttrs.version;
|
||||
inherit (versions.${phpVersion}) hash;
|
||||
inherit (versions.${majorVersion}) hash;
|
||||
};
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script {};
|
||||
tests.version = testers.testVersion {package = phpunit;};
|
||||
};
|
||||
|
||||
doInstallCheck = true;
|
||||
nativeInstallCheckInputs = [versionCheckHook];
|
||||
versionCheckProgramArg = "--version";
|
||||
doInstallCheck = false;
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/sebastianbergmann/phpunit/blob/${finalAttrs.version}/ChangeLog-${lib.versions.majorMinor finalAttrs.version}.md";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue