Skip to content

Commit 9453672

Browse files
Revert "LOPS-2300 - New command: workflow:wait:commit (#2591)"
This reverts commit 95a34c5.
1 parent a5ee59b commit 9453672

28 files changed

+142
-6109
lines changed

.env.dist

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,16 @@
11
export PROJECT_PATH=$(realpath .)
2-
## Note: The terminus test site must have some quicksilver scripts enabled
3-
## in order for tests to pass.
4-
## Needed for unit test fixutures
5-
export TERMINUS_PROJECT_ROOT=${PROJECT_PATH}
6-
7-
## This is the site that will be used for testing
8-
export TERMINUS_SITE="ci-terminus-composer"
9-
10-
## This is the site that will be used for testing wordpress commands
2+
export TERMINUS_SITE="terminus-test-site"
113
export TERMINUS_SITE_WP="terminus-test-site-wordpress"
12-
13-
## This is the site that will be used for testing wordpress network
144
export TERMINUS_SITE_WP_NETWORK="terminus-test-site-wp-network"
15-
16-
## This is the site that will be used for cloning a test environment on which to run tests
175
export TERMINUS_ENV="dev"
18-
19-
## this is the org that will be used. The site(s) above need to be in this org
206
export TERMINUS_ORG="Agency"
21-
22-
## This is the user that will be used for testing Should be attached the token below
237
export TERMINUS_USER="[email protected]"
24-
258
## To Autoload your token from your local machine, change the TERMINUS_TOKEN to the following command:
269
## export TERMINUS_TOKEN=$(cat $HOME/.terminus/cache/tokens/[email protected] | jq -r .token)
2710
export TERMINUS_TOKEN="{TERMINUS TOKEN}"
28-
29-
## this is the folder that terminus will use to store its data during the tests
3011
export TERMINUS_BASE_DIR="/tmp/terminus-data"
31-
32-
## this is the folder that terminus will use to store its plugins during the tests
3312
export TERMINUS_PLUGINS2_DIR="${TERMINUS_BASE_DIR}/plugins"
34-
35-
## this is the folder that terminus will use to store its plugins during the tests
3613
export TERMINUS_PLUGINS_DIR="${TERMINUS_BASE_DIR}/plugins-3.x"
37-
38-
## Used for testing plugins
3914
export TERMINUS_DEPENDENCIES_BASE_DIR="${TERMINUS_BASE_DIR}/dependencies-1"
40-
41-
## this will prevent the tests from creating a test environment for the run
4215
export TERMINUS_TESTING_RUNTIME_ENV=
43-
44-
## this will prevent tests from reinstalling the development packages once a phar is built
4516
export TERMINUS_ON_PHAR_COMPLETE_REINSTALL_COMPOSER_WITH_DEV=1

.github/workflows/3x.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ jobs:
2626
name: Checkout & build Phar
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@v3
3030
- name: Save repo content as artifact
3131
uses: actions/upload-artifact@v4
3232
with:
3333
name: full-workspace
3434
path: ${{ github.workspace }}
3535
- name: Full Composer Install
36-
run: composer install --dev
36+
run: composer install
3737
- name: Validate Code
3838
run: composer code:lint
3939
- name: Phar Build

RoboFile.php

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
use CzProject\GitPhp\Git;
4-
use CzProject\GitPhp\GitException;
53
use Pantheon\Terminus\Config\ConfigAwareTrait;
64
use Pantheon\Terminus\Helpers\CommandCoverageReport;
75
use Pantheon\Terminus\Terminus;
@@ -208,124 +206,6 @@ public function setTerminus(Terminus $terminus): void
208206
$this->terminus = $terminus;
209207
}
210208

