diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 17c1c6bd5..ebfb57b0e 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -1,16 +1,114 @@ -name: CI - on: push: branches: - - 'master' + - "master" pull_request: schedule: - - cron: '0 22 * * *' # run at 10 PM UTC + - cron: "0 22 * * *" # run at 10 PM UTC + +name: CI + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - builds: - uses: ./.github/workflows/shared_workflow.yml - secrets: inherit - with: - branch: master + api-tests: + name: API tests + strategy: + matrix: + nextcloudVersion: [stable28] + phpVersionMajor: [8] + phpVersionMinor: [1] + database: [mysql] + runs-on: ubuntu-22.04 + container: + image: ubuntu:22.04 + credentials: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + defaults: + run: + working-directory: integration_openproject + + services: + nextcloud: + image: ghcr.io/juliushaertl/nextcloud-dev-php${{ format('{0}{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }}:latest@sha256:60493edf2097ee2a148e98511c7e8a5b2714e451fafccb3184e0d0477efef5d0 + env: + SQL: ${{ matrix.database }} + SERVER_BRANCH: ${{ matrix.nextcloudVersion }} + NEXTCLOUD_AUTOINSTALL: "YES" + NEXTCLOUD_AUTOINSTALL_APPS: "viewer activity groupfolders integration_openproject" + NEXTCLOUD_TRUSTED_DOMAINS: nextcloud + VIRTUAL_HOST: "nextcloud" + WITH_REDIS: "NO" + NEXTCLOUD_AUTOINSTALL_APPS_WAIT_TIME: 120 + volumes: + - /home/runner/work/integration_openproject/integration_openproject:/var/www/html/apps-shared + + database-postgres: + image: postgres:14 + env: + POSTGRES_PASSWORD: postgres + POSTGRES_DB: nextcloud + credentials: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + database-mysql: + image: mariadb:10.5 + env: + MYSQL_ROOT_PASSWORD: "nextcloud" + MYSQL_PASSWORD: "nextcloud" + MYSQL_USER: "nextcloud" + MYSQL_DATABASE: "nextcloud" + credentials: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + path: integration_openproject + + - name: Checkout activity app + uses: actions/checkout@v3 + with: + repository: nextcloud/activity + path: activity + ref: ${{ matrix.nextcloudVersion }} + + - name: Checkout groupfolders app + uses: actions/checkout@v3 + with: + repository: nextcloud/groupfolders + path: groupfolders + ref: ${{ matrix.nextcloudVersion }} + + - name: Setup PHP ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }} + uses: shivammathur/setup-php@2.27.1 + with: + php-version: ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }} + tools: composer + extensions: intl + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache PHP dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/integration_openproject/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: API Tests + env: + NEXTCLOUD_BASE_URL: http://nextcloud + run: | + composer install --no-progress --prefer-dist --optimize-autoloader + until curl -s -f http://nextcloud/status.php | grep '"installed":true'; do echo .; sleep 10; done + make api-test diff --git a/.github/workflows/nighlty-ci-release-branch.yml b/.github/workflows/nighlty-ci-release-branch.yml index 3750d8272..979c176d0 100644 --- a/.github/workflows/nighlty-ci-release-branch.yml +++ b/.github/workflows/nighlty-ci-release-branch.yml @@ -1,12 +1,12 @@ -name: Nightly CI Release +# name: Nightly CI Release -on: - schedule: - - cron: '0 22 * * *' # run at 10 PM UTC +# on: +# schedule: +# - cron: '0 22 * * *' # run at 10 PM UTC -jobs: - builds: - uses: ./.github/workflows/shared_workflow.yml - secrets: inherit - with: - branch: release/2.4 +# jobs: +# builds: +# uses: ./.github/workflows/shared_workflow.yml +# secrets: inherit +# with: +# branch: release/2.4 diff --git a/.github/workflows/shared_workflow.yml b/.github/workflows/shared_workflow.yml index 57ded1d6e..547319a52 100644 --- a/.github/workflows/shared_workflow.yml +++ b/.github/workflows/shared_workflow.yml @@ -1,295 +1,122 @@ -on: - workflow_call: - inputs: - branch: - type: string - -name: CI - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - unittest-linting: - name: unit tests and linting - strategy: - matrix: - nextcloudVersion: [ stable25, stable26, stable27, stable28 ] - phpVersion: [ 7.4, 8.0, 8.1 ] - exclude: - - nextcloudVersion: stable26 - phpVersion: 7.4 - - nextcloudVersion: stable27 - phpVersion: 7.4 - - nextcloudVersion: stable28 - phpVersion: 7.4 - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ inputs.branch }} - - - name: Setup PHP ${{ matrix.phpVersion }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.phpVersion }} - tools: composer, phpunit - coverage: xdebug - extensions: gd, sqlite3 - - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache PHP dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Read package.json node and npm engines version - uses: skjnldsv/read-package-engines-version-actions@v2 - id: versions - with: - fallbackNode: '^14' - fallbackNpm: '^7' - - - name: Setup NodeJS ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@v3 - with: - node-version: ${{ steps.versions.outputs.nodeVersion }} - cache: 'npm' - - - name: Setup NPM ${{ steps.versions.outputs.npmVersion }} - run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" - - - name: Install PHP Dependencies - run: | - composer install --no-progress --prefer-dist --optimize-autoloader - git clone --depth 1 https://github.com/nextcloud/server.git -b ${{ matrix.nextcloudVersion }} - cd server && git submodule update --init - ./occ maintenance:install --admin-pass=admin - - - name: PHP code analysis - run: | - if [[ ${{ matrix.nextcloudVersion }} != "stable28" ]] - then - make phpstan - fi - - - name: PHP code style - run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 ) - - - name: Install NPM Dependencies - run: npm install - - - name: JS Lint - run: npm run lint - - - name: Style Lint - run: npm run stylelint - - - name: PHP & Vue Unit Tests - run: | - git clone --depth 1 https://github.com/nextcloud/groupfolders.git -b ${{ matrix.nextcloudVersion }} server/apps/groupfolders - mkdir -p server/apps/integration_openproject - cp -r `ls -A | grep -v 'server'` server/apps/integration_openproject/ - cd server - ./occ a:e groupfolders - ./occ a:e integration_openproject - cd apps/integration_openproject - make phpunit - make jsunit - - - name: JS Code Coverage Summary Report - if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable28' && matrix.phpVersion == '8.1' }} - uses: romeovs/lcov-reporter-action@v0.3.1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - lcov-file: ./server/apps/integration_openproject/coverage/jest/lcov.info - delete-old-comments: true - title: "JS Code Coverage" - - - name: Setup .NET Core # this is required to execute Convert PHP cobertura coverage to lcov step - if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable28' && matrix.phpVersion == '8.1' }} - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.101 - dotnet-quality: 'ga' - - - name: Convert PHP cobertura coverage to lcov - if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable28' && matrix.phpVersion == '8.1' }} - uses: danielpalme/ReportGenerator-GitHub-Action@5.1.23 - with: - reports: './server/apps/integration_openproject/coverage/php/cobertura.xml' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported. - targetdir: './server/apps/integration_openproject/coverage/php' # REQUIRED # The directory where the generated report should be saved. - reporttypes: 'lcov' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary - sourcedirs: '' # Optional directories which contain the corresponding source code (separated by semicolon). The source directories are used if coverage report contains classes without path information. - historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution. - plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon). - assemblyfilters: '+*' # Optional list of assemblies that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed. - classfilters: '+*' # Optional list of classes that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed. - filefilters: '+*' # Optional list of files that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed. - verbosity: 'Verbose' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off - title: '' # Optional title. - tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version. - customSettings: '' # Optional custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings. - toolpath: 'reportgeneratortool' # Default directory for installing the dotnet tool. - - - name: PHP Code Coverage Summary Report - if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable28' && matrix.phpVersion == '8.1' }} - uses: romeovs/lcov-reporter-action@v0.3.1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - lcov-file: ./server/apps/integration_openproject/coverage/php/lcov.info - delete-old-comments: true - title: "PHP Code Coverage" - - - name: JS coverage check - if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable28' && matrix.phpVersion == '8.1' }} - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - min_coverage: '59' - path: './server/apps/integration_openproject/coverage/jest/lcov.info' - - - name: PHP coverage check - if: ${{ github.event_name == 'pull_request' && matrix.nextcloudVersion == 'stable28' && matrix.phpVersion == '8.1' }} - uses: VeryGoodOpenSource/very_good_coverage@v2 - with: - min_coverage: '56' - path: './server/apps/integration_openproject/coverage/php/lcov.info' - - api-tests: - name: API tests - strategy: - matrix: - nextcloudVersion: [ stable25, stable26, stable27, stable28 ] - phpVersionMajor: [ 7, 8 ] - phpVersionMinor: [ 4, 1 ] - database: [pgsql, mysql] - exclude: - - nextcloudVersion: stable26 - phpVersionMajor: 7 - - phpVersionMajor: 7 - phpVersionMinor: 0 - - phpVersionMajor: 7 - phpVersionMinor: 1 - - phpVersionMajor: 8 - phpVersionMinor: 4 - - nextcloudVersion: stable27 - phpVersionMajor: 7 - - phpVersionMajor: 7 - phpVersionMinor: 0 - - phpVersionMajor: 7 - phpVersionMinor: 1 - - phpVersionMajor: 8 - phpVersionMinor: 4 - - nextcloudVersion: stable28 - phpVersionMajor: 7 - - phpVersionMajor: 7 - phpVersionMinor: 0 - - phpVersionMajor: 7 - phpVersionMinor: 1 - - phpVersionMajor: 8 - phpVersionMinor: 4 - runs-on: ubuntu-20.04 - container: - image: ubuntu:latest - credentials: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - defaults: - run: - working-directory: integration_openproject - - services: - nextcloud: - image: ghcr.io/juliushaertl/nextcloud-dev-php${{ format('{0}{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }}:latest - env: - SQL: ${{ matrix.database }} - SERVER_BRANCH: ${{ matrix.nextcloudVersion }} - NEXTCLOUD_AUTOINSTALL: "YES" - NEXTCLOUD_AUTOINSTALL_APPS: "viewer activity groupfolders integration_openproject" - NEXTCLOUD_TRUSTED_DOMAINS: nextcloud - VIRTUAL_HOST: "nextcloud" - WITH_REDIS: "YES" - NEXTCLOUD_AUTOINSTALL_APPS_WAIT_TIME: 120 - volumes: - - /home/runner/work/integration_openproject/integration_openproject:/var/www/html/apps-shared - - database-postgres: - image: postgres:14 - env: - POSTGRES_PASSWORD: postgres - POSTGRES_DB: nextcloud - credentials: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - database-mysql: - image: mariadb:10.5 - env: - MYSQL_ROOT_PASSWORD: 'nextcloud' - MYSQL_PASSWORD: 'nextcloud' - MYSQL_USER: 'nextcloud' - MYSQL_DATABASE: 'nextcloud' - credentials: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - redis: - image: redis:7 - credentials: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: integration_openproject - ref: ${{ inputs.branch }} - - - name: Checkout activity app - uses: actions/checkout@v3 - with: - repository: nextcloud/activity - path: activity - ref: ${{ matrix.nextcloudVersion }} - - - name: Checkout groupfolders app - uses: actions/checkout@v3 - with: - repository: nextcloud/groupfolders - path: groupfolders - ref: ${{ matrix.nextcloudVersion }} - - - name: Setup PHP ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }} - tools: composer - extensions: intl - - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache PHP dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/integration_openproject/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - - name: API Tests - env: - NEXTCLOUD_BASE_URL: http://nextcloud - run: | - composer install --no-progress --prefer-dist --optimize-autoloader - until curl -s -f http://nextcloud/status.php | grep '"installed":true'; do echo .; sleep 10; done - make api-test +# on: +# workflow_call: +# inputs: +# branch: +# type: string + +# name: CI + +# jobs: +# api-tests: +# name: API tests +# strategy: +# matrix: +# nextcloudVersion: [ stable28 ] +# phpVersionMajor: [ 8 ] +# phpVersionMinor: [ 1 ] +# database: [mysql] +# runs-on: ubuntu-20.04 +# container: +# image: ubuntu:latest +# credentials: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} + +# defaults: +# run: +# working-directory: integration_openproject + +# services: +# nextcloud: +# image: ghcr.io/juliushaertl/nextcloud-dev-php${{ format('{0}{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }}:latest +# env: +# SQL: ${{ matrix.database }} +# SERVER_BRANCH: ${{ matrix.nextcloudVersion }} +# NEXTCLOUD_AUTOINSTALL: "YES" +# NEXTCLOUD_AUTOINSTALL_APPS: "viewer activity groupfolders integration_openproject" +# NEXTCLOUD_TRUSTED_DOMAINS: nextcloud +# VIRTUAL_HOST: "nextcloud" +# WITH_REDIS: "YES" +# NEXTCLOUD_AUTOINSTALL_APPS_WAIT_TIME: 120 +# volumes: +# - /home/runner/work/integration_openproject/integration_openproject:/var/www/html/apps-shared + +# database-postgres: +# image: postgres:14 +# env: +# POSTGRES_PASSWORD: postgres +# POSTGRES_DB: nextcloud +# credentials: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} + +# database-mysql: +# image: mariadb:10.5 +# env: +# MYSQL_ROOT_PASSWORD: 'nextcloud' +# MYSQL_PASSWORD: 'nextcloud' +# MYSQL_USER: 'nextcloud' +# MYSQL_DATABASE: 'nextcloud' +# credentials: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} + +# redis: +# image: redis:7 +# credentials: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} + +# steps: +# - name: Checkout For nightly Branch +# if: github.event_name == 'schedule' +# uses: actions/checkout@v3 +# with: +# path: integration_openproject +# ref: ${{ inputs.branch }} + +# - name: Checkout +# if: github.event_name == 'pull_request' +# uses: actions/checkout@v3 +# with: +# path: integration_openproject + +# - name: Checkout activity app +# uses: actions/checkout@v3 +# with: +# repository: nextcloud/activity +# path: activity +# ref: ${{ matrix.nextcloudVersion }} + +# - name: Checkout groupfolders app +# uses: actions/checkout@v3 +# with: +# repository: nextcloud/groupfolders +# path: groupfolders +# ref: ${{ matrix.nextcloudVersion }} + +# - name: Setup PHP ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }} +# uses: shivammathur/setup-php@v2 +# with: +# php-version: ${{ format('{0}.{1}', matrix.phpVersionMajor,matrix.phpVersionMinor) }} +# tools: composer +# extensions: intl + +# - name: Get composer cache directory +# id: composer-cache +# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + +# - name: Cache PHP dependencies +# uses: actions/cache@v3 +# with: +# path: ${{ steps.composer-cache.outputs.dir }} +# key: ${{ runner.os }}-composer-${{ hashFiles('**/integration_openproject/composer.lock') }} +# restore-keys: ${{ runner.os }}-composer- + +# - name: API Tests +# env: +# NEXTCLOUD_BASE_URL: http://nextcloud +# run: | +# composer install --no-progress --prefer-dist --optimize-autoloader +# until curl -s -f http://nextcloud/status.php | grep '"installed":true'; do echo .; sleep 10; done +# make api-test diff --git a/composer.lock b/composer.lock index 839564d9c..23b4354f2 100644 --- a/composer.lock +++ b/composer.lock @@ -2021,7 +2021,7 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.4.1", + "version": "7.4.5", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", diff --git a/tests/acceptance/features/bootstrap/FeatureContext.php b/tests/acceptance/features/bootstrap/FeatureContext.php index 1c3840160..2dfb2d0d7 100644 --- a/tests/acceptance/features/bootstrap/FeatureContext.php +++ b/tests/acceptance/features/bootstrap/FeatureContext.php @@ -111,7 +111,6 @@ public function __construct( */ public function userHasBeenCreated(string $user, string $displayName = null):void { // delete the user if it exists - $this->theAdministratorDeletesTheUser($user); $userAttributes['userid'] = $user; $userAttributes['password'] = $this->getRegularUserPassword(); if ($displayName !== null) {