Commit b3c1be39 authored by Navneet Singh's avatar Navneet Singh Committed by Navneet Singh
Browse files

Merge pull request #2976 from goalgorilla/feature/3260861-php-8-support-updated-branch

Issue #3260861: Add support for PHP 8 and update OS to Drupal 9.3
parent 63cf7b1f
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -7,11 +7,11 @@ on:
  pull_request: { }

jobs:
  phpstan:
    name: PHPStan
  phpstan7:
    name: PHPStan on PHP 7.4
    runs-on: ubuntu-latest
    steps:
      - name: Set default PHP7.4
      - name: Set default php7.4
        run: sudo update-alternatives --set php /usr/bin/php7.4

      - name: Checkout code
@@ -27,7 +27,7 @@ jobs:
    name: PHPCS
    runs-on: ubuntu-latest
    steps:
      - name: Set default PHP7.4
      - name: Set default php7.4
        run: sudo update-alternatives --set php /usr/bin/php7.4

      - name: Checkout code
@@ -41,3 +41,19 @@ jobs:
        with:
          phpcs_bin_path: './vendor/bin/phpcs'
          enable_warnings: true

  phpstan8:
    name: PHPStan on PHP 8.0
    runs-on: ubuntu-latest
    steps:
      - name: Set default php8.0
        run: sudo update-alternatives --set php /usr/bin/php8.0

      - name: Checkout code
        uses: actions/checkout@v3

      - name: Install dependencies
        run: composer install --prefer-dist --no-progress

      - name: PHP Stan
        run: vendor/bin/phpstan analyse -c phpstan.neon
+46 −4
Original line number Diff line number Diff line
name: Testing
name: PHPUnit Testing

on:
  push:
@@ -7,12 +7,12 @@ on:
  pull_request: { }

jobs:
  phpcs:
    name: PHPUnit
  phpunit7:
    name: PHPUnit on PHP 7.4
    runs-on: ubuntu-latest
    steps:

      - name: Set default PHP7.4
      - name: Set default php7.4
        run: sudo update-alternatives --set php /usr/bin/php7.4

      # We checkout the code in a separate folder since we want to use the
@@ -54,3 +54,45 @@ jobs:
        run: $GITHUB_WORKSPACE/vendor/bin/phpunit -c $GITHUB_WORKSPACE/html/profiles/contrib/social/phpunit.xml.dist --log-junit $GITHUB_WORKSPACE/test-reports/phpunit.xml
        env:
          SIMPLETEST_DB: sqlite://tmp/db.sqlite

  phpunit8:
    name: PHPUnit on PHP 8.0
    runs-on: ubuntu-latest
    steps:

      - name: Set default php8.0
        run: sudo update-alternatives --set php /usr/bin/php8.0

      # We checkout the code in a separate folder since we want to use the
      # result of the merge rather than the pre-merged code.
      # A separate path is used to keep our working directory clean.
      - uses: actions/checkout@v3
        with:
          path: ${{ github.workspace }}/tmp/repository
          # Since composer must clone from this we require all the history.
          fetch-depth: 0

      # Create a branch for the specific commit so that composer can check it
      # out.
      - name: Composerify local checkout
        run: cd $GITHUB_WORKSPACE/tmp/repository && git checkout -b $GITHUB_SHA

      # Prepare our composer.json to do a full project set-up.
      - name: Project Setup
        run:  cp $GITHUB_WORKSPACE/tmp/repository/tests/composer.json composer.json

      # Set up composer with our desired PHP version.
      - name: Composer Config
        run: composer config repositories.social vcs $GITHUB_WORKSPACE/tmp/repository

      # Install the version of Open Social under test.
      - name: Composer Install
        run: composer require goalgorilla/open_social:dev-${{ github.sha }}#${{ github.sha }}

      - name: Set file permissions
        run: mkdir -p $GITHUB_WORKSPACE/sites/default/files && sudo chmod -R 664 $GITHUB_WORKSPACE/sites/default/files

      - name: PHPUnit
        run: $GITHUB_WORKSPACE/vendor/bin/phpunit -c $GITHUB_WORKSPACE/html/profiles/contrib/social/phpunit.xml.dist --log-junit $GITHUB_WORKSPACE/test-reports/phpunit.xml
        env:
          SIMPLETEST_DB: sqlite://tmp/db.sqlite
+13 −17
Original line number Diff line number Diff line
@@ -14,14 +14,12 @@ addons:
language: php

php:
  - 7.4
  - 8.0

env:
  global:
    # Travis Token.
    secure: "u6jLZiftQdb8Ozxngu5sgwmnXeUyvNF3/Y+5eX3+Xyb7Sm6K++cBLbYl/zNbuzp1rZE5dn3pVTQc4tstVXZw2B5KjCd64r9HE9gdwCEnS/AA/w3wGlaEBinTzKOrrN1EvqNNhnJUY2JmqEYVom+UYwLZWIIKM/5OoaeidNqHDvImZZLAeYfPMGnySsFC01yCzrOn6jv8Bwu00dQPVEOQylVEV5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CgED5OPNhh2veH9GrXlUcNzyO2+BI7kMQ8ipc+wy39Hw0xOu2JF40x4TVQuphc9flh/OQLDRludDY3aJd4="

matrix:
  fast_finish: true
@@ -48,8 +46,9 @@ before_install:
  - if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TEST_SUITE" = "accessibility" ]; then exit 0; fi
  - phpenv config-rm xdebug.ini
  # Lets set-up our helper repository with all the docker config and use correct version in composer.json.
  - if [ "$TEST_SUITE" != "install_update" ]; then git clone --branch 5.1.0 https://github.com/goalgorilla/drupal_social.git install; fi
  - if [ "$TEST_SUITE" = "install_update" ]; then git clone --branch 2.0.0 https://github.com/goalgorilla/drupal_social.git install; fi
  # @todo Change to next tagged version of drupal_social.
  - if [ "$TEST_SUITE" != "install_update" ]; then git clone --branch '5.2.0' https://github.com/goalgorilla/drupal_social.git install; fi
  - if [ "$TEST_SUITE" = "install_update" ]; then git clone --branch 'upgrade-path' https://github.com/goalgorilla/drupal_social.git install; fi
  - cd install
  - export PR=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
  - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
@@ -59,7 +58,7 @@ before_install:
  - composer config repositories.social git https://github.com/goalgorilla/open_social.git
  # Remove roave/security-advisories depdendency as it conflicts with drupal/core:~8.9.9 requirements in our update branch. See: https://github.com/Roave/SecurityAdvisories/commit/5bd8c4f672d819d073ca8de1922fdb6898d0df3a
  - if [ "$TEST_SUITE" = "install_update" ]; then composer remove roave/security-advisories --no-update; fi
  # 8.x-8.x-composer-update-to-10-branch has some composer breaking changes for scaffolding, we couldnt release but helps us with testing our update path.
  # 8.x-8.x-composer-update-to-10-branch has some composer breaking changes for scaffolding, we couldn't release but helps us with testing our update path.
  - if [ "$TEST_SUITE" = "install_update" ]; then composer require goalgorilla/open_social:dev-8.x-8.x-composer-update-to-10-branch --prefer-dist; fi
  # For Pull Requests that are not from Open Social's own repo we must overwrite the repository we set earlier so we can pull in the work done by the external contributor.
  - if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_PULL_REQUEST_SLUG" != "goalgorilla/open_social" ]; then composer config repositories.social git https://github.com/$TRAVIS_PULL_REQUEST_SLUG.git; fi
@@ -74,18 +73,18 @@ before_install:
install:
  - if [ "$TEST_SUITE" = "install_stability_1" ] || [ "$TEST_SUITE" = "install_stability_2" ] || [ "$TEST_SUITE" = "install_stability_3" ] || [ "$TEST_SUITE" = "install_stability_4" ]  || [ "$TEST_SUITE" = "install_stability_5" ]; then docker exec -i social_ci_web bash /var/www/scripts/social/install/install_script.sh --with-optional --localsettings; fi
  - if [ "$TEST_SUITE" = "install_without_optional" ]; then docker exec -i social_ci_web bash /var/www/scripts/social/install/install_script.sh --localsettings; fi
  # Install docker using the composer details from the 8.x-8.x branch of goalgorilla/open_social and 2.0.0 of goalgorilla/drupal_social
  # Install docker using the composer details from the 8.x-8.x branch of goalgorilla/open_social and 'upgrade-path' of goalgorilla/drupal_social
  - if [ "$TEST_SUITE" = "install_update" ]; then docker exec -i social_ci_web bash /var/www/scripts/social/install/install_script.sh; fi
  # Reset the entire branch, so we can checkout goalgorilla/drupal_social:5.0.0 and we dont get issues with dev dependencies from 8.x related Open Social versions.
  # Reset the entire branch, so we can checkout goalgorilla/drupal_social:5.1.0 and we dont get issues with dev dependencies from 8.x related Open Social versions.
  - if [ "$TEST_SUITE" = "install_update" ]; then git stash; rm -rf vendor/ composer.lock; fi
  - if [ "$TEST_SUITE" = "install_update" ]; then git checkout 5.0.0; fi
  - if [ "$TEST_SUITE" = "install_update" ]; then bash scripts/social/ci/restore-permissions.sh; fi
  # @todo Change to next tagged version of drupal_social.
  - if [ "$TEST_SUITE" = "install_update" ]; then git checkout 5.2.0; fi
  # Now install the feature branch on top to make sure we get all our goodies.
  - if [ "$TEST_SUITE" = "install_update" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then composer require goalgorilla/open_social:dev-${BRANCH}#${COMMIT} --update-with-all-dependencies; fi
  - if [ "$TEST_SUITE" = "install_update" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then composer require goalgorilla/open_social:${BRANCH}-dev#${COMMIT} --update-with-all-dependencies; fi
  - if [ "$TEST_SUITE" = "install_update" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then docker exec -i social_ci_web composer require goalgorilla/open_social:dev-${BRANCH}#${COMMIT} --update-with-all-dependencies; fi
  - if [ "$TEST_SUITE" = "install_update" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then docker exec -i social_ci_web composer require goalgorilla/open_social:${BRANCH}-dev#${COMMIT} --update-with-all-dependencies; fi
  # Update once and for all to the latest versions also within goalgorilla/drupal_social.
  - if [ "$TEST_SUITE" = "install_update" ]; then composer require drupal/social_search_autocomplete; composer update; fi
  - if [ "$TEST_SUITE" = "install_update" ]; then bash scripts/social/ci/restore-permissions.sh; fi
  - if [ "$TEST_SUITE" = "install_update" ]; then docker exec -i social_ci_web composer require drupal/social_search_autocomplete; fi
  - if [ "$TEST_SUITE" = "install_update" ]; then docker exec -i social_ci_web chown -R www-data:www-data vendor/ html/; fi
  # Run the update hooks to see if our update path still works with an almost reset code base from 8.x to 11.x
  - if [ "$TEST_SUITE" = "install_update" ]; then docker exec -i social_ci_web bash /var/www/scripts/social/install/update.sh; fi

@@ -99,6 +98,3 @@ script:
  - if [ "$TEST_SUITE" = "install_update" ]; then docker exec -it social_ci_behat sh /var/www/scripts/social/behatstability.sh "stability-1&&~DS-1136&&~DS-3605 --stop-on-failure --strict"; fi
  - if [ "$TEST_SUITE" = "install_without_optional" ]; then docker exec -it social_ci_behat sh /var/www/scripts/social/behatstability.sh "stability-1&&~DS-1136&&~DS-3605 --stop-on-failure --strict"; fi
  - if [ "$TEST_SUITE" = "accessibility" ]; then docker exec -it social_ci_web bash /var/www/scripts/social/check-accessibility.sh install; fi

after_success:
  - bash scripts/social/trigger_dockerhub.sh
+5 −5
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@
        }
    },
    "require": {
        "php": "^7.4",
        "php": "^7.4 || ^8.0",
        "bower-asset/lazysizes": "^5.3",
        "composer/installers": "~1.0 || ~2.0",
        "cweagans/composer-patches": "^1.6.0",
@@ -150,10 +150,10 @@
        "drupal/advancedqueue": "1.0.0-rc3",
        "drupal/ajax_comments": "1.0-beta4",
        "drupal/better_exposed_filters": "5.0.0",
        "drupal/block_field": "1.0-rc1",
        "drupal/block_field": "1.0-rc2",
        "drupal/config_update": "1.7",
        "drupal/core-recommended": "~9.3.12",
        "drupal/core-composer-scaffold": "~9.3.12",
        "drupal/core-recommended": "~9.3.15",
        "drupal/core-composer-scaffold": "~9.3.15",
        "drupal/crop": "2.2.0",
        "drupal/csv_serialization": "2.0",
        "drupal/ctools": "3.7",
@@ -223,7 +223,7 @@
    },
    "require-dev": {
        "drupal/coder": "^8.3",
        "drupal/core-dev": "~9.3.12",
        "drupal/core-dev": "~9.3.15",
        "drupal/devel": "^4.1",
        "dealerdirect/phpcodesniffer-composer-installer": "~0.7.1",
        "phpstan/phpstan": "1.7.1",
+1 −1
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ function improved_theme_settings_get_setting($setting, $themename) {
  // Fetch setting from the theme.
  $themevar = Xss::filter(theme_get_setting($setting, $themename));
  // In this case '' is something different than 0.
  if ($themevar !== trim((int) $themevar)) {
  if (is_numeric($themevar)) {
    return FALSE;
  }
  return $themevar;
Loading