diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 31178d4f9a924b72b4c4628447ed5200730ec5a8..10f5f1c73774a3b33482bb6b890b01619e63ccea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ include: - project: "project/gitlab_orca" ref: "1.0.x" file: - - "/includes/include.orca.variables.yml" + - "/includes/include.orca.self.variables.yml" - "/includes/include.orca.main.yml" variables: diff --git a/includes/include.orca.main.yml b/includes/include.orca.main.yml index 804e1f66c933080d6deb096430fcbb9bbbe38bd9..6d2692d6bd3a81a2c2c5c38ec582633fd9b7c63a 100644 --- a/includes/include.orca.main.yml +++ b/includes/include.orca.main.yml @@ -72,13 +72,10 @@ variables: - cd $CI_PROJECT_DIR - ../orca/bin/ci/before_install.sh - echo 'export ORCA_IS_ALLOWED_FAILURE="FALSE"' >> ../orca/bin/ci/_includes.sh - - ../orca/bin/ci/self-test/install.sh - ../orca/bin/ci/install.sh - - ../orca/bin/ci/self-test/script.sh - unset ORCA_ENABLE_NIGHTWATCH - ../orca/bin/ci/script.sh after_script: - - ../orca/bin/ci/self-test/after_success.sh - unset ORCA_COVERAGE_ENABLE - ../orca/bin/ci/after_success.sh - ../orca/bin/ci/after_failure.sh diff --git a/includes/include.orca.self.main.yml b/includes/include.orca.self.main.yml new file mode 100644 index 0000000000000000000000000000000000000000..804e1f66c933080d6deb096430fcbb9bbbe38bd9 --- /dev/null +++ b/includes/include.orca.self.main.yml @@ -0,0 +1,471 @@ +default: + image: drupalci/php-8.1-apache:production +variables: + ORCA_VERSION: ^4 + # CPU allocation for containers. + # Projects with complex tests are welcome to increase this. + # Keeping this low helps jobs find an available runner without waiting. + KUBERNETES_CPU_REQUEST: 2 + # Google env variables. + # ORCA_GOOGLE_API_CLIENT_ID: ${{ secrets.ORCA_GOOGLE_API_CLIENT_ID }} + # ORCA_GOOGLE_API_CLIENT_SECRET: ${{ secrets.ORCA_GOOGLE_API_CLIENT_SECRET }} + # ORCA_GOOGLE_API_REFRESH_TOKEN: ${{ secrets.ORCA_GOOGLE_API_REFRESH_TOKEN }} + +.with-chrome: &with-chrome + name: drupalci/chromedriver:production + alias: chrome + entrypoint: + - chromedriver + - "--no-sandbox" + - "--log-path=/tmp/chromedriver.log" + - "--verbose" + - "--whitelisted-ips=" + +.orca_run_tests: + stage: test + services: + - <<: *with-chrome + script: + - apt update && apt upgrade -y + - apt-get update && apt-get install -y apt-utils libsodium-dev patch unzip wget + - | + php_version="$(php -r 'echo PHP_VERSION;' | cut -d '.' -f 1,2)" + echo "php_version:${php_version}" + - | + # drupal.org's image has suddenly stopped supporting 'docker-php-ext-install' command, thus working around this. + apt-get update && apt-get install -y --no-install-recommends --allow-downgrades \ + autoconf ca-certificates curl file g++ gcc gdb gnupg2 libc-dev libedit2 \ + libsqlite3-0 libxml2 make pkg-config re2c rsync unzip xz-utils \ + && rm -rf /var/lib/apt/lists/*; + + export PHP_URL="https://secure.php.net/get/php-8.1.28.tar.xz/from/this/mirror"; + + set -xe; fetchDeps='wget'; apt-get update; apt-get install -y --no-install-recommends --allow-downgrades $fetchDeps; + rm -rf /var/lib/apt/lists/*; + mkdir -p /usr/src; cd /usr/src; + wget -O php.tar.xz "$PHP_URL"; + apt-get purge -y --auto-remove $fetchDeps + - cd $CI_PROJECT_DIR + - docker-php-ext-install sodium + - composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca $ORCA_VERSION + - ../orca/bin/ci/self-test/before_install.sh + - | + # We need to have dev-dependencies like phan/phan in STATIC_CODE_ANALYSIS job. + if [[ "$ORCA_JOB" == "STATIC_CODE_ANALYSIS" ]]; then + composer -d"../orca" install + fi + - | + if [ "$ORCA_COVERAGE_COBERTURA_ENABLE" = "TRUE" ]; then + echo xdebug.mode=coverage > /usr/local/etc/php/conf.d/xdebug.ini + echo zend_extension=xdebug >> /usr/local/etc/php/conf.d/xdebug.ini + fi + - | + if [ "$ORCA_ENABLE_NIGHTWATCH" = "TRUE" ]; then + # D11 requires yarn>=4.1.1 + npm cache clean --force + # Remove the previous yarn installed in the container. + npm uninstall -g yarn + npm install -g corepack + corepack enable + yarn set version 4.1.1 + fi + - cd $CI_PROJECT_DIR + - ../orca/bin/ci/before_install.sh + - echo 'export ORCA_IS_ALLOWED_FAILURE="FALSE"' >> ../orca/bin/ci/_includes.sh + - ../orca/bin/ci/self-test/install.sh + - ../orca/bin/ci/install.sh + - ../orca/bin/ci/self-test/script.sh + - unset ORCA_ENABLE_NIGHTWATCH + - ../orca/bin/ci/script.sh + after_script: + - ../orca/bin/ci/self-test/after_success.sh + - unset ORCA_COVERAGE_ENABLE + - ../orca/bin/ci/after_success.sh + - ../orca/bin/ci/after_failure.sh + - ../orca/bin/ci/after_script.sh + artifacts: + expire_in: 6 mos + when: always + reports: + junit: $CI_PROJECT_DIR/var/logs/junit.xml + paths: + - $CI_PROJECT_DIR/var/logs/junit.xml + +# PHP 8.0 tests. +INTEGRATED_TEST_ON_LATEST_EOL_MAJOR_PHP8: + image: drupalci/php-8.0-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_INTEGRATED_TEST_ON_LATEST_EOL_MAJOR == "0"' + variables: + ORCA_JOB: "INTEGRATED_TEST_ON_LATEST_EOL_MAJOR" + ORCA_VERSION: ^3 + +# PHP 8.1 tests. +# STATIC_CODE_ANALYSIS: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_STATIC_CODE_ANALYSIS == "0"' +# variables: +# ORCA_JOB: "STATIC_CODE_ANALYSIS" +# ORCA_COVERAGE_COBERTURA_ENABLE: "TRUE" + +INTEGRATED_TEST_ON_LATEST_EOL_MAJOR: + extends: + - .orca_run_tests + rules: + - if: '$SKIP_INTEGRATED_TEST_ON_LATEST_EOL_MAJOR == "0"' + variables: + ORCA_JOB: "INTEGRATED_TEST_ON_LATEST_EOL_MAJOR" + +INTEGRATED_TEST_ON_OLDEST_SUPPORTED: + extends: + - .orca_run_tests + rules: + - if: '$SKIP_INTEGRATED_TEST_ON_OLDEST_SUPPORTED == "0"' + variables: + ORCA_JOB: "INTEGRATED_TEST_ON_OLDEST_SUPPORTED" + +INTEGRATED_TEST_ON_LATEST_LTS: + extends: + - .orca_run_tests + rules: + - if: '$SKIP_INTEGRATED_TEST_ON_LATEST_LTS == "0"' + variables: + ORCA_JOB: "INTEGRATED_TEST_ON_LATEST_LTS" + +# INTEGRATED_TEST_ON_PREVIOUS_MINOR: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_INTEGRATED_TEST_ON_PREVIOUS_MINOR == "0"' +# variables: +# ORCA_JOB: "INTEGRATED_TEST_ON_PREVIOUS_MINOR" + +# ISOLATED_TEST_ON_CURRENT: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_ISOLATED_TEST_ON_CURRENT == "0"' +# variables: +# ORCA_JOB: "ISOLATED_TEST_ON_CURRENT" + +# ISOLATED_TEST_ON_CURRENT_DEV: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_ISOLATED_TEST_ON_CURRENT_DEV == "0"' +# variables: +# ORCA_JOB: "ISOLATED_TEST_ON_CURRENT_DEV" + +# ISOLATED_TEST_ON_CURRENT_COVERAGE: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_ISOLATED_TEST_ON_CURRENT_COVERAGE == "0"' +# variables: +# ORCA_JOB: "ISOLATED_TEST_ON_CURRENT" +# ORCA_COVERAGE_COBERTURA_ENABLE: "TRUE" +# ORCA_COVERAGE_COBERTURA: "$CI_PROJECT_DIR/var/logs/cobertura.xml" +# artifacts: +# paths: +# - $CI_PROJECT_DIR/var/logs/cobertura.xml +# - $CI_PROJECT_DIR/var/logs/junit.xml +# reports: +# coverage_report: +# coverage_format: cobertura +# path: $CI_PROJECT_DIR/var/logs/cobertura.xml + +# ISOLATED_TEST_ON_CURRENT_NIGHTWATCH: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_ISOLATED_TEST_ON_CURRENT_NIGHTWATCH == "0"' +# variables: +# ORCA_JOB: "ISOLATED_TEST_ON_CURRENT" +# ORCA_ENABLE_NIGHTWATCH: "TRUE" +# DRUPAL_NIGHTWATCH_OUTPUT: $CI_PROJECT_DIR/reports/nightwatch +# artifacts: +# expire_in: 6 mos +# when: always +# reports: +# junit: $CI_PROJECT_DIR/reports/nightwatch/*/*.xml +# paths: +# - $CI_PROJECT_DIR/reports/nightwatch + +# INTEGRATED_TEST_ON_CURRENT: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_INTEGRATED_TEST_ON_CURRENT == "0"' +# variables: +# ORCA_JOB: "INTEGRATED_TEST_ON_CURRENT" + +# INTEGRATED_TEST_ON_CURRENT_DEV: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_INTEGRATED_TEST_ON_CURRENT_DEV == "0"' +# variables: +# ORCA_JOB: "INTEGRATED_TEST_ON_CURRENT_DEV" +# allow_failure: true + +# ISOLATED_TEST_ON_NEXT_MINOR: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_ISOLATED_TEST_ON_NEXT_MINOR == "0"' +# variables: +# ORCA_JOB: "ISOLATED_TEST_ON_NEXT_MINOR" + +# ISOLATED_TEST_ON_NEXT_MINOR_DEV: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_ISOLATED_TEST_ON_NEXT_MINOR_DEV == "0"' +# variables: +# ORCA_JOB: "ISOLATED_TEST_ON_NEXT_MINOR_DEV" +# allow_failure: true + +# INTEGRATED_TEST_ON_NEXT_MINOR: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_INTEGRATED_TEST_ON_NEXT_MINOR == "0"' +# variables: +# ORCA_JOB: "INTEGRATED_TEST_ON_NEXT_MINOR" + +# INTEGRATED_TEST_ON_NEXT_MINOR_DEV: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_INTEGRATED_TEST_ON_NEXT_MINOR_DEV == "0"' +# variables: +# ORCA_JOB: "INTEGRATED_TEST_ON_NEXT_MINOR_DEV" +# allow_failure: true + +# DEPRECATED_CODE_SCAN_W_CONTRIB: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_DEPRECATED_CODE_SCAN_W_CONTRIB == "0"' +# variables: +# ORCA_JOB: "DEPRECATED_CODE_SCAN_W_CONTRIB" +# allow_failure: true + +# LOOSE_DEPRECATED_CODE_SCAN: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_LOOSE_DEPRECATED_CODE_SCAN == "0"' +# variables: +# ORCA_JOB: "LOOSE_DEPRECATED_CODE_SCAN" +# allow_failure: true + +# LIVE_TEST: +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_LIVE_TEST == "0"' +# variables: +# ORCA_JOB: "" +# ORCA_LIVE_TEST: "TRUE" +# ORCA_PACKAGES_CONFIG: "" +# ORCA_PACKAGES_CONFIG_ALTER: "" + +# PHP 8.3 tests. +# ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV_PHP83: +# image: drupalci/php-8.3-ubuntu-apache:production +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV == "0"' +# variables: +# ORCA_JOB: "ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV" +# allow_failure: true + +# INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV_PHP83: +# image: drupalci/php-8.3-ubuntu-apache:production +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV == "0"' +# variables: +# ORCA_JOB: "INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV" +# allow_failure: true + +# ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER_PHP83: +# image: drupalci/php-8.3-ubuntu-apache:production +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER == "0"' +# variables: +# ORCA_JOB: "ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER" + +# INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER_PHP83: +# image: drupalci/php-8.3-ubuntu-apache:production +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER == "0"' +# variables: +# ORCA_JOB: "INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER" +# allow_failure: true + +STATIC_CODE_ANALYSIS_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_STATIC_CODE_ANALYSIS == "0"' + variables: + ORCA_JOB: "STATIC_CODE_ANALYSIS" + ORCA_COVERAGE_COBERTURA_ENABLE: "TRUE" + +# This test is not required as we are already testing the same in coverage tests and nightwatch. +# ISOLATED_TEST_ON_CURRENT_PHP83: +# image: drupalci/php-8.3-ubuntu-apache:production +# extends: +# - .orca_run_tests +# rules: +# - if: '$SKIP_ISOLATED_TEST_ON_CURRENT == "0"' +# variables: +# ORCA_JOB: "ISOLATED_TEST_ON_CURRENT" + +ISOLATED_TEST_ON_CURRENT_COVERAGE_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_ISOLATED_TEST_ON_CURRENT_COVERAGE == "0"' + variables: + ORCA_JOB: "ISOLATED_TEST_ON_CURRENT" + ORCA_COVERAGE_COBERTURA_ENABLE: "TRUE" + ORCA_COVERAGE_COBERTURA: "$CI_PROJECT_DIR/var/logs/cobertura.xml" + artifacts: + paths: + - $CI_PROJECT_DIR/var/logs/cobertura.xml + - $CI_PROJECT_DIR/var/logs/junit.xml + reports: + coverage_report: + coverage_format: cobertura + path: $CI_PROJECT_DIR/var/logs/cobertura.xml + +ISOLATED_TEST_ON_CURRENT_NIGHTWATCH_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_ISOLATED_TEST_ON_CURRENT_NIGHTWATCH == "0"' + variables: + ORCA_JOB: "ISOLATED_TEST_ON_CURRENT" + ORCA_ENABLE_NIGHTWATCH: "TRUE" + DRUPAL_NIGHTWATCH_OUTPUT: $CI_PROJECT_DIR/reports/nightwatch + artifacts: + expire_in: 6 mos + when: always + reports: + junit: $CI_PROJECT_DIR/reports/nightwatch/*/*.xml + paths: + - $CI_PROJECT_DIR/reports/nightwatch + +ISOLATED_TEST_ON_CURRENT_DEV_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_ISOLATED_TEST_ON_CURRENT_DEV == "0"' + variables: + ORCA_JOB: "ISOLATED_TEST_ON_CURRENT_DEV" + +INTEGRATED_TEST_ON_CURRENT_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_INTEGRATED_TEST_ON_CURRENT == "0"' + variables: + ORCA_JOB: "INTEGRATED_TEST_ON_CURRENT" + +INTEGRATED_TEST_ON_CURRENT_DEV_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_INTEGRATED_TEST_ON_CURRENT_DEV == "0"' + variables: + ORCA_JOB: "INTEGRATED_TEST_ON_CURRENT_DEV" + allow_failure: true + +ISOLATED_TEST_ON_NEXT_MINOR_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_ISOLATED_TEST_ON_NEXT_MINOR == "0"' + variables: + ORCA_JOB: "ISOLATED_TEST_ON_NEXT_MINOR" + +ISOLATED_TEST_ON_NEXT_MINOR_DEV_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_ISOLATED_TEST_ON_NEXT_MINOR_DEV == "0"' + variables: + ORCA_JOB: "ISOLATED_TEST_ON_NEXT_MINOR_DEV" + allow_failure: true + +INTEGRATED_TEST_ON_NEXT_MINOR_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_INTEGRATED_TEST_ON_NEXT_MINOR == "0"' + variables: + ORCA_JOB: "INTEGRATED_TEST_ON_NEXT_MINOR" + +INTEGRATED_TEST_ON_NEXT_MINOR_DEV_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_INTEGRATED_TEST_ON_NEXT_MINOR_DEV == "0"' + variables: + ORCA_JOB: "INTEGRATED_TEST_ON_NEXT_MINOR_DEV" + allow_failure: true + +DEPRECATED_CODE_SCAN_W_CONTRIB_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_DEPRECATED_CODE_SCAN_W_CONTRIB == "0"' + variables: + ORCA_JOB: "DEPRECATED_CODE_SCAN_W_CONTRIB" + allow_failure: true + +LOOSE_DEPRECATED_CODE_SCAN_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_LOOSE_DEPRECATED_CODE_SCAN == "0"' + variables: + ORCA_JOB: "LOOSE_DEPRECATED_CODE_SCAN" + allow_failure: true + +LIVE_TEST_PHP83: + image: drupalci/php-8.3-ubuntu-apache:production + extends: + - .orca_run_tests + rules: + - if: '$SKIP_LIVE_TEST == "0"' + variables: + ORCA_JOB: "" + ORCA_LIVE_TEST: "TRUE" + ORCA_PACKAGES_CONFIG: "" + ORCA_PACKAGES_CONFIG_ALTER: ""