From f68a4cc2bea59f40b0e206bfa8e003d0ff2beeee Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 6 Jul 2022 14:02:51 +1200 Subject: [PATCH] MNT Use GitHub Actions CI --- .github/workflows/ci.yml | 16 ++++++++++++++++ .github/workflows/keepalive.yml | 17 +++++++++++++++++ composer.json | 3 ++- phpcs.xml.dist | 12 +++++++++++- src/RecipeInstaller.php | 5 +++-- src/RecipePlugin.php | 15 +++++++-------- 6 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/keepalive.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0f6ba38 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,16 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + # Every Friday at 12:00pm UTC + schedule: + - cron: '0 12 * * 5' + +jobs: + ci: + name: CI + # Only run cron on the silverstripe account + if: (github.event_name == 'schedule' && startsWith(github.repository, 'silverstripe/')) || (github.event_name != 'schedule') + uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 diff --git a/.github/workflows/keepalive.yml b/.github/workflows/keepalive.yml new file mode 100644 index 0000000..ebf9716 --- /dev/null +++ b/.github/workflows/keepalive.yml @@ -0,0 +1,17 @@ +name: Keepalive + +on: + workflow_dispatch: + # The 4th of every month at 10:50am UTC + schedule: + - cron: '50 10 4 * *' + +jobs: + keepalive: + name: Keepalive + # Only run cron on the silverstripe account + if: (github.event_name == 'schedule' && startsWith(github.repository, 'silverstripe/')) || (github.event_name != 'schedule') + runs-on: ubuntu-latest + steps: + - name: Keepalive + uses: silverstripe/gha-keepalive@v1 diff --git a/composer.json b/composer.json index 266f3e1..058f438 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ "composer-plugin-api": "^1.1 || ^2" }, "require-dev": { - "composer/composer": "^1.2 || 2" + "composer/composer": "^1.2 || 2", + "squizlabs/php_codesniffer": "^3.5" }, "minimum-stability": "dev" } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index dc3e763..646ceb3 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,2 +1,12 @@ - + + CodeSniffer ruleset for SilverStripe coding conventions. + + src + + + + + + + diff --git a/src/RecipeInstaller.php b/src/RecipeInstaller.php index 10c918c..6233915 100644 --- a/src/RecipeInstaller.php +++ b/src/RecipeInstaller.php @@ -110,7 +110,8 @@ class RecipeInstaller extends LibraryInstaller " - Skipping $relativePath (existing and modified in project)" ); } - } elseif (in_array($relativePath, $installedFiles ?? []) || + } elseif ( + in_array($relativePath, $installedFiles ?? []) || in_array($relativeDestination, $installedFiles ?? []) ) { // Don't re-install previously installed files that have been deleted @@ -140,7 +141,7 @@ class RecipeInstaller extends LibraryInstaller foreach ($patterns as $pattern) { $expressions[] = $this->globToRegexp($pattern); } - $regExp = '#^' . $this->globToRegexp($sourceRoot . '/').'(('.implode(')|(', $expressions).'))$#'; + $regExp = '#^' . $this->globToRegexp($sourceRoot . '/') . '((' . implode(')|(', $expressions) . '))$#'; // Build directory iterator $directoryIterator = new RecursiveDirectoryIterator( diff --git a/src/RecipePlugin.php b/src/RecipePlugin.php index fd65c3c..d16edbd 100644 --- a/src/RecipePlugin.php +++ b/src/RecipePlugin.php @@ -1,6 +1,5 @@