Skip to content

Commit

Permalink
Merge pull request #23 from creative-commoners/pulls/1.7/module-stand…
Browse files Browse the repository at this point in the history
…ards

MNT Use GitHub Actions CI
  • Loading branch information
GuySartorelli authored Jul 15, 2022
2 parents 301daf2 + f68a4cc commit 2175573
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 12 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .github/workflows/keepalive.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
12 changes: 11 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset><rule ref="PSR2" /></ruleset>
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>

<file>src</file>

<!-- base rules are PSR-12 -->
<rule ref="PSR12" >
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
</rule>
</ruleset>
5 changes: 3 additions & 2 deletions src/RecipeInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ protected function installProjectFile($sourceRoot, $destinationRoot, $sourcePath
" - Skipping <info>$relativePath</info> (<comment>existing and modified in project</comment>)"
);
}
} 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
Expand Down Expand Up @@ -140,7 +141,7 @@ protected function getFileIterator($sourceRoot, $patterns)
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(
Expand Down
15 changes: 7 additions & 8 deletions src/RecipePlugin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php


namespace SilverStripe\RecipePlugin;

use Composer\Composer;
Expand All @@ -27,37 +26,37 @@ class RecipePlugin implements PluginInterface, EventSubscriberInterface, Capable
/**
* Type of recipe to check for
*/
const RECIPE_TYPE = 'silverstripe-recipe';
public const RECIPE_TYPE = 'silverstripe-recipe';

/**
* 'extra' key for project files
*/
const PROJECT_FILES = 'project-files';
public const PROJECT_FILES = 'project-files';

/**
* 'extra' key for public files
*/
const PUBLIC_FILES = 'public-files';
public const PUBLIC_FILES = 'public-files';

/**
* Hard-coded 'public' web-root folder
*/
const PUBLIC_PATH = 'public';
public const PUBLIC_PATH = 'public';

/**
* 'extra' key for list of project files installed
*/
const PROJECT_FILES_INSTALLED = 'project-files-installed';
public const PROJECT_FILES_INSTALLED = 'project-files-installed';

/**
* 'extra' key for list of public files installed
*/
const PUBLIC_FILES_INSTALLED = 'public-files-installed';
public const PUBLIC_FILES_INSTALLED = 'public-files-installed';

/**
* 'extra' key for project dependencies installed
*/
const PROJECT_DEPENDENCIES_INSTALLED = 'project-dependencies-installed';
public const PROJECT_DEPENDENCIES_INSTALLED = 'project-dependencies-installed';

public function activate(Composer $composer, IOInterface $io)
{
Expand Down

0 comments on commit 2175573

Please sign in to comment.