Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Integration tests

on:
pull_request:
push:
branches:
- main
- master
- stable*

Expand All @@ -25,7 +28,7 @@ jobs:

services:
postgres:
image: postgres
image: postgres:14
ports:
- 4445:5432/tcp
env:
Expand All @@ -34,7 +37,7 @@ jobs:
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
mysql:
image: mariadb:10.5
image: mariadb:10.6
ports:
- 4444:3306/tcp
env:
Expand All @@ -43,20 +46,14 @@ jobs:

steps:
- name: Checkout server
uses: actions/checkout@v2.3.4
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}

- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
submodules: recursive

- name: Checkout app
uses: actions/checkout@v2.3.4
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: apps/${{ env.APP_NAME }}

Expand All @@ -67,11 +64,11 @@ jobs:
working-directory: apps/${{ env.APP_NAME }}/tests/

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: zip, gd, mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, mysql, pdo_mysql, pgsql, pdo_pgsql,
extensions: zip, gd, mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, mysql, pdo_mysql, pgsql, pdo_pgsql
coverage: none

- name: Set up PHPUnit
Expand All @@ -87,11 +84,12 @@ jobs:
fi
mkdir data
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
cat config/config.php
./occ user:list
./occ app:enable --force ${{ env.APP_NAME }}
./occ config:system:set allow_local_remote_servers --value true --type bool
./occ user_oidc:provider nextcloudci -c nextcloud -s ff75b7c7-20f9-460b-b27c-16bd5d9b4cd0 -d http:/127.0.0.1:8999/auth/realms/nextcloudci/.well-known/openid-configuration
./occ config:system:set debug --value true --type bool
cat config/config.php
./occ user_oidc:provider nextcloudci -c nextcloud -s ff75b7c7-20f9-460b-b27c-16bd5d9b4cd0 -d http://127.0.0.1:8999/auth/realms/nextcloudci/.well-known/openid-configuration
php -S localhost:8080 &
curl -v http://127.0.0.1:8999/auth/realms/nextcloudci/.well-known/openid-configuration

Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: Static analysis

on: pull_request

concurrency:
group: psalm-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
static-analysis:
runs-on: ubuntu-latest

name: static-psalm-analysis
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Set up php7.4
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
with:
php-version: 7.4
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: composer i

- name: Run coding standards check
run: composer run psalm
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
"bamarni/composer-bin-plugin": true
},
"platform": {
"php": "7.3"
"php": "7.4"
}
},
"scripts": {
"cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"lint": "find . -name \\*.php -not -path './vendor/*' -exec php -l \"{}\" \\;",
"psalm": "psalm.phar --no-cache",
"psalm:update-baseline": "psalm.phar --threads=1 --update-baseline",
"psalm:update-baseline:force": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",
"test:unit": "phpunit -c tests/phpunit.xml",
"post-install-cmd": [
"@composer bin all install --ansi",
Expand All @@ -36,7 +39,9 @@
"require-dev": {
"nextcloud/coding-standard": "^1.0.0",
"symfony/event-dispatcher": "^4",
"phpunit/phpunit": "^9.6"
"phpunit/phpunit": "^9.6",
"nextcloud/ocp": "dev-stable20",
"psalm/phar": "5.26"
},
"extra": {
"mozart": {
Expand Down
86 changes: 81 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/Command/DeleteProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
namespace OCA\UserOIDC\Command;

use Exception;
use OCP\AppFramework\Db\DoesNotExistException;
use \Symfony\Component\Console\Command\Command;

use OCA\UserOIDC\Db\ProviderMapper;
use OCA\UserOIDC\Service\ProviderService;

use OCP\AppFramework\Db\DoesNotExistException;
use Symfony\Component\Console\Command\Command;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down
8 changes: 4 additions & 4 deletions lib/Command/UpsertProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

namespace OCA\UserOIDC\Command;

use OCA\UserOIDC\Db\ProviderMapper;
use OCA\UserOIDC\Service\ProviderService;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use \Symfony\Component\Console\Command\Command;
use OCA\UserOIDC\Db\ProviderMapper;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class UpsertProvider extends Command {
Expand Down Expand Up @@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
// invalidate JWKS cache (even if it was just created)
$this->providerService->setSetting($provider->getId(), ProviderService::SETTING_JWKS_CACHE, '');
$this->providerService->setSetting($provider->getId(), ProviderService::SETTING_JWKS_CACHE_TIMESTAMP, '');
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
$output->writeln('<error>' . $e->getMessage() . '</error>');
return -1;
}
Expand Down
Loading
Loading