Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisCarden committed Mar 13, 2020
2 parents 801dab6 + 1166a91 commit fdfc09c
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 62 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
- { name: "Isolated test w/ dev package versions", env: ORCA_JOB=ISOLATED_DEV }
- { name: "Integrated test w/ dev package versions", env: ORCA_JOB=INTEGRATED_DEV }
- { name: "Integrated test w/ dev package versions & next minor dev version of Drupal core", env: ORCA_JOB=CORE_NEXT }
- { name: "D9 readiness test", php: "7.3", env: ORCA_JOB=D9_READINESS }
- { name: "Custom job", env: ORCA_JOB=CUSTOM ORCA_CUSTOM_FIXTURE_INIT_ARGS="--help" ORCA_CUSTOM_TESTS_RUN_ARGS="--help" }
allow_failures:
- { php: "7.3", env: ORCA_JOB=D9_READINESS }

before_install:
- ../orca/bin/travis/self-test/before_install.sh
Expand Down
1 change: 1 addition & 0 deletions bin/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ case "$ORCA_JOB" in
"ISOLATED_DEV") orca debug:packages CURRENT_DEV; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --core=CURRENT_DEV --dev --profile=$ORCA_FIXTURE_PROFILE" ;;
"INTEGRATED_DEV") orca debug:packages CURRENT_DEV; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=CURRENT_DEV --dev --profile=$ORCA_FIXTURE_PROFILE" ;;
"CORE_NEXT") orca debug:packages NEXT_DEV; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=NEXT_DEV --dev --profile=$ORCA_FIXTURE_PROFILE" ;;
"D9_READINESS") orca debug:packages D9_READINESS; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --core='~9' --dev --profile=$ORCA_FIXTURE_PROFILE" ;;
"CUSTOM") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --profile=$ORCA_FIXTURE_PROFILE ${ORCA_CUSTOM_FIXTURE_INIT_ARGS:=}" ;;
esac
2 changes: 1 addition & 1 deletion config/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.2.4
v1.3.0
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ORCA (Official Representative Customer Application) is a tool for testing a comp
| --- | --- |
| Adds all company packages to a BLT project via Composer, installs them and their subextensions, and runs their automated tests. | Ensures that all company packages can be added to the same codebase via Composer (prevents dependency conflicts), that there are no adverse install time or functional interactions between them, and that they have no undeclared dependencies, and prevents regressions. |
| Adds only the package under test to a BLT project via Composer, installs it and its subextensions, and runs its automated tests. | Ensures that the package under test has no undeclared dependencies on other company packages and functions correctly on its own. |
| Performs the above tests with the recommended, stable versions of company packages, Drush, and Drupal Console. | Ensures that the package under test still works with the versions of other software already released and in use and prevents releases of the package from disrupting the ecosystem. |
| Performs the above tests using the latest development versions of company packages, Drush, and Drupal Console. | Ensures that the package under test will continue to work when new versions of other software are released and prevents changes in the ecosystem from breaking the package. Forces early awareness and collaboration between project teams and prevents rework and release day emergency support situations. |
| Performs the above tests with the recommended, stable versions of company packages and Drush. | Ensures that the package under test still works with the versions of other software already released and in use and prevents releases of the package from disrupting the ecosystem. |
| Performs the above tests using the latest development versions of company packages and Drush. | Ensures that the package under test will continue to work when new versions of other software are released and prevents changes in the ecosystem from breaking the package. Forces early awareness and collaboration between project teams and prevents rework and release day emergency support situations. |
| Performs the above tests using a threefold spread of Drupal core versions: the previous minor release, the current supported release, and the next minor dev version. | Ensures that the package under test still works with both supported releases of Drupal and will continue to work when the next one drops. |
| Performs static analysis of the package under test. | Ensures low level construction quality. (Prevents PHP warnings and errors, version incompatibility, etc.) |

