Skip to content

Commit ca69689

Browse files
Add Nextclouds worklfow templates and apply Nextcloud coding style (#235)
1 parent 2b45dc7 commit ca69689

File tree

100 files changed

+18785
-1129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+18785
-1129
lines changed

.devcontainer/devcontainer.json

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,31 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/php
31
{
4-
"name": "PHP",
5-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/php:1-8.3-bullseye",
7-
// Features to add to the dev container. More info: https://containers.dev/features.
8-
// "features": {},
9-
// Configure tool-specific properties.
10-
// "customizations": {},
11-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
12-
"forwardPorts": [
13-
80
14-
],
15-
"containerEnv": {
16-
"XDEBUG_MODE": "debug,develop"
17-
},
18-
"customizations": {
19-
"vscode": {
20-
"extensions": [
21-
"CharlieGerard.pride-vscode-themes",
22-
"junstyle.php-cs-fixer",
23-
"stylelint.vscode-stylelint",
24-
"jetmartin.bats",
25-
"recca0120.vscode-phpunit"
26-
]
27-
}
28-
},
29-
// Use 'postCreateCommand' to run commands after the container is created.
30-
"postStartCommand": ".devcontainer/postCreateCommands.sh",
31-
"features": {
32-
"ghcr.io/devcontainers/features/node:1": {},
33-
"ghcr.io/edouard-lopez/devcontainer-features/bats:0": {},
34-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
35-
"ghcr.io/devcontainers/features/github-cli:1": {},
36-
"ghcr.io/wxw-matt/devcontainer-features/apt:latest": {
37-
"packages": "bash-completion vim iputils-ping telnet"
38-
}
39-
}
40-
}
2+
"name": "PHP",
3+
"image": "mcr.microsoft.com/devcontainers/php:1-8.3-bullseye",
4+
"forwardPorts": [
5+
80
6+
],
7+
"containerEnv": {
8+
"XDEBUG_MODE": "debug,develop"
9+
},
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"CharlieGerard.pride-vscode-themes",
14+
"junstyle.php-cs-fixer",
15+
"stylelint.vscode-stylelint",
16+
"jetmartin.bats",
17+
"recca0120.vscode-phpunit"
18+
]
19+
}
20+
},
21+
"postStartCommand": ".devcontainer/postCreateCommands.sh",
22+
"features": {
23+
"ghcr.io/devcontainers/features/node:1": {},
24+
"ghcr.io/edouard-lopez/devcontainer-features/bats:0": {},
25+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
26+
"ghcr.io/devcontainers/features/github-cli:1": {},
27+
"ghcr.io/wxw-matt/devcontainer-features/apt:latest": {
28+
"packages": "bash-completion vim iputils-ping telnet"
29+
}
30+
}
31+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2025 Lennart Dohmann <lennart.dohmann@gdata.de>
2+
3+
SPDX-License-Identifier: AGPL-3.0-or-later

.devcontainer/postCreateCommands.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
# SPDX-FileCopyrightText: 2025 Lennart Dohmann <lennart.dohmann@gdata.de>
4+
#
5+
# SPDX-License-Identifier: AGPL-3.0-or-later
6+
37
bash -i -c 'nvm install 20'
48
bash -i -c 'nvm use 20'
59

@@ -26,9 +30,5 @@ NEXTCLOUD_VERSION=$(grep -oP -m 1 "[0-9]+\.[0-9]+\.[0-9]+" install.sh)
2630

2731
mkdir -p ~/.ssh/
2832

29-
rm -rf nextcloud-server/
30-
git clone --depth 1 --recurse-submodules --single-branch --branch v$NEXTCLOUD_VERSION https://github.com/nextcloud/server.git ./nextcloud-server
31-
cd nextcloud-server
32-
git submodule update --init
33-
cd -
34-
./install.sh
33+
./get-nc-server.sh "$NEXTCLOUD_VERSION"
34+
./install.sh

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-FileCopyrightText: 2025 Lennart Dohmann <lennart.dohmann@gdata.de>
2+
#
3+
# SPDX-License-Identifier: AGPL-3.0-or-later
4+
5+
root = true
6+
7+
[*]
8+
indent_style = space
9+
indent_size = 4
10+
tab_width = 4
11+
end_of_line = lf
12+
charset = utf-8
13+
trim_trailing_whitespace = true
14+
insert_final_newline = true
15+
max_line_length = 120
16+
17+
[*.{js,ts,jsx,tsx,html,css,scss,sass,php}]
18+
indent_style = tab
19+
20+
[*.{yml,yaml,json,txt}]
21+
trim_trailing_whitespace = false
22+
indent_size = 2
23+
24+
[Makefile]
25+
indent_style = tab
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: 2025 Lennart Dohmann <lennart.dohmann@gdata.de>
2+
#
3+
# SPDX-License-Identifier: AGPL-3.0-or-later
4+
5+
name: editorconfig-checker
6+
7+
on: pull_request
8+
9+
jobs:
10+
editorconfig:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: editorconfig-checker/action-editorconfig-checker@main
15+
- run: editorconfig-checker -exclude "\.sh|\.ya?ml|\.md|\.gitignore|\.json|admin\.php|Dockerfile\.Nextcloud|\.txt|Makefile|\.xml|\.bats|\.env-test|\.ini"