211-
/**
212-
* Generates a test commit.
213-
*
214-
* @throws \Pantheon\Terminus\Exceptions\TerminusException
215-
* @throws GitException
216-
*/
217-
public function generateTestCommit()
218-
{
219-
$this->output()->writeln('Getting the Site Repo');
220-
// get the git host and port from terminus
221-
$commandResponse = $this->getTerminus()->execute(
222-
'%s connection:info %s.dev --fields=git_host,git_port --format=json',
223-
[
224-
$this->getProjectPath() . "/terminus.phar",
225-
$this->getSiteName(),
226-
]
227-
);
228-
229-
// check if the command was successful
230-
if ($commandResponse[1] !== 0) {
231-
$this->output()->writeln('Failed to retrieve git host and port');
232-
exit(1);
233-
}
234-
235-
// decode the json response
236-
$gitInfo = json_decode($commandResponse[0], true);
237-
$this->output()->writeln('Retrieved git host and port' . print_r($gitInfo, true));
238-
239-
// check if the git host and port were retrieved
240-
if (!isset($gitInfo['git_host']) || !isset($gitInfo['git_port'])) {
241-
$this->output()->writeln('Failed to retrieve git host and port');
242-
exit(1);
243-
}
244-
245-
// Does the known_hosts file exist?
246-
if (!file_exists(sprintf("%s/.ssh/known_hosts", getenv("HOME")))) {
247-
// if not, create one
248-
touch(sprintf("%s/.ssh/known_hosts", getenv("HOME")));
249-
}
250-
251-
// get the contents of the known_hosts file
252-
$knownHosts = file_get_contents(sprintf("%s/.ssh/known_hosts", getenv("HOME")));
253-
// check if the git host is already in the known_hosts file
254-
if (!str_contains($knownHosts, $gitInfo['git_host'])) {
255-
// if not, add it
256-
$this->output()->writeln('Adding the git host to known hosts file');
257-
$addGitHostToKnownHostsCommand = sprintf(
258-
'ssh-keyscan -p %d %s >> ~/.ssh/known_hosts',
259-
$gitInfo['git_port'],
260-
$gitInfo['git_host']
261-
);
262-
$this->output()->writeln($addGitHostToKnownHostsCommand);
263-
exec($addGitHostToKnownHostsCommand);
264-
}
265-
266-
// checkout the branch related to this test run
267-
$clonedPath = sprintf(
268-
"%s/pantheon-local-copies/%s",
269-
getenv("HOME"),
270-
$this->getSiteName()
271-
);
272-
if (is_dir($clonedPath)) {
273-
// make sure you're working with a clean copy of the repo
274-
exec("rm -rf {$clonedPath}");
275-
}
276-
$this->output()->writeln(sprintf('Cloning the site repository to %s', $clonedPath));
277-
// get the git host and port from terminus
278-
$commandResponse = $this->getTerminus()->execute(
279-
'%s local:clone %s',
280-
[
281-
$this->getProjectPath() . "/terminus.phar",
282-
$this->getSiteName(),
283-
]
284-
);
285-
286-
$response = "";
287-
try {
288-
$git = new Git();
289-
$repo = $git->open($clonedPath);
290-
chdir($clonedPath);
291-
$branches = $repo->getBranches();
292-
if (!in_array($this->getSiteEnv(), $branches)) {
293-
$this->output()->writeln(sprintf('Creating the %s branch', $this->getSiteEnv()));
294-
// Create the branch
295-
$repo->createBranch($this->getSiteEnv());
296-
}
297-
// Check out the branch in question
298-
$repo->checkout($this->getSiteEnv());
299-
// create a text file
300-
$testFilePath = sprintf('%s/test.txt', $clonedPath);
301-
file_put_contents($testFilePath, 'test');
302-
// add the file to the repository
303-
$repo->addFile("test.txt");
304-
// commit the file
305-
$repo->commit('Test commit');
306-
// push the commit
307-
$response = $repo->execute(
308-
'push',
309-
'origin',
310-
$this->getSiteEnv(),
311-
);
312-
} catch (GitException $e) {
313-
$this->output()->writeln(["Git Exception:", $e->getMessage()]);
314-
$this->output()->writeln(print_r($response, true));
315-
exit(1);
316-
} catch (Exception $e) {
317-
$this->output()->writeln($e->getMessage());
318-
$this->output()->writeln(print_r($response, true));
319-
exit(1);
320-
}
321-
322-
// get the last commit
323-
$commit = $repo->getLastCommit();
324-
// output the commit id
325-
$this->output()->writeln($commit->getId());
326-
return $commit->getId();
327-
}
328-
329209
/**
330210
* Returns the absolute path to the project.
331211
*
@@ -335,21 +215,4 @@ private function getProjectPath(): string
335215
{
336216
return dirname(__FILE__);
337217
}
338-
339-
340-
/**
341-
* @return string
342-
*/
343-
private function getSiteName(): string
344-
{
345-
return getenv('TERMINUS_SITE') ?? 'ci-terminus-composer';
346-
}
347-
348-
/**
349-
* @return string
350-
*/
351-
private function getSiteEnv(): string
352-
{
353-
return getenv('TERMINUS_ENV') ?? 'dev';
354-
}
355218
}