Expand Down
3 changes: 3 additions & 0 deletions example/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
- { name: "Isolated test w/ dev package versions", env: ORCA_JOB=ISOLATED_DEV }
- { name: "Integrated test w/ dev package versions", env: ORCA_JOB=INTEGRATED_DEV }
- { name: "Integrated test w/ dev package versions & next minor dev version of Drupal core", env: ORCA_JOB=CORE_NEXT }
- { name: "D9 readiness test", php: "7.3", env: ORCA_JOB=D9_READINESS}
# Custom testing needs involving only minor variations on the standard setup
# can be achieved without custom scripting using the "CUSTOM" ORCA_JOB.
# @see https://github.com/acquia/orca/blob/master/docs/advanced-usage.md#travis-ci-scripts
Expand All @@ -109,6 +110,8 @@ jobs:
- env: ORCA_JOB=ISOLATED_DEV
- env: ORCA_JOB=INTEGRATED_DEV
- env: ORCA_JOB=CORE_NEXT
# You may need to allow the D9 readiness job to fail in the short term.
- { php: "7.3", env: ORCA_JOB=D9_READINESS }

# Install ORCA and prepare the environment.
before_install:
Expand Down
1 change: 1 addition & 0 deletions example/example.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ type: module
description: "Provides an example module for testing and illustration purposes."
package: Other
core: 8.x
core_version_requirement: '^8 || ^9'
5 changes: 3 additions & 2 deletions src/Command/Debug/DebugPackagesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
}