.github/workflows/lint-eslint.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Lint eslint
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
17+
jobs:
18+
changes:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
pull-requests: read
23+
24+
outputs:
25+
src: ${{ steps.changes.outputs.src}}
26+
27+
steps:
28+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
29+
id: changes
30+
continue-on-error: true
31+
with:
32+
filters: |
33+
src:
34+
- '.github/workflows/**'
35+
- 'src/**'
36+
- 'appinfo/info.xml'
37+
- 'package.json'
38+
- 'package-lock.json'
39+
- 'tsconfig.json'
40+
- '.eslintrc.*'
41+
- '.eslintignore'
42+
- '**.js'
43+
- '**.ts'
44+
- '**.vue'
45+
46+
lint:
47+
runs-on: ubuntu-latest
48+
49+
needs: changes
50+
if: needs.changes.outputs.src != 'false'
51+
52+
name: NPM lint
53+
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
57+
with:
58+
persist-credentials: false
59+
60+
- name: Read package.json node and npm engines version
61+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
62+
id: versions
63+
with:
64+
fallbackNode: '^20'
65+
fallbackNpm: '^10'
66+
67+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
68+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
69+
with:
70+
node-version: ${{ steps.versions.outputs.nodeVersion }}
71+
72+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
73+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
74+
75+
- name: Install dependencies
76+
env:
77+
CYPRESS_INSTALL_BINARY: 0
78+
PUPPETEER_SKIP_DOWNLOAD: true
79+
run: npm ci
80+
81+
- name: Lint
82+
run: npm run lint
83+
84+
summary:
85+
permissions:
86+
contents: none
87+
runs-on: ubuntu-latest
88+
needs: [changes, lint]
89+
90+
if: always()
91+
92+
# This is the summary, we just avoid to rename it so that branch protection rules still match
93+
name: eslint
94+
95+
steps:
96+
- name: Summary status
97+
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi
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+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Lint info.xml
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
17+
jobs:
18+
xml-linters:
19+
runs-on: ubuntu-latest
20+
21+
name: info.xml lint
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
with:
26+
persist-credentials: false
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@36f2a302f84f8c83fceea0b9c59e1eb4a616d3c1 # v1.2
33+
with:
34+
xml-file: ./appinfo/info.xml
35+
xml-schema-file: ./info.xsd

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Lint php-cs
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
17+
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
21+
name: php-cs
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
with:
27+
persist-credentials: false
28+
29+
- name: Get php version
30+
id: versions
31+
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
32+
33+
- name: Set up php${{ steps.versions.outputs.php-min }}
34+
uses: shivammathur/setup-php@ccf2c627fe61b1b4d924adfcbd19d661a18133a0 # v2.35.2
35+
with:
36+
php-version: ${{ steps.versions.outputs.php-min }}
37+
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
38+
coverage: none
39+
ini-file: development
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Install dependencies
44+
run: |
45+
composer remove nextcloud/ocp --dev --no-scripts
46+
composer i
47+
48+
- name: Lint
49+
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: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Lint php
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
17+
jobs:
18+
matrix:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
php-versions: ${{ steps.versions.outputs.php-versions }}
22+
steps:
23+
- name: Checkout app
24+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
with:
26+
persist-credentials: false
27+
28+
- name: Get version matrix
29+
id: versions
30+
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
31+
32+
php-lint:
33+
runs-on: ubuntu-latest
34+
needs: matrix
35+
strategy:
36+
matrix:
37+
php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}}
38+
39+
name: php-lint
40+
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
44+
with:
45+
persist-credentials: false
46+
47+
- name: Set up php ${{ matrix.php-versions }}
48+
uses: shivammathur/setup-php@ccf2c627fe61b1b4d924adfcbd19d661a18133a0 # v2.35.2
49+
with:
50+
php-version: ${{ matrix.php-versions }}
51+
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
52+
coverage: none
53+
ini-file: development
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Lint
58+
run: composer run lint
59+
60+
summary:
61+
permissions:
62+
contents: none
63+
runs-on: ubuntu-latest
64+
needs: php-lint
65+
66+
if: always()
67+
68+
name: php-lint-summary
69+
70+
steps:
71+
- name: Summary status
72+
run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi

0 commit comments

Comments
 (0)