Skip to content

Commit

Permalink
Have the Github Actions workflow mimic the sandbox.
Browse files Browse the repository at this point in the history
/drupal-rector
/web
  • Loading branch information
damontgomery committed May 3, 2021
1 parent cb77631 commit a1101a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/functional_test__rector_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ jobs:
# START: SHARED DRUPAL INSTALL SETUP
- name: Setup Drupal
run: |
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:~8 ~/drupal --no-interaction
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:~8 ../drupal --no-interaction
cd ..
mv drupal/* .
composer config minimum-stability dev
composer config prefer-stable true
composer config preferred-install dist
Expand All @@ -33,27 +34,24 @@ jobs:
# We add a local repository `repositories.0` which takes precendence over the packagist repository that is automatically added.
- name: Install Drupal Rector
run: |
cd ~/drupal
cd ..
composer config repositories.drupal-rector "{\"type\": \"path\", \"url\": \"$GITHUB_WORKSPACE\", \"options\": {\"symlink\": false}}"
composer require palantirnet/drupal-rector:@dev --no-progress
- name: Install Drupal Rector Config
run: |
cd ~/drupal
cd ..
cp vendor/palantirnet/drupal-rector/rector.php .
# END: SHARED DRUPAL INSTALL SETUP
- name: Install PHPUnit in the Drupal site since it is required for some of the rules
run: |
cd ~/drupal
cd ..
composer require phpunit/phpunit:~7.5 --no-progress
- name: Prepare rector_examples folder in the drupal modules directory
run: |
cd ~/drupal
cd ..
mkdir -p web/modules/custom
cp -R vendor/palantirnet/drupal-rector/rector_examples web/modules/custom
- name: Install local dependencies, including Behat.
run: composer install
# Uncomment to enable SSH access to Github Actions - https://github.com/marketplace/actions/debugging-with-tmate#getting-started
- name: Debugging with tmate
uses: mxschmitt/action-tmate@v2
- name: Run Behat tests
run: vendor/bin/behat
12 changes: 11 additions & 1 deletion features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ class FeatureContext implements Context {
*/
protected $temporaryFolderPath = 'features/tmp';

/**
* The Drupal Rector path.
*
* @var string
*/
protected $drupalRectorPath = 'drupal-rector/';

/**
* The path to the test file or folder.
*
Expand Down Expand Up @@ -62,10 +69,13 @@ public function iRunDrupalRectorOnTheTest() {
* @When I run Drupal Rector on the file/folder :path
*/
public function iRunDrupalRectorOnThe($path) {
chdir('..');

$output = NULL;
$return_value = NULL;
exec("vendor/bin/rector process --config=features/behat-rector.php $path", $output, $return_value);
exec("vendor/bin/rector process $this->drupalRectorPath/$path", $output, $return_value);

chdir($this->drupalRectorPath);

if ($return_value !== 0) {
throw new Exception('Rector did not complete successfully.' . PHP_EOL
Expand Down

0 comments on commit a1101a5

Please sign in to comment.