-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
shell.nix
149 lines (124 loc) · 3.08 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{
pkgs ? import <nixpkgs> { }
,phpVersion ? "php81"
}:
let
php = pkgs.${phpVersion}.buildEnv {
extensions = { enabled, all }: enabled ++ (with all; [
xdebug
]);
extraConfig = ''
xdebug.mode = debug
memory_limit = 4G
'';
};
inherit(pkgs."${phpVersion}Packages") composer;
projectInstall = pkgs.writeShellApplication {
name = "project-install";
runtimeInputs = [
php
composer
];
text = ''
rm -rf .Build/ vendor/ composer.lock
composer update --prefer-dist --no-progress --working-dir="$PROJECT_ROOT"
'';
};
projectCgl = pkgs.writeShellApplication {
name = "project-cgl";
runtimeInputs = [
php
];
text = ''
./vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --diff
'';
};
projectCglFix = pkgs.writeShellApplication {
name = "project-cgl-fix";
runtimeInputs = [
php
];
text = ''
./vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php
'';
};
projectLint = pkgs.writeShellApplication {
name = "project-lint";
runtimeInputs = [
php
];
text = ''
find ./*.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
'';
};
projectPhpstan = pkgs.writeShellApplication {
name = "project-phpstan";
runtimeInputs = [
php
];
text = ''
./vendor/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M
'';
};
projectTestUnit = pkgs.writeShellApplication {
name = "project-test-unit";
runtimeInputs = [
php
projectInstall
];
text = ''
project-install
./vendor/bin/phpunit -c Build/UnitTests.xml
'';
};
projectTestFunctional = pkgs.writeShellApplication {
name = "project-test-functional";
runtimeInputs = [
php
projectInstall
];
text = ''
project-install
./vendor/bin/phpunit -c Build/FunctionalTests.xml
'';
};
projectTestAcceptance = pkgs.writeShellApplication {
name = "project-test-acceptance";
runtimeInputs = [
projectInstall
pkgs.sqlite
pkgs.firefox
pkgs.geckodriver
pkgs.procps
php
];
text = ''
project-install
mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance"
mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance-logs"
mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance-reports"
mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance-sqlite-dbs"
export INSTANCE_PATH="$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance"
./vendor/bin/codecept run
pgrep -f "php -S" | xargs -r kill
'';
};
in pkgs.mkShellNoCC {
name = "TYPO3 Extension extcode/cart-products";
buildInputs = [
php
composer
projectInstall
projectCgl
projectCglFix
projectLint
projectPhpstan
projectTestUnit
projectTestFunctional
projectTestAcceptance
];
shellHook = ''
export PROJECT_ROOT="$(pwd)"
export typo3DatabaseDriver=pdo_sqlite
'';
}