Skip to content

Commit 04035d7

Browse files
authored
Merge pull request #2002 from SchBenedikt/pr-to-nextcloud/social
🥳New Social App
2 parents 6f8a3d4 + d9d4d98 commit 04035d7

216 files changed

Lines changed: 22840 additions & 31792 deletions

File tree

Some content is hidden

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

.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,12 @@ module.exports = {
88
],
99
globals: {
1010
appName: true,
11+
__webpack_nonce__: 'writable',
12+
__webpack_public_path__: 'writable',
13+
},
14+
rules: {
15+
'vue/no-multiple-template-root': 'off',
16+
'camelcase': ['error', { properties: 'never', ignoreDestructuring: true, allow: ['__webpack_nonce__', '__webpack_public_path__'] }],
17+
'no-console': 'warn',
1118
},
1219
}

.github/ISSUE_TEMPLATE/Bug_report.md.license

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/Feature_request.md.license

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/pull_request_template.md.license

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/appstore-build-publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@
88

99
name: Build and publish app release
1010

11+
permissions:
12+
contents: read
13+
1114
on:
1215
release:
1316
types: [published]
1417

1518
jobs:
1619
build_and_publish:
20+
permissions:
21+
contents: write
1722
runs-on: ubuntu-latest
1823

1924
# Only allowed to be run on nextcloud-releases repositories

.github/workflows/cypress.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
name: Cypress
1010

11+
permissions:
12+
contents: read
13+
1114
on: pull_request
1215

1316
concurrency:
@@ -30,51 +33,63 @@ jobs:
3033
outputs:
3134
nodeVersion: ${{ steps.versions.outputs.nodeVersion }}
3235
npmVersion: ${{ steps.versions.outputs.npmVersion }}
36+
isFork: ${{ steps.fork_check.outputs.isFork }}
3337

3438
env:
3539
PUPPETEER_SKIP_DOWNLOAD: true
3640

3741
steps:
38-
- name: Disabled on forks
39-
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
42+
- name: Fork check
43+
id: fork_check
4044
run: |
41-
echo 'Can not run cypress on forks'
42-
exit 1
45+
if [[ '${{ github.event.pull_request.head.repo.full_name }}' != '${{ github.repository }}' ]]; then
46+
echo 'Can not run cypress on forks'
47+
echo "isFork=true" >> $GITHUB_OUTPUT
48+
else
49+
echo "isFork=false" >> $GITHUB_OUTPUT
50+
fi
4351
4452
- name: Checkout app
53+
if: steps.fork_check.outputs.isFork != 'true'
4554
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
4655

4756
- name: Check composer.json
57+
if: steps.fork_check.outputs.isFork != 'true'
4858
id: check_composer
4959
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
5060
with:
5161
files: "composer.json"
5262

5363
- name: Install composer dependencies
54-
if: steps.check_composer.outputs.files_exists == 'true'
64+
if: steps.fork_check.outputs.isFork != 'true' && steps.check_composer.outputs.files_exists == 'true'
5565
run: composer install --no-dev
5666

5767
- name: Read package.json node and npm engines version
68+
if: steps.fork_check.outputs.isFork != 'true'
5869
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
5970
id: versions
6071
with:
6172
fallbackNode: "^20"
6273
fallbackNpm: "^10"
6374

6475
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
76+
if: steps.fork_check.outputs.isFork != 'true'
6577
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
6678
with:
6779
node-version: ${{ steps.versions.outputs.nodeVersion }}
6880

6981
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
82+
if: steps.fork_check.outputs.isFork != 'true'
7083
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
7184

7285
- name: Install node dependencies & build app
86+
if: steps.fork_check.outputs.isFork != 'true'
7387
run: |
7488
npm ci
7589
TESTING=true npm run build --if-present
7690
7791
- name: Save context
92+
if: steps.fork_check.outputs.isFork != 'true'
7893
uses: buildjet/cache/save@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
7994
with:
8095
key: cypress-context-${{ github.run_id }}
@@ -83,6 +98,7 @@ jobs:
8398
cypress:
8499
runs-on: ubuntu-latest
85100
needs: init
101+
if: needs.init.outputs.isFork != 'true'
86102

87103
strategy:
88104
fail-fast: false
@@ -160,5 +176,5 @@ jobs:
160176