composer.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
"monolog/monolog": "^2.2",
3030
"psy/psysh": "^0.12.6",
3131
"rogervila/array-diff-multidimensional": "^2.0",
32+
"symfony/console": "^5",
33+
"symfony/finder": "^5",
34+
"symfony/process": "^5",
35+
"symfony/yaml": "^5",
3236
"twig/twig": "^3.3"
3337
},
3438
"require-dev": {
@@ -110,17 +114,14 @@
110114
"test:behat": [
111115
"SHELL_INTERACTIVE=true TERMINUS_TEST_MODE=1 behat --colors --config tests/config/behat.yml --stop-on-failure --suite=default"
112116
],
113-
"tests:unit": [
114-
"vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --testsuite unit --do-not-cache-result --verbose --stop-on-failure"
115-
],
116117
"test:short": [
117-
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --testsuite functional --group=short --do-not-cache-result --verbose --stop-on-failure"
118+
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --group=short --do-not-cache-result --verbose --stop-on-failure"
118119
],
119120
"test:long": [
120-
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --testsuite functional --group=long --do-not-cache-result --verbose"
121+
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --group=long --do-not-cache-result --verbose"
121122
],
122123
"test:functional": [
123-
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --testsuite functional --group=short,long --do-not-cache-result --verbose",
124+
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --group=short,long --do-not-cache-result --verbose",
124125
"@coverage"
125126
],
126127
"test:all": [
@@ -154,7 +155,7 @@
154155
"php-cs-fixer": [
155156
"vendor/bin/php-cs-fixer fix ./src --rules=@PSR12",
156157
"vendor/bin/php-cs-fixer fix ./tests/Functional --rules=@PSR12",
157-
"vendor/bin/php-cs-fixer fix ./tests/Unit --rules=@PSR12"
158+
"vendor/bin/php-cs-fixer fix ./tests/unit_tests --rules=@PSR12"
158159
]
159160
},
160161
"config": {

phpunit.xml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4-
bootstrap="tests/config/bootstrap.php"
5-
colors="true">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" bootstrap="tests/config/bootstrap.php" colors="true">
63
<testsuites>
74
<testsuite name="functional">
85
<directory suffix="Test.php">tests/Functional/</directory>
96
</testsuite>
10-
<testsuite name="unit">
11-
<directory suffix="Test.php">tests/Unit/Collections/</directory>
12-
<directory suffix="Test.php">tests/Unit/Models/</directory>
13-
</testsuite>
147
</testsuites>
158
<coverage processUncoveredFiles="true" cacheDirectory="reports">
169
<include>
@@ -32,6 +25,5 @@
3225
<server name="TERMINUS_VERIFY_HOST_CERT" value="${TERMINUS_VERIFY_HOST_CERT}" />
3326
<server name="TERMINUS_CACHE_DIR" value="${TERMINUS_CACHE_DIR}" />
3427
<server name="TERMINUS_DEBUG" value="${TERMINUS_DEBUG}" />
35-
<server name="TERMINUS_PROJECT_ROOT" value="${TERMINUS_PROJECT_ROOT}" />
3628
</php>
3729
</phpunit>

reports/.gitkeep

Whitespace-only changes.

scripts/phar_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ echo "Installing composer dependencies with --no-dev..."
66
composer install --no-dev
77

88
echo "Building terminus.phar..."
9-
"${HOME}"/box/vendor/bin/box compile
9+
box compile
1010
echo "terminus.phar file has been created successfully!"
1111

1212
if [[ -n "${TERMINUS_ON_PHAR_COMPLETE_REINSTALL_COMPOSER_WITH_DEV}" ]]; then

0 commit comments

Comments
 (0)