You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example uses the http package to perform http requests and run tests on them. It creates a single check with one test,
58
+
runs it and checks the result. If it is a result with an exit code, the exit code is used. If not, the result is checked for success and
59
+
the default exit codes are used.
60
+
61
+
Since most CI/CD systems will run the script and check the exit code, this should already be enough to get the system to fail if one of the checks fail.
62
+
63
+
It's very easy to run multiple checks:
64
+
65
+
```php
66
+
<?php declare(strict_types=1);
67
+
68
+
use \de\codenamephp\deploymentchecks\base\Check\Collection\SequentialCollection;
69
+
use de\codenamephp\deploymentchecks\base\Check\Result\WithExitCodeInterface;
70
+
use de\codenamephp\deploymentchecks\base\ExitCode\DefaultExitCodes;
71
+
use de\codenamephp\deploymentchecks\http\Check\HttpCheck;
72
+
use de\codenamephp\deploymentchecks\http\Check\Test\StatusCode;
Not much has changed. The only difference is that the checks are now wrapped in a collection that will run them sequentially. If one fails, the result will be
94
+
unsuccessful.
95
+
96
+
It's also very easy to run checks in parallel. The next example uses the async package to run the checks in parallel:
97
+
98
+
```php
99
+
<?php declare(strict_types=1);
100
+
40
101
use de\codenamephp\deploymentchecks\async\Collection\AsyncCheckCollection;
41
102
use de\codenamephp\deploymentchecks\base\Check\Result\WithExitCodeInterface;
42
103
use de\codenamephp\deploymentchecks\base\ExitCode\DefaultExitCodes;
@@ -62,8 +123,4 @@ $result = (new AsyncCheckCollection(new \Spatie\Async\Pool(),
This example uses the http package to perform http requests and run tests on them together with the async package to the requests are tested in parallel.
66
-
At the end the result is checked. If it is a result with an exit code, the exit code is used. If not, the result is checked for success and
67
-
the default exit codes are used.
68
-
69
-
Since most CI/CD systems will run the script and check the exit code, this should already be enough to get the system to fail if one of the checks fail.
126
+
Again, not much has changed. The only difference is that the checks are now wrapped in a collection that will run them in parallel.
0 commit comments