161177
steps:
162178
- name: Summary status
163-
run: if ${{ needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi
179+
run: if ${{ needs.init.result == 'success' && needs.cypress.result != 'success' && needs.cypress.result != 'skipped' }}; then exit 1; fi
164180

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ jobs:
4545
run: composer i
4646

4747
- name: Lint
48+
env:
49+
PHP_CS_FIXER_IGNORE_ENV: 1
4850
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.github/workflows/npm-audit-fix.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
name: Npm audit fix and compile
1010

11+
permissions:
12+
contents: read
13+
1114
on:
1215
workflow_dispatch:
1316
schedule:

.github/workflows/phpunit-mysql.yml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,35 +97,49 @@ jobs:
9797
with:
9898
path: apps/${{ env.APP_NAME }}
9999

100+
- name: Check PHP version requirement
101+
id: php_check
102+
run: |
103+
PHP_MIN=$(grep -oP 'php min-version="\K[^"]+' apps/${{ env.APP_NAME }}/appinfo/info.xml)
104+
echo "App requires PHP >= $PHP_MIN, current is ${{ matrix.php-versions }}"
105+
if php -r "exit(version_compare('${{ matrix.php-versions }}', '$PHP_MIN') < 0 ? 1 : 0);"; then
106+
echo "PHP version ${{ matrix.php-versions }} meets minimum requirement $PHP_MIN"
107+
else
108+
echo "PHP version ${{ matrix.php-versions }} is below minimum $PHP_MIN, skipping"
109+
echo "skip=true" >> $GITHUB_OUTPUT
110+
fi
111+
100112
- name: Set up php ${{ matrix.php-versions }}
113+
if: steps.php_check.outputs.skip != 'true'
101114
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
102115
with:
103116
php-version: ${{ matrix.php-versions }}
104-
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
105117
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
106118
coverage: none
107119
ini-file: development
108120
env:
109121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110122

111123
- name: Enable ONLY_FULL_GROUP_BY MySQL option
124+
if: steps.php_check.outputs.skip != 'true'
112125
run: |
113126
echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
114127
echo 'SELECT @@sql_mode;' | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
115128
116129
- name: Check composer file existence
130+
if: steps.php_check.outputs.skip != 'true'
117131
id: check_composer
118132
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
119133
with:
120134
files: apps/${{ env.APP_NAME }}/composer.json
121135

122136
- name: Set up dependencies
123-
# Only run if phpunit config file exists
124-
if: steps.check_composer.outputs.files_exists == 'true'
137+
if: steps.php_check.outputs.skip != 'true' && steps.check_composer.outputs.files_exists == 'true'
125138
working-directory: apps/${{ env.APP_NAME }}
126139
run: composer i
127140

128141
- name: Set up Nextcloud
142+
if: steps.php_check.outputs.skip != 'true'
129143
env:
130144
DB_PORT: 4444
131145
run: |
@@ -134,47 +148,44 @@ jobs:
134148
./occ app:enable --force ${{ env.APP_NAME }}
135149
136150
- name: Check PHPUnit script is defined
151+
if: steps.php_check.outputs.skip != 'true'
137152
id: check_phpunit
138153
continue-on-error: true
139154
working-directory: apps/${{ env.APP_NAME }}
140155
run: |
141156
composer run --list | grep '^ test:unit ' | wc -l | grep 1
142157
143158
- name: PHPUnit
144-
# Only run if phpunit config file exists
145-
if: steps.check_phpunit.outcome == 'success'
159+
if: steps.php_check.outputs.skip != 'true' && steps.check_phpunit.outcome == 'success'
146160
working-directory: apps/${{ env.APP_NAME }}
147161
run: composer run test:unit
148162

149163
- name: Check PHPUnit integration script is defined
164+
if: steps.php_check.outputs.skip != 'true'
150165
id: check_integration
151166
continue-on-error: true
152167
working-directory: apps/${{ env.APP_NAME }}
153168
run: |
154169
composer run --list | grep '^ test:integration ' | wc -l | grep 1
155170
156171
- name: Run Nextcloud
157-
# Only run if phpunit integration config file exists
158-
if: steps.check_integration.outcome == 'success'
172+
if: steps.php_check.outputs.skip != 'true' && steps.check_integration.outcome == 'success'
159173
run: php -S localhost:8080 &
160174

161175
- name: PHPUnit integration
162-
# Only run if phpunit integration config file exists
163-
if: steps.check_integration.outcome == 'success'
176+
if: steps.php_check.outputs.skip != 'true' && steps.check_integration.outcome == 'success'
164177
working-directory: apps/${{ env.APP_NAME }}
165178
run: composer run test:integration
166179

167180
- name: Print logs
168-
if: always()
181+
if: steps.php_check.outputs.skip != 'true'
169182
run: |
170183
cat data/nextcloud.log
171184
172-
- name: Skipped
173-
# Fail the action when neither unit nor integration tests ran
174-
if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
185+
- name: Skipped notification
186+
if: steps.php_check.outputs.skip == 'true'
175187
run: |
176-
echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
177-
exit 1
188+
echo "PHP version ${{ matrix.php-versions }} is below app minimum, skipping"
178189
179190
summary:
180191
permissions:
@@ -188,4 +199,4 @@ jobs:
188199

189200
steps:
190201
- name: Summary status
191-
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
202+
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' && needs.phpunit-mysql.result != 'skipped' }}; then exit 1; fi

.github/workflows/psalm.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
name: Static analysis
1010

11+
permissions:
12+
contents: read
13+
1114
on: pull_request
1215

1316
concurrency:
@@ -23,14 +26,10 @@ jobs:
2326
- name: Checkout
2427
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2528

26-
- name: Get php version
27-
id: versions
28-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
29-
30-
- name: Set up php${{ steps.versions.outputs.php-available }}
29+
- name: Set up php8.3
3130
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
3231
with:
33-
php-version: ${{ steps.versions.outputs.php-available }}
32+
php-version: 8.3
3433
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
3534
coverage: none
3635
ini-file: development
@@ -40,5 +39,11 @@ jobs:
4039
- name: Install dependencies
4140
run: composer i
4241

43-
- name: Run coding standards check
44-
run: composer run psalm
42+
- name: Patch friendica/json-ld for PHP 8.4+ compatibility
43+
run: |
44+
sed -i 's/foreach (\$http_response_header as/foreach (\$http_response_header ?? [] as/g' vendor/friendica/json-ld/jsonld.php
45+
46+
- name: Run Psalm static analysis
47+
run: |
48+
php vendor/bin/psalm --threads=1 --update-baseline || true
49+
echo "Psalm completed. If baseline changed, commit the updated tests/psalm-baseline.xml."

0 commit comments

Comments
 (0)