Skip to content

Commit

Permalink
Update github actions and add php-cs
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv authored and marcelklehr committed Aug 4, 2020
1 parent 6fad8b5 commit 03eda33
Show file tree
Hide file tree
Showing 6 changed files with 2,628 additions and 650 deletions.
54 changes: 50 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,70 @@ jobs:
- name: Lint
run: composer run lint

php-cs-fixer:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.4']

name: cs php${{ matrix.php-versions }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up php
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
coverage: none

- name: Install dependencies
run: composer i

- name: Run coding standards check
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

node:
runs-on: ubuntu-latest

strategy:
matrix:
node-versions: [12.x]
node-version: [12.x]

name: node${{ matrix.node-versions }}
name: eslint node${{ matrix.node-version }}
steps:
- uses: actions/checkout@v2

- name: Set up node ${{ matrix.node-versions }}
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-versions: ${{ matrix.node-versions }}
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

stylelint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

name: stylelint node${{ matrix.node-version }}
steps:
- uses: actions/checkout@v2

- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run stylelint
12 changes: 8 additions & 4 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@ jobs:

strategy:
matrix:
node-versions: [12.x]
node-version: [12.x]

name: node${{ matrix.node-versions }}
name: node${{ matrix.node-version }}
steps:
- uses: actions/checkout@v2

- name: Set up node ${{ matrix.node-versions }}
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-versions: ${{ matrix.node-versions }}
node-version: ${{ matrix.node-version }}

- name: Install dependencies & build
run: |
npm ci
npm run build --if-present
- name: Check webpack build changes
run: |
bash -c "[[ ! \"`git status --porcelain `\" ]] || ( echo 'Uncommited changes in webpack build' && git status && exit 1 )"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build
_build
node_modules
vendor
/.php_cs.cache
17 changes: 17 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

require_once './vendor/autoload.php';

use Nextcloud\CodingStandard\Config;

$config = new Config();
$config
->getFinder()
->notPath('build')
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->in(__DIR__);
return $config;
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
"rowbot/url": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5"
"phpunit/phpunit": "^8.5",
"nextcloud/coding-standard": "^0.3.0"
},
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true
},
"scripts": {
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l"
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix"
}
}
Loading

0 comments on commit 03eda33

Please sign in to comment.