Skip to content

Commit a0a9b2b

Browse files
committed
Add workflows for linters
Signed-off-by: Côme Chilliet <[email protected]>
1 parent 005db86 commit a0a9b2b

File tree

9 files changed

+2402
-3
lines changed

9 files changed

+2402
-3
lines changed

.github/workflows/lint-eslint.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- main
13+
- master
14+
- stable*
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
lint:
21+
runs-on: ubuntu-latest
22+
23+
name: eslint
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Read package.json node and npm engines version
30+
uses: skjnldsv/[email protected]
31+
id: versions
32+
with:
33+
fallbackNode: '^12'
34+
fallbackNpm: '^6'
35+
36+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
37+
uses: actions/setup-node@v3
38+
with:
39+
node-version: ${{ steps.versions.outputs.nodeVersion }}
40+
41+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
42+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
43+
44+
- name: Install dependencies
45+
run: npm ci
46+
47+
- name: Lint
48+
run: npm run lint

.github/workflows/lint-info-xml.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- main
13+
- master
14+
- stable*
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
xml-linters:
21+
runs-on: ubuntu-latest
22+
23+
name: info.xml lint
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
28+
- name: Download schema
29+
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd
30+
31+
- name: Lint info.xml
32+
uses: ChristophWurst/xmllint-action@v1
33+
with:
34+
xml-file: ./appinfo/info.xml
35+
xml-schema-file: ./info.xsd

.github/workflows/lint-php-cs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- main
13+
- master
14+
- stable*
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
lint:
21+
runs-on: ubuntu-latest
22+
23+
name: php-cs
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Set up php ${{ matrix.php-versions }}
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: "7.4"
33+
coverage: none
34+
35+
- name: Install dependencies
36+
run: composer i
37+
38+
- name: Lint
39+
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.github/workflows/lint-php.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- main
13+
- master
14+
- stable*
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
php-lint:
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
php-versions: ["7.4", "8.0", "8.1"]
25+
26+
name: php-lint
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
32+
- name: Set up php ${{ matrix.php-versions }}
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php-versions }}
36+
coverage: none
37+
38+
- name: Lint
39+
run: composer run lint
40+
41+
summary:
42+
permissions:
43+
contents: none
44+
runs-on: ubuntu-latest
45+
needs: php-lint
46+
47+
if: always()
48+
49+
name: php-lint-summary
50+
51+
steps:
52+
- name: Summary status
53+
run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi

.github/workflows/lint-stylelint.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- main
13+
- master
14+
- stable*
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
lint:
21+
runs-on: ubuntu-latest
22+
23+
name: stylelint
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Read package.json node and npm engines version
30+
uses: skjnldsv/[email protected]
31+
id: versions
32+
with:
33+
fallbackNode: '^12'
34+
fallbackNpm: '^6'
35+
36+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
37+
uses: actions/setup-node@v3
38+
with:
39+
node-version: ${{ steps.versions.outputs.nodeVersion }}
40+
41+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
42+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
43+
44+
- name: Install dependencies
45+
run: npm ci
46+
47+
- name: Lint
48+
run: npm run stylelint

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ node_modules/
66

77
/tests/integration/vendor/
88
/tests/integration/composer.lock
9+
10+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require_once './vendor/autoload.php';
6+
7+
use Nextcloud\CodingStandard\Config;
8+
9+
$config = new Config();
10+
$config
11+
->getFinder()
12+
->notPath('build')
13+
->notPath('l10n')
14+
->notPath('src')
15+
->notPath('vendor')
16+
->notPath('node_modules')
17+
->in(__DIR__);
18+
return $config;

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
"name": "nextcloud/ldap_write_support",
33
"type": "project",
44
"require-dev": {
5-
"php-parallel-lint/php-parallel-lint": "^1.2"
5+
"php-parallel-lint/php-parallel-lint": "^1.2",
6+
"nextcloud/coding-standard": "^1.0"
7+
},
8+
"scripts": {
9+
"cs:fix": "php-cs-fixer fix",
10+
"cs:check": "php-cs-fixer fix --dry-run --diff",
11+
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -not -path './node_modules/*' -print0 | xargs -0 -n1 php -l"
612
},
713
"license": "AGPLv3",
814
"authors": [

0 commit comments

Comments
 (0)