Skip to content

Commit

Permalink
Added CI config.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Apr 11, 2024
1 parent f69d946 commit 18c767d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 479 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,23 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Install dependencies
run: composer install
working-directory: scaffold

- name: Check coding standards
run: composer lint
working-directory: scaffold
continue-on-error: ${{ vars.CI_LINT_IGNORE_FAILURE == '1' }}

- name: Run tests
run: XDEBUG_MODE=coverage composer test
working-directory: scaffold
continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }}

- name: Upload coverage report as an artifact
Expand Down
31 changes: 13 additions & 18 deletions scaffold/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,6 @@
}
],
"repositories": [
{
"type": "path",
"url": "../../customizer",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "../../scaffold",
"options": {
"symlink": false
}
},
{
"type": "vcs",
"url": "https://github.com/drevops/core-composer-scaffold"
Expand All @@ -42,7 +28,6 @@
"require-dev": {
"composer/composer": "^2.7",
"dealerdirect/phpcodesniffer-composer-installer": "^1",
"drevops/customizer": "@dev",
"drupal/coder": "^8.3",
"helmich/phpunit-json-assert": "^3.5",
"mikey179/vfsstream": "^1.6",
Expand Down Expand Up @@ -95,8 +80,7 @@
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"drupal/core-composer-scaffold": true,
"drevops/customizer": true
"drupal/core-composer-scaffold": true
}
},
"scripts": {
Expand All @@ -115,6 +99,17 @@
],
"post-root-package-install": [
"DrevOps\\composer\\ScaffoldGeneralizer::generalizeAndRemoveItselfAfterProjectCreate"
]
],
"lint": [
"cp php-script php-script.php && phpcs && rm php-script.php",
"phpmd --exclude vendor,vendor-bin,node_modules . text phpmd.xml",
"phpstan",
"rector --clear-cache --dry-run"
],
"lint-fix": [
"rector --clear-cache",
"cp php-script php-script.php && phpcbf && rm php-script.php"
],
"test": "if [ \"${XDEBUG_MODE}\" = 'coverage' ]; then phpunit; else phpunit --no-coverage; fi"
}
}
17 changes: 8 additions & 9 deletions scaffold/tests/phpunit/Dirs.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@ protected function prepareLocalRepo() {
$this->fs->mirror($root . '/.circleci', $this->repo . '/.circleci');
$this->fs->copy($root . '/myfile1.txt', $this->repo . '/myfile1.txt');

// @todo Refactor temp adjustments below.
// Add the local repository to the composer.json file.
$dstJson = json_decode(file_get_contents($this->repo . '/composer.json'), TRUE);
unset($dstJson['repositories'][0]);
unset($dstJson['require-dev']['drevops/customizer']);

// Override the dir for the scaffold. This will later need to be
// with an addition of the entry to `repositories` array once it is removed
// from the `composer.json`.
$dstJson['repositories'][1]['url'] = $this->repo;

$dstJson['repositories'][] = [
'type' => 'path',
'url' => $this->repo,
'options' => [
'symlink' => FALSE,
],
];
file_put_contents($this->repo . '/composer.json', json_encode($dstJson, JSON_PRETTY_PRINT));
}

Expand Down
Loading

0 comments on commit 18c767d

Please sign in to comment.