(new Table($output))
->setHeaderTitle("Drupal {$this->coreVersion}")
->setHeaders($this->getHeaders())
->setRows($this->getRows())
->render();
Expand All @@ -120,8 +121,8 @@ public function execute(InputInterface $input, OutputInterface $output): int {
* @SuppressWarnings(PHPMD.StaticAccess)
*/
private function handleCoreArgument($argument): void {
if (is_null($argument)) {
return;
if ($argument === NULL) {
$argument = '*';
}

if (!is_string($argument)) {
Expand Down
3 changes: 3 additions & 0 deletions src/Enum/DrupalCoreVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ final class DrupalCoreVersion extends Enum {

public const NEXT_DEV = 'NEXT_DEV';

public const D9_READINESS = 'D9_READINESS';

/**
* Provides help text for commands that accept Drupal core version input.
*
Expand All @@ -35,6 +37,7 @@ public static function commandHelp() {
sprintf('- %s: The current development version, e.g., "8.6.x-dev"', self::CURRENT_DEV),
sprintf('- %s: The next release version if available, e.g., "8.7.0-beta2"', self::NEXT_RELEASE),
sprintf('- %s: The next development version, e.g., "8.7.x-dev"', self::NEXT_DEV),
sprintf('- %s: The current development version of Drupal 9, e.g., "9.0.x-dev"', self::D9_READINESS),
];
}

Expand Down
60 changes: 48 additions & 12 deletions src/Fixture/FixtureCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Acquia\Orca\Fixture;

use Acquia\Orca\Exception\OrcaException;
use Acquia\Orca\Utility\DrupalCoreVersionFinder;
use Acquia\Orca\Utility\ProcessRunner;
use Acquia\Orca\Utility\StatusTable;
use Acquia\Orca\Utility\SutSettingsTrait;
Expand All @@ -15,6 +16,8 @@
use Composer\Package\Version\VersionGuesser;
use Composer\Package\Version\VersionSelector;
use Composer\Repository\RepositoryFactory;
use Composer\Semver\Comparator;
use Composer\Semver\VersionParser;
use Noodlehaus\Config;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Filesystem\Filesystem;
Expand All @@ -35,6 +38,13 @@ class FixtureCreator {
*/
private $blt;

/**
* The Drupal core version finder.
*
* @var \Acquia\Orca\Utility\DrupalCoreVersionFinder
*/
private $coreVersionFinder;

/**
* The Composer exit on patch failure flag.
*
Expand Down Expand Up @@ -182,9 +192,18 @@ class FixtureCreator {
*/
private $filesystem;

/**
* The Semver version parser.
*
* @var \Composer\Semver\VersionParser
*/
private $versionParser;

/**
* Constructs an instance.
*
* @param \Acquia\Orca\Utility\DrupalCoreVersionFinder $core_version_finder
* The Drupal core version finder.
* @param \Symfony\Component\Filesystem\Filesystem $filesystem
* The filesystem.
* @param \Acquia\Orca\Fixture\Fixture $fixture
Expand All @@ -205,9 +224,12 @@ class FixtureCreator {
* The subextension manager.
* @param \Composer\Package\Version\VersionGuesser $version_guesser
* The Composer version guesser.
* @param \Composer\Semver\VersionParser $version_parser
* The Semver version parser.
*/
public function __construct(Filesystem $filesystem, Fixture $fixture, FixtureConfigurator $fixture_configurator, FixtureInspector $fixture_inspector, SiteInstaller $site_installer, SymfonyStyle $output, ProcessRunner $process_runner, PackageManager $package_manager, SubextensionManager $subextension_manager, VersionGuesser $version_guesser) {
public function __construct(DrupalCoreVersionFinder $core_version_finder, Filesystem $filesystem, Fixture $fixture, FixtureConfigurator $fixture_configurator, FixtureInspector $fixture_inspector, SiteInstaller $site_installer, SymfonyStyle $output, ProcessRunner $process_runner, PackageManager $package_manager, SubextensionManager $subextension_manager, VersionGuesser $version_guesser, VersionParser $version_parser) {
$this->blt = $package_manager->getBlt();
$this->coreVersionFinder = $core_version_finder;
$this->filesystem = $filesystem;
$this->fixture = $fixture;
$this->fixtureConfigurator = $fixture_configurator;
Expand All @@ -218,6 +240,7 @@ public function __construct(Filesystem $filesystem, Fixture $fixture, FixtureCon
$this->siteInstaller = $site_installer;
$this->subextensionManager = $subextension_manager;
$this->versionGuesser = $version_guesser;
$this->versionParser = $version_parser;
}

/**
Expand Down Expand Up @@ -409,26 +432,17 @@ private function fixDefaultDependencies(): void {

$additions = [];

// Install the dev version of Drush.
if ($this->isDev) {
// Install the dev version of Drush.
$additions[] = 'drush/drush:dev-master || 10.x-dev || 9.x-dev || 9.5.x-dev';
}

// Add Drupal Console as a soft dependency akin to Drush.
$drupal_console_version = '~1.0';
if ($this->isDev) {
$drupal_console_version = 'dev-master';
}
$additions[] = "drupal/console:{$drupal_console_version}";

// Install a specific version of Drupal core.
if ($this->drupalCoreVersion) {
$additions[] = "drupal/core:{$this->drupalCoreVersion}";
}

// Install Drupal core dev requirements for Drupal 8.8 and later. (Before
// that BLT required webflo/drupal-core-require-dev.)
if ((float) $this->drupalCoreVersion >= 8.8) {
if ($this->shouldRequireDrupalCoreDev()) {
$additions[] = 'drupal/core-dev';
}

Expand All @@ -451,6 +465,28 @@ private function fixDefaultDependencies(): void {
$this->processRunner->runOrcaVendorBin($command, $fixture_path);
}

/**
* Determines whether or not to require drupal/core-dev.
*
* Require it for Drupal 8.8 and later. (Before that BLT required
* webflo/drupal-core-require-dev, which it supersedes.)
*
* @return bool
* Returns TRUE if it should be required, or FALSE if not.
*/
private function shouldRequireDrupalCoreDev(): bool {
try {
// Get the version if it's concrete as opposed to a range.
$version = $this->versionParser->normalize($this->drupalCoreVersion);
}
catch (\UnexpectedValueException $e) {
// The requested Drupal core version is a range. Get the best match.
$minimum_stability = $this->isDev ? 'dev' : 'stable';
$version = $this->coreVersionFinder->find($this->drupalCoreVersion, $minimum_stability);
}
return Comparator::greaterThanOrEqualTo($version, '8.8');
}

/**
* Gets the list of unwanted packages.
*
Expand Down
4 changes: 0 additions & 4 deletions src/Fixture/FixtureInspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ public function getOverview(): array {
'Drush version',
$this->getInstalledPackageVersionPretty('drush/drush'),
];
$overview[] = [
'Drupal Console version',
$this->getInstalledPackageVersionPretty('drupal/console'),
];

$overview = array_merge($overview, $this->getInstalledPackages());

Expand Down
54 changes: 36 additions & 18 deletions src/Utility/DrupalCoreVersionFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public function get(DrupalCoreVersion $version): string {
case DrupalCoreVersion::NEXT_DEV:
return $this->getNextDevVersion();

case DrupalCoreVersion::D9_READINESS:
return $this->getD9DevVersion();

default:
throw new \LogicException(sprintf('Unknown version. Update %s:%s.', __CLASS__, __FUNCTION__));
}
Expand All @@ -89,6 +92,30 @@ public function getPretty(DrupalCoreVersion $version): string {
}
}

/**
* Finds the Drupal core version matching the given criteria.
*
* @param string|null $target_package_version
* The target package version.
* @param string $minimum_stability
* The minimum stability. Available options (in order of stability) are
* dev, alpha, beta, RC, and stable.
* @param string $preferred_stability
* The preferred stability. Available options (in order of stability) are
* dev, alpha, beta, RC, and stable.
*
* @return string
* The version string.
*/
public function find(string $target_package_version = NULL, string $minimum_stability = 'stable', string $preferred_stability = 'stable'): string {
$best_candidate = $this->getVersionSelector($minimum_stability)
->findBestCandidate('drupal/core', $target_package_version, NULL, $preferred_stability);
if (!$best_candidate) {
throw new \RuntimeException(sprintf('No Drupal core version satisfies the given constraints: version=%s, minimum stability=%s', $target_package_version, $minimum_stability));
}
return $best_candidate->getPrettyVersion();
}

/**
* Gets the latest release from the previous minor version.
*
Expand All @@ -101,7 +128,7 @@ private function getPreviousMinorRelease(): string {
if ($this->previousMinorRelease) {
return $this->previousMinorRelease;
}
$this->previousMinorRelease = $this->getCoreVersion("<{$this->getCurrentMinorVersion()}");
$this->previousMinorRelease = $this->find("<{$this->getCurrentMinorVersion()}");
return $this->previousMinorRelease;
}

Expand Down Expand Up @@ -130,7 +157,7 @@ private function getCurrentRecommendedRelease(): string {
if ($this->currentRecommendedRelease) {
return $this->currentRecommendedRelease;
}
$this->currentRecommendedRelease = $this->getCoreVersion();
$this->currentRecommendedRelease = $this->find();
return $this->currentRecommendedRelease;
}

Expand Down Expand Up @@ -158,7 +185,7 @@ private function getNextRelease(): string {
if ($this->nextRelease) {
return $this->nextRelease;
}
$this->nextRelease = $this->getCoreVersion(">{$this->getCurrentRecommendedRelease()}", 'alpha');
$this->nextRelease = $this->find(">{$this->getCurrentRecommendedRelease()}", 'alpha');
return $this->nextRelease;
}

Expand All @@ -176,24 +203,15 @@ private function getNextDevVersion(): string {
}

/**
* Gets the Drupal core version matching the given criteria.
*
* @param string|null $target_package_version
* The target package version.
* @param string $minimum_stability
* The minimum stability. Available options (in order of stability) are
* dev, alpha, beta, RC, and stable.
* Gets the next D9 dev version.
*
* @return string
* The version string.
* The version string, e.g., "9.0.x-dev".
*
* @see \Acquia\Orca\Enum\DrupalCoreVersion::D9_READINESS
*/
private function getCoreVersion(string $target_package_version = NULL, string $minimum_stability = 'stable'): string {
$best_candidate = $this->getVersionSelector($minimum_stability)
->findBestCandidate('drupal/core', $target_package_version);
if (!$best_candidate) {
throw new \RuntimeException(sprintf('No Drupal core version satisfies the given constraints: version=%s, minimum stability=%s', $target_package_version, $minimum_stability));
}
return $best_candidate->getVersion();
private function getD9DevVersion(): string {
return $this->find('~9', 'dev', 'dev');
}

/**
Expand Down
Loading

0 comments on commit fdfc09c

Please sign in to comment.