mirror of
https://codeberg.org/icewind/haze.git
synced 2026-08-02 12:14:46 +02:00
add phpunit 13
This commit is contained in:
parent
3f15ab0551
commit
44da124f75
2 changed files with 106 additions and 107 deletions
|
|
@ -38,10 +38,10 @@
|
|||
nushell,
|
||||
nix2container,
|
||||
buildEnv,
|
||||
}:
|
||||
let
|
||||
}: let
|
||||
inherit (builtins) toString compareVersions;
|
||||
inherit (lib)
|
||||
inherit
|
||||
(lib)
|
||||
readFile
|
||||
getExe
|
||||
concatStringsSep
|
||||
|
|
@ -53,7 +53,7 @@ let
|
|||
version = (fromTOML (readFile ../../Cargo.toml)).package.version;
|
||||
|
||||
phpVersion = concatStringsSep "." (take 2 (splitString "." php.version));
|
||||
phpEnv = callPackage ./php.nix { inherit debug php; };
|
||||
phpEnv = callPackage ./php.nix {inherit debug php;};
|
||||
|
||||
bootstrap = writers.writeNuBin "bootstrap" (readFile ./bootstrap);
|
||||
shadowSetupScript = writeShellApplication {
|
||||
|
|
@ -61,7 +61,7 @@ let
|
|||
text = dockerTools.shadowSetup;
|
||||
};
|
||||
|
||||
baseDirs = runCommand "tmp-dir" { } ''
|
||||
baseDirs = runCommand "tmp-dir" {} ''
|
||||
mkdir -p $out/tmp
|
||||
mkdir -p $out/var/cache/nginx
|
||||
mkdir -p $out/var/log/nginx
|
||||
|
|
@ -73,10 +73,9 @@ let
|
|||
mkdir -p $out/conf
|
||||
mkdir -p $out/var/spool
|
||||
'';
|
||||
configs = callPackage ./configs.nix { };
|
||||
scripts = callPackage ./scripts.nix { };
|
||||
phpunitUnwrapped =
|
||||
majorVersion:
|
||||
configs = callPackage ./configs.nix {};
|
||||
scripts = callPackage ./scripts.nix {};
|
||||
phpunitUnwrapped = majorVersion:
|
||||
callPackage ./phpunit.nix {
|
||||
inherit majorVersion;
|
||||
php = phpEnv;
|
||||
|
|
@ -84,7 +83,7 @@ let
|
|||
|
||||
phpunit = writeShellApplication {
|
||||
name = "phpunit";
|
||||
runtimeInputs = [ jq ];
|
||||
runtimeInputs = [jq];
|
||||
text = ''
|
||||
MAJOR=$(jq -r 'first(.require."phpunit/phpunit" | scan("[[:digit:]]+"))' vendor-bin/phpunit/composer.json)
|
||||
case "$MAJOR" in
|
||||
|
|
@ -100,6 +99,9 @@ let
|
|||
12)
|
||||
PKG=${phpunitUnwrapped "12"}
|
||||
;;
|
||||
13)
|
||||
PKG=${phpunitUnwrapped "13"}
|
||||
;;
|
||||
*)
|
||||
PKG=${phpunitUnwrapped "10"}
|
||||
;;
|
||||
|
|
@ -108,11 +110,11 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
certificates = runCommand "scripts" { } ''
|
||||
certificates = runCommand "scripts" {} ''
|
||||
mkdir -p $out
|
||||
cp -r ${../../certificates} $out/certificates
|
||||
'';
|
||||
clamav-data = runCommand "scripts" { } ''
|
||||
clamav-data = runCommand "scripts" {} ''
|
||||
mkdir -p $out/etc
|
||||
mkdir -p $out/var/lib/clamav
|
||||
cp ${data/clamav/daily.cvd} $out/var/lib/clamav/daily.cvd
|
||||
|
|
@ -152,98 +154,96 @@ let
|
|||
clamav-data
|
||||
];
|
||||
|
||||
phpPackages = [
|
||||
phpEnv
|
||||
phpEnv.packages.composer
|
||||
phpunit
|
||||
]
|
||||
++ optionals ((compareVersions phpVersion "8.2") == 1) [
|
||||
(frankenphp.override {
|
||||
php = php.withExtensions (
|
||||
import ./php-ext.nix {
|
||||
inherit lib php;
|
||||
enableBlackfire = false;
|
||||
}
|
||||
);
|
||||
})
|
||||
];
|
||||
phpPackages =
|
||||
[
|
||||
phpEnv
|
||||
phpEnv.packages.composer
|
||||
phpunit
|
||||
]
|
||||
++ optionals ((compareVersions phpVersion "8.2") == 1) [
|
||||
(frankenphp.override {
|
||||
php = php.withExtensions (
|
||||
import ./php-ext.nix {
|
||||
inherit lib php;
|
||||
enableBlackfire = false;
|
||||
}
|
||||
);
|
||||
})
|
||||
];
|
||||
|
||||
# https://blog.eigenvalue.net/2023-nix2container-everything-once/
|
||||
foldImageLayers =
|
||||
let
|
||||
mergeToLayer =
|
||||
priorLayers: component:
|
||||
assert builtins.isList priorLayers;
|
||||
assert builtins.isAttrs component;
|
||||
let
|
||||
layer = nix2container.buildLayer (
|
||||
component
|
||||
// {
|
||||
layers = priorLayers;
|
||||
}
|
||||
);
|
||||
in
|
||||
priorLayers ++ [ layer ];
|
||||
in
|
||||
layers: lib.foldl mergeToLayer [ ] layers;
|
||||
foldImageLayers = let
|
||||
mergeToLayer = priorLayers: component:
|
||||
assert builtins.isList priorLayers;
|
||||
assert builtins.isAttrs component; let
|
||||
layer = nix2container.buildLayer (
|
||||
component
|
||||
// {
|
||||
layers = priorLayers;
|
||||
}
|
||||
);
|
||||
in
|
||||
priorLayers ++ [layer];
|
||||
in
|
||||
layers: lib.foldl mergeToLayer [] layers;
|
||||
in
|
||||
nix2container.buildImage {
|
||||
name = "icewind1991/haze";
|
||||
tag = phpVersion;
|
||||
layers = foldImageLayers [
|
||||
{
|
||||
copyToRoot = buildEnv {
|
||||
name = "base";
|
||||
paths = basePackages;
|
||||
pathsToLink = [
|
||||
"/bin"
|
||||
"/sbin"
|
||||
"/etc"
|
||||
"/usr"
|
||||
"/conf"
|
||||
nix2container.buildImage {
|
||||
name = "icewind1991/haze";
|
||||
tag = phpVersion;
|
||||
layers = foldImageLayers [
|
||||
{
|
||||
copyToRoot = buildEnv {
|
||||
name = "base";
|
||||
paths = basePackages;
|
||||
pathsToLink = [
|
||||
"/bin"
|
||||
"/sbin"
|
||||
"/etc"
|
||||
"/usr"
|
||||
"/conf"
|
||||
];
|
||||
};
|
||||
}
|
||||
{
|
||||
copyToRoot = buildEnv {
|
||||
name = "php";
|
||||
paths = phpPackages;
|
||||
pathsToLink = ["/bin"];
|
||||
};
|
||||
}
|
||||
{
|
||||
copyToRoot = [
|
||||
baseDirs
|
||||
bootstrap
|
||||
configs
|
||||
scripts
|
||||
certificates
|
||||
shadowSetupScript
|
||||
];
|
||||
};
|
||||
}
|
||||
{
|
||||
copyToRoot = buildEnv {
|
||||
name = "php";
|
||||
paths = phpPackages;
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
}
|
||||
{
|
||||
copyToRoot = [
|
||||
baseDirs
|
||||
bootstrap
|
||||
configs
|
||||
scripts
|
||||
certificates
|
||||
shadowSetupScript
|
||||
];
|
||||
perms = [
|
||||
{
|
||||
path = baseDirs;
|
||||
regex = "/tmp|var/(tmp|run|log/nginx|cache/nginx|spool)";
|
||||
mode = "0777";
|
||||
}
|
||||
{
|
||||
path = baseDirs;
|
||||
regex = "/etc/nc";
|
||||
mode = "0755";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
config = {
|
||||
Cmd = [ (getExe bootstrap) ];
|
||||
Env = [
|
||||
"EDITOR=hx"
|
||||
"WEBROOT=/var/www/html"
|
||||
"HAZE_IMAGE_VERSION=${toString version}"
|
||||
perms = [
|
||||
{
|
||||
path = baseDirs;
|
||||
regex = "/tmp|var/(tmp|run|log/nginx|cache/nginx|spool)";
|
||||
mode = "0777";
|
||||
}
|
||||
{
|
||||
path = baseDirs;
|
||||
regex = "/etc/nc";
|
||||
mode = "0755";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
WorkingDir = "/var/www/html";
|
||||
Labels = {
|
||||
"nl.icewind.haze.version" = toString version;
|
||||
config = {
|
||||
Cmd = [(getExe bootstrap)];
|
||||
Env = [
|
||||
"EDITOR=hx"
|
||||
"WEBROOT=/var/www/html"
|
||||
"HAZE_IMAGE_VERSION=${toString version}"
|
||||
];
|
||||
WorkingDir = "/var/www/html";
|
||||
Labels = {
|
||||
"nl.icewind.haze.version" = toString version;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
php,
|
||||
majorVersion,
|
||||
phpunit,
|
||||
testers,
|
||||
versionCheckHook,
|
||||
}: let
|
||||
inherit (lib) concatStringsSep splitString take;
|
||||
phpVersion = concatStringsSep "." (take 2 (splitString "." php.version));
|
||||
versions = {
|
||||
"9" = {
|
||||
version = "9.6.25";
|
||||
|
|
@ -31,6 +25,11 @@
|
|||
hash = "sha256-D5WI1kv05L8X3Gfw/MCxGdIcqWyWJg68GL9I24z/zIY=";
|
||||
vendorHash = "sha256-DBzpwDVCOaw+5rXGLiCHBhKg+kibvBD1XDNFMte3Heo=";
|
||||
};
|
||||
"13" = {
|
||||
version = "13.2.4";
|
||||
hash = "sha256-TL6KYumNXUQ2nvkw3s/0UtT3CVw1YZfAmaCn8FHznrg=";
|
||||
vendorHash = "sha256-Vlpjra9pcqhEy6fe6he6gsivQEmaHRgspy14DwCEOW4=";
|
||||
};
|
||||
};
|
||||
in
|
||||
php.buildComposerProject2 (finalAttrs: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue