Commit da5179f0 authored by Nejc Koporec's avatar Nejc Koporec Committed by Jakob P
Browse files

Issue #3285930 by japerry, nkoporec: Automated Drupal 10 compatibility fixes

parent 8f18923b
Loading
Loading
Loading
Loading

.acquia/Dockerfile.ci

0 → 100644
+108 −0
Original line number Diff line number Diff line
# Example Acquia CI configuration.
#
# The configuration files in the .acquia directory will cover ORCA integration for most packages almost
# without modification. Use as follows:
#
# 1. Copy the .acquia directory to your package root:
#
#    $ cp -R example/.acquia ../my_package/.acquia
#
# 2. Change the ENV values for your package. No other changes are
#    strictly necessary for a basic integration.
#
# 3. Review the other comments in the file for additional configuration options.
#
# 4. Strip the (now unnecessary) comments:
#
#    $ sed -i'.bak' -e '/^[[:blank:]]*#/d;s/#.*//' Dockerfile.ci && rm Dockerfile.ci.bak
#
# 5. Make necessary changes in /my_package/.acquia/pipeline.yaml
#
# For advanced needs,
# @see https://github.com/acquia/orca/blob/main/docs/advanced-usage.md

# This is a PHP's official Debian buster-based Docker image.
# The image is build from https://github.com/acquia/devops-orca-container
ARG BASE_IMAGE=devops-orca-container:latest

# Jfrog is used by default in REPO_LOCATION
# Solving dockerhub rate limiting and improving security scanning
ARG REPO_LOCATION

# Specify the version of ORCA to use. Use dev-master to track the latest
# release, dev-develop to track Dev/HEAD, or any other Composer version
# string.
# @see https://getcomposer.org/doc/articles/versions.md
ARG ORCA_VERSION=~3.22.2

FROM ${REPO_LOCATION}${BASE_IMAGE}

ENV CI=true
ENV CHROMEDRIVER_VERSION 93.0.4577.63
ENV CHROMEDRIVER_DIR /chromedriver
ENV DEBIAN_FRONTEND=noninteractive
#Set the working directory, usually acquia/project_name
# @todo change to your repo name!
ENV CI_WORKSPACE=/acquia/acquia_lift
# Provide your package's name.
# @todo change to your package name!
ENV ORCA_SUT_NAME=drupal/acquia_lift
# Specify the name of the nearest Git version branch, e.g., 1.x or 8.x-1.x.
# This may be the destination branch of a pull request or the nearest
# ancestor of a topic branch.
# @todo change to your branch!
ENV ORCA_SUT_BRANCH=8.x-3.x

# If you want to completely replace the list of packages ORCA installs in
# fixtures and runs tests on, you can specify your own packages file at
# runtime by uncommenting the following line. Acceptable values are any
# valid path to a YAML file relative to ORCA itself, e.g.,
# ../example/tests/packages.yml.
#
# @see https://github.com/acquia/orca/blob/develop/config/packages.yml
# ENV ORCA_PACKAGES_CONFIG=../orca/example/tests/packages.yml
#
# If your package isn't in in ORCA's packages.yml or conflicts with details
# that are, you can modify the active packages configuration at runtime by
# uncommenting the following line and specifying your own alter file.
# @see https://github.com/acquia/orca/blob/master/docs/advanced-usage.md#ORCA_PACKAGES_CONFIG_ALTER
# @todo remove, or point to your own to register your pacakge.
ENV ORCA_PACKAGES_CONFIG_ALTER=../acquia_lift/.acquia/packages_alter.yaml
#
# If your package is a Drupal installation profile, uncomment the following
# line and specify its machine name.
# @see https://github.com/acquia/orca/blob/master/docs/advanced-usage.md#ORCA_FIXTURE_PROFILE
# ENV ORCA_FIXTURE_PROFILE=example
#
# If your package is a Composer project template or requires a different
# one to test with, uncomment the following line and specify its Packagist
# name. This is recommended if your package is not meant to support Acquia
# CMS, which is included in acquia/drupal-recommended-project.
# @see https://github.com/acquia/orca/blob/main/docs/advanced-usage.md#ORCA_FIXTURE_PROJECT_TEMPLATE
# @see https://github.com/acquia/orca/blob/main/docs/faq.md#why-do-i-get-version-conflicts-with-drupalacquia_cms
# ENV ORCA_FIXTURE_PROJECT_TEMPLATE=acquia/drupal-minimal-project
#
# Change the PHP Code Sniffer standard used for static analysis. Acceptable
# values are "AcquiaPHP", "AcquiaDrupalStrict", and
# "AcquiaDrupalTransitional". Defaults to "AcquiaDrupalTransitional".
# @see https://github.com/acquia/orca/blob/main/docs/advanced-usage.md#ORCA_PHPCS_STANDARD
# ENV ORCA_PHPCS_STANDARD=AcquiaDrupalTransitional
#
# Enable Nightwatch.js testing. Acceptable values are "TRUE" and "FALSE".
# ENV ORCA_ENABLE_NIGHTWATCH=TRUE
#
# To enable telemetry with Amplitude on cron runs, uncomment the following
# line and set ORCA_AMPLITUDE_API_KEY in your Travis CI repository settings:
# @see https://github.com/acquia/orca/blob/main/docs/advanced-usage.md#ORCA_TELEMETRY_ENABLE
# @see https://github.com/acquia/orca/blob/main/docs/advanced-usage.md#ORCA_AMPLITUDE_API_KEY
# ENV ORCA_TELEMETRY_ENABLE=TRUE

# Increase PHP memory limit to avoid memory exhausted issue during site install.
RUN echo 'memory_limit = 2048M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini

#
# Set Working Directory.
#
WORKDIR $CI_WORKSPACE

COPY . ./
+26 −0
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Script to fix paths in the clover coverage and JUnit files.
 */

declare(strict_types=1);

$file = $argv[1] ?? '';
if ($file === '') {
  print 'Must provide a file path.' . PHP_EOL;
  exit(1);
}
if (!file_exists($file)) {
  print sprintf('File does not exist at %s.', $file) . PHP_EOL;
  exit(1);
}

$content = file_get_contents($file);
if ($content === FALSE) {
  print sprintf('Could not read file at %s.', $file) . PHP_EOL;
  exit(1);
}
$content = str_replace('/ramfs', '', $content);
file_put_contents($file, $content);
+1 −0
Original line number Diff line number Diff line
drupal/acquia_lift: []

.acquia/pipeline.yaml

0 → 100644
+226 −0
Original line number Diff line number Diff line
# Example Acquia CI configuration.
#
# The configuration files in the .acquia directory will cover ORCA integration for most packages almost
# without modification. Use as follows:
#
# 1. Copy the .acquia directory to your package root:
#
#    $ cp -R example/.acquia ../my_package/.acquia
#
# 2. Change the team and service values for your package and change environment_image.build_args.secrets as necessary.
#    No other changes are strictly necessary for a basic integration.
#
# 3. Review the other comments in the file for additional configuration options.
#
# 4. Strip the (now unnecessary) comments:
#
#    $ sed -i'.bak' -e '/^[[:blank:]]*#/d;s/#.*//' pipeline.yaml && rm pipeline.yaml.bak
#
# 5. Make necessary changes in /my_package/.acquia/Dockerfile.ci
#
# For advanced needs,
# @see https://github.com/acquia/orca/blob/main/docs/advanced-usage.md

---
type: default
team: dit
group: drupal-cloud
service: acquia_lift

# The environment container image is used to prepare code versions
# and tooling for tests during pre, post and build stages.
environment_image:
  file: ".acquia/Dockerfile.ci"
  context: "."
  build_args:
    - secrets:
        - type: vault
          key: SSH_KEY
          value: GIT_SSH_KEY
          path: secret/pipeline-default/GIT_SSH_KEY

_orca_steps: &orca_steps
  steps:
    # The following operations should happen on the RAM disk:
    # 1. All PHP code that gets executed during tests. (Because most PHP
    #    code will only be executed once, making PHP's built-in OPCache
    #    ineffective. Acquia CI does not handle massive disk I/O
    #    concurrency well, and that is exactly what happens when executing
    #    multiple test jobs each testing a PHP application with many files
    #    on disk: just Drupal core alone already requires a significant
    #    number of files to be read from disk.
    # 2. SQLite database. The SQLite database lives on disk. Executing
    #    Drupal test suites tends to trigger many database queries, which
    #    in turn result in disk I/O.
    #    When not paying attention to these points, ORCA test suites can
    #    easily be significantly slower on Acquia CI than on TravisCI
    #    (which has a different disk I/O model). But when taken into
    #    account, ORCA on Acquia CI tends to *FAST*!
    #    If you were to run out of space on the RAM disk, simply file a
    #    DEVOPS ticket to bump the memory limit for your project; they will
    #    provision you more.
    # @see https://docs.docker.com/storage/tmpfs/
    # @see https://github.com/acquia/devops-pipeline/pull/275
    - setup_ramfs:
      - cp -ar /acquia /ramfs  &&  df -hT
    - before_install:
      - cd /ramfs${CI_WORKSPACE}
      - ../orca/bin/ci/before_install.sh
    - |
      cd /ramfs${CI_WORKSPACE}
      # Switch to PHP8. The version will depend on the version(s) installed in your Dockerfile.
      # The template provides version 8.0.
      if [ "$JENKINS_PHP_VERSION" = 8.0 ]; then
        update-alternatives --install /usr/local/bin/php php /usr/bin/php8.0 80
        php -v
      fi
    # Create the test fixture and place the SUT.
    - install:
      - cd /ramfs${CI_WORKSPACE}
      - ../orca/bin/ci/install.sh

    # TODO: We need ORCA patch to do this when it requires acquia/blt or just always.
    - |
      cd /ramfs${CI_WORKSPACE}
      [ -d "../orca-build" ] && composer config allow-plugins true --working-dir=../orca-build -n || exit 0

    # TODO: Remove after https://backlog.acquia.com/browse/ORCA-353
      #|
      #cd /ramfs${CI_WORKSPACE}
      #if [ -d "../orca-build" ]; then
      #  composer require drupal/media_acquiadam:^2.0 drupal/token:^1.10 --working-dir=../orca-build
      #fi
    # Display details about the fixture.
    - before_script:
      - cd /ramfs${CI_WORKSPACE}
      - ../orca/bin/ci/before_script.sh
    # Run the test script.
    - script:
      - cd /ramfs${CI_WORKSPACE}
      - ../orca/bin/ci/script.sh
    - |
      if [ "$ORCA_COVERAGE_ENABLE" = true ]; then
        cd /ramfs${CI_WORKSPACE}
        php .acquia/fixup-xml-paths.php /acquia/acquia_lift/clover.xml
        php .acquia/fixup-xml-paths.php /acquia/acquia_lift/junit.xml
      fi
    # DEBUG: when disk I/O-constrained, this output will prove invaluable.
    #-
      #- df -hT && du -sh /ramfs
      #- find / -type f -mmin -15 | grep -v '^/sys' | grep -v '^/proc' | grep -v '^/usr' | grep -v '^/var/cache' | grep -v '^/var/lib' | grep -v '^/ramfs'
_orca_job: &orca_job
  <<: *orca_steps
_orca_job_allow_failures: &orca_job_allow_failures
  - ignore_failures: true
    <<: *orca_steps
# -- Continuous Integration --
# Pre-build runs after building the environment image, and relies on it to
# run its sub-stages' steps inside of the environment container.
pre_build:
  static_code_analysis:
    - args: --env ORCA_JOB=STATIC_CODE_ANALYSIS
      <<: *orca_job
  integrated_test_on_oldest_supported:
    - args: --env ORCA_JOB=INTEGRATED_TEST_ON_OLDEST_SUPPORTED
      <<: *orca_job
  integrated_test_on_latest_lts:
    - args: --env ORCA_JOB=INTEGRATED_TEST_ON_LATEST_LTS
      <<: *orca_job
  integrated_test_on_prev_minor:
    - args: --env ORCA_JOB=INTEGRATED_TEST_ON_PREVIOUS_MINOR
      <<: *orca_job
  integrated_test_from_prev_minor:
    - args: --env ORCA_JOB=INTEGRATED_UPGRADE_TEST_FROM_PREVIOUS_MINOR
      <<: *orca_job
  isolated_test_on_current:
    - args: --env ORCA_JOB=ISOLATED_TEST_ON_CURRENT --env ORCA_COVERAGE_ENABLE=true --env ORCA_COVERAGE_CLOVER=/acquia/acquia_lift/clover.xml --env ORCA_JUNIT_LOG=/acquia/acquia_lift/junit.xml
      ca_data: /acquia
      <<: *orca_job
  integrated_test_on_current:
    - args: --env ORCA_JOB=INTEGRATED_TEST_ON_CURRENT
      <<: *orca_job
  integrated_test_to_next_minor:
    - args: --env ORCA_JOB=INTEGRATED_UPGRADE_TEST_TO_NEXT_MINOR
      <<: *orca_job
  integrated_test_to_next_minor_dev:
    - args: --env ORCA_JOB=INTEGRATED_UPGRADE_TEST_TO_NEXT_MINOR_DEV
      <<: *orca_job
  isolated_test_on_current_dev:
    - args: --env ORCA_JOB=ISOLATED_TEST_ON_CURRENT_DEV
      <<: *orca_job
  integrated_test_on_current_dev:
    - args: --env ORCA_JOB=INTEGRATED_TEST_ON_CURRENT_DEV
      <<: *orca_job
  strict_deprecated_code_scan:
    - args: --env ORCA_JOB=STRICT_DEPRECATED_CODE_SCAN
      <<: *orca_job
  isolated_test_on_next_minor:
    - args: --env ORCA_JOB=ISOLATED_TEST_ON_NEXT_MINOR
      <<: *orca_job
  isolated_test_on_next_minor_dev:
    - args: --env ORCA_JOB=ISOLATED_TEST_ON_NEXT_MINOR_DEV
      <<: *orca_job
  integrated_test_on_next_minor:
    - args: --env ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR
      <<: *orca_job
  integrated_test_on_next_minor_dev:
    - args: --env ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR_DEV
      <<: *orca_job
  isolated_test_on_current_php8:
    - args: --env ORCA_JOB=ISOLATED_TEST_ON_CURRENT --env JENKINS_PHP_VERSION=8.0
      <<: *orca_job
  deprecated_code_scan_with_contrib:
    - args: --env ORCA_JOB=DEPRECATED_CODE_SCAN_W_CONTRIB
      <<: *orca_job
  loose_deprecated_code_scan:
    - args: --env ORCA_JOB=LOOSE_DEPRECATED_CODE_SCAN
      <<: *orca_job
  # Uncomment the following four jobs to enable the corresponding tests once
  # the next major version of Drupal core has an alpha release or earlier.
  # Until then it's wasteful to use CI jobs on them, even if they exit early.
  # isolated_test_on_next_major_latest_minor_beta_later
  #   - args: --env ORCA_JOB=ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER
  #     <<: *orca_job
  # integrated_test_on_next_major_latest_minor_beta_later
  #   - args: --env ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER
  #     <<: *orca_job
  # isolated_test_on_next_major_latest_minor_dev
  #   - args: --env ORCA_JOB=ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV
  #     <<: *orca_job
  # integrated_test_on_next_major_latest_minor_dev
  #   - args: --env ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV
  #     <<: *orca_job
  isolated_upgrade_test_to_next_major_dev:
    - args: --env ORCA_JOB=ISOLATED_UPGRADE_TEST_TO_NEXT_MAJOR_DEV
      <<: *orca_job
  isolated_upgrade_test_to_next_major_beta_later:
    - args: --env ORCA_JOB=ISOLATED_UPGRADE_TEST_TO_NEXT_MAJOR_BETA_OR_LATER
      <<: *orca_job

  # Jobs using Nightwatch tests MUST specify `--shm-size=2g`.
  # @see https://stackoverflow.com/a/68557764
  # a_job_using_nightwatch_tests:
  #   - args: --env ORCA_JOB=SOMETHING --env ORCA_ENABLE_NIGHTWATCH=TRUE --shm-size=2g
  #     <<: *orca_job

# -- VeraCode automated security scanning --
# Set 'required' to true to enable code security analysis
  security_composition_analysis:
    required: false

# -- SonarQube automated reporting to https://sonarqube.ais.acquia.io --
# Set the project_key and 'required' to true to enable SonarQube analysis
  code_analysis:
    required: false
    project_key: acquia.drupal-cloud.acquia_lift:acquia_lift

# -- Slack Bot Integration --
# Set your_team_channel name
# notify:
#   channel: your_team_channel
#   on_success: change
#   on_failure: always
# -- Optional --
#  on_branch:
#    - main
#    - DEVOPS-12
+21 −11
Original line number Diff line number Diff line
---
language: php

php: "7.2"
os: linux
dist: focal

version: ~> 1.0

php: "7.4"

addons:
  chrome: stable
@@ -10,32 +15,37 @@ cache:
  directories:
    - "$HOME/.composer/cache"
    - "$HOME/.drush/cache"
    - "$HOME/.rvm"
    - "${TMPDIR:-/tmp}/phpstan/cache"

env:
  global:
    - ORCA_SUT_NAME=drupal/acquia_lift
    - ORCA_SUT_BRANCH=8.x-4.x
    - ORCA_VERSION=2.9.1
    - ORCA_VERSION=~3.22.2
    - ORCA_TELEMETRY_ENABLE=TRUE
    - ORCA_PACKAGES_CONFIG_ALTER=../acquia_lift/.acquia/packages_alter.yaml

matrix:
  fast_finish: true
  include:
    - { name: "Static code analysis", env: ORCA_JOB=STATIC_CODE_ANALYSIS }
    - { name: "Deprecated code scan", env: ORCA_JOB=DEPRECATED_CODE_SCAN }
    - { name: "Isolated test w/ recommended package versions", env: ORCA_JOB=ISOLATED_RECOMMENDED }
    - { name: "Integrated test w/ recommended package versions", env: ORCA_JOB=INTEGRATED_RECOMMENDED }
    - { name: "Integrated test w/ recommended package versions & previous minor release of Drupal core", env: ORCA_JOB=CORE_PREVIOUS }
    - { name: "Isolated test w/ dev package versions", env: ORCA_JOB=ISOLATED_DEV }
    - { name: "Integrated test w/ dev package versions", env: ORCA_JOB=INTEGRATED_DEV }
    - { name: "Integrated test w/ dev package versions & next minor dev version of Drupal core", env: ORCA_JOB=CORE_NEXT }
    - { name: "D9 readiness test", php: "7.3", env: ORCA_JOB=D9_READINESS }
    - { name: "Deprecated code scan", env: ORCA_JOB=LOOSE_DEPRECATED_CODE_SCAN }
    - { name: "Isolated test w/ recommended package versions", env: ORCA_JOB=ISOLATED_TEST_ON_CURRENT }
    - { name: "Integrated test w/ recommended package versions", env: ORCA_JOB=INTEGRATED_TEST_ON_CURRENT }
    - { name: "Integrated test w/ recommended package versions & previous minor release of Drupal core", env: ORCA_JOB=INTEGRATED_TEST_ON_PREVIOUS_MINOR }
    - { name: "Isolated test w/ dev package versions", env: ORCA_JOB=ISOLATED_TEST_ON_CURRENT_DEV }
    - { name: "Integrated test w/ dev package versions", env: ORCA_JOB=INTEGRATED_TEST_ON_CURRENT_DEV }
    - { name: "Integrated test w/ dev package versions & next minor dev version of Drupal core", env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR_DEV }
  allow_failures:
    - env: ORCA_JOB=STATIC_CODE_ANALYSIS
    - env: ORCA_JOB=LOOSE_DEPRECATED_CODE_SCAN
    - env: ORCA_JOB=ISOLATED_TEST_ON_CURRENT_DEV
    - env: ORCA_JOB=INTEGRATED_TEST_ON_CURRENT_DEV
    - env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR
    - env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR_DEV

before_install:
  - composer self-update 1.10.16
  - composer create-project --no-dev acquia/orca ../orca "$ORCA_VERSION"
  - ../orca/bin/travis/before_install.sh

Loading