Skip to content

Commit

Permalink
Merge branch 'release/4.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sayan goswami committed Feb 19, 2024
2 parents 1387506 + bef07ae commit b5e1c02
Show file tree
Hide file tree
Showing 42 changed files with 1,294 additions and 649 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/jira.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
# Set the JIRA* secrets in your repository settings. You will need to create an API
# token from your Jira user profile.
secrets:
jira-base-url: ${{ secrets.JIRA_BASE_URL }}
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
jira-user-email: ${{ secrets.JIRA_USER_EMAIL }}
github-token: ${{ secrets.GITHUB_TOKEN }}
with:
issue_label: grooming
2 changes: 1 addition & 1 deletion .github/workflows/live-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# Hardcode path since GITHUB_WORKSPACE can't be used here.
# @see https://github.community/t/how-to-use-env-context/16975/9
ORCA_SUT_DIR: /home/runner/work/orca/example
ORCA_SELF_TEST_COVERAGE_CLOVER: $HOME/build/logs/clover-self.xml
ORCA_SELF_TEST_COVERAGE_COBERTURA: $HOME/build/logs/cobertura-self.xml
ORCA_LIVE_TEST: TRUE

strategy:
Expand Down
47 changes: 40 additions & 7 deletions .github/workflows/orca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ jobs:
# Hardcode path since GITHUB_WORKSPACE can't be used here.
# @see https://github.community/t/how-to-use-env-context/16975/9
ORCA_SUT_DIR: /home/runner/work/orca/example
ORCA_SELF_TEST_COVERAGE_COBERTURA: /home/runner/build/logs/cobertura.xml
ORCA_SELF_TEST_COVERAGE_CLOVER: /home/runner/build/logs/clover.xml
ORCA_JOB: ${{ matrix.orca-job }}
ORCA_ENABLE_NIGHTWATCH: ${{ matrix.orca-enable-nightwatch }}
ORCA_COVERAGE_COBERTURA_ENABLE: ${{ matrix.orca-coverage-cobertura-enable }}
ORCA_COVERAGE_CLOVER_ENABLE: ${{ matrix.orca-coverage-clover-enable }}
ORCA_COVERAGE_ENABLE: ${{ matrix.orca-coverage-enable }}
# Google env variables.
ORCA_GOOGLE_API_CLIENT_ID: ${{ secrets.ORCA_GOOGLE_API_CLIENT_ID }}
Expand Down Expand Up @@ -61,24 +64,27 @@ jobs:
- INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER
- ISOLATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV
- INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_DEV
php-version: [ "8.1" ]
php-version: [ "8.1", "8.3" ]
orca-enable-nightwatch: [ "FALSE" ]
orca-coverage-enable: [ "FALSE" ]
include:
# Testing Drupal 10 in php 8.1 with nightwatch and coverage.
- orca-job: ISOLATED_TEST_ON_CURRENT
php-version: "8.1"
orca-enable-nightwatch: "TRUE"
# Testing coverage generation in Clover format when ORCA_COVERAGE_ENABLE is TRUE.
orca-coverage-enable: "TRUE"

# Testing Drupal 10 in php 8.2.
# Testing Drupal 10 in php 8.3.
- orca-job: ISOLATED_TEST_ON_CURRENT
php-version: "8.2"

# Testing latest Drupal 9 in php 8.2.
- orca-job: INTEGRATED_TEST_ON_LATEST_LTS
php-version: "8.2"
php-version: "8.3"
orca-enable-nightwatch: "TRUE"
# Testing coverage generation in CLOVER format.
orca-coverage-clover-enable: "TRUE"

# Testing Drupal 9 in php 8.1.
- orca-job: INTEGRATED_TEST_ON_LATEST_EOL_MAJOR
php-version: "8.1"

steps:
- uses: actions/checkout@v3
Expand All @@ -92,6 +98,31 @@ jobs:
php-version: ${{ matrix.php-version }}
coverage: xdebug

- name: Install google-chrome-stable
run: |
# Remove existing google chrome and install required version.
sudo dpkg -r google-chrome-stable
CHROME_VERSION_STRING="114.0.5735.198-1"
wget --no-verbose -O /tmp/chrome.deb "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION_STRING}_amd64.deb" \
&& sudo apt install -y /tmp/chrome.deb \
&& sudo rm /tmp/chrome.deb
sudo echo "CHROME_BIN=/usr/bin/google-chrome" | sudo tee -a /etc/environment
# Download and unpack chromedriver.
CHROME_DRIVER_VERSION_STRING="114.0.5735.90"
CHROMEDRIVER_ARCHIVE="chromedriver_linux64.zip"
CHROMEDRIVER_URL="https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION_STRING}/${CHROMEDRIVER_ARCHIVE}"
CHROMEDRIVER_DIR="/usr/local/share/chromedriver-linux64"
CHROMEDRIVER_BIN="$CHROMEDRIVER_DIR/chromedriver"
sudo rm -rf $CHROMEDRIVER_DIR
sudo mkdir $CHROMEDRIVER_DIR
echo "Installing chromedriver version"
wget --no-verbose -O /tmp/$CHROMEDRIVER_ARCHIVE $CHROMEDRIVER_URL
sudo unzip -qq /tmp/$CHROMEDRIVER_ARCHIVE -d $CHROMEDRIVER_DIR
sudo chmod +x $CHROMEDRIVER_BIN
sudo ln -sf "$CHROMEDRIVER_BIN" /usr/bin/
sudo echo "CHROMEWEBDRIVER=$CHROMEDRIVER_DIR" | sudo tee -a /etc/environment
- name: Before install
run: |
../orca/bin/ci/self-test/before_install.sh
Expand All @@ -115,6 +146,8 @@ jobs:
- name: After script
run: |
../orca/bin/ci/self-test/after_success.sh
unset ORCA_COVERAGE_COBERTURA_ENABLE
unset ORCA_COVERAGE_CLOVER_ENABLE
unset ORCA_COVERAGE_ENABLE
../orca/bin/ci/after_success.sh
../orca/bin/ci/after_failure.sh
Expand Down
4 changes: 1 addition & 3 deletions .idea/orca.iml

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

1 change: 1 addition & 0 deletions .idea/php-test-framework.xml

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

30 changes: 29 additions & 1 deletion bin/ci/_includes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ fi
ORCA_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
export ORCA_ROOT
export ORCA_COVERAGE_CLOVER=${ORCA_COVERAGE_CLOVER:="$HOME/build/logs/clover.xml"}
export ORCA_COVERAGE_COBERTURA=${ORCA_COVERAGE_COBERTURA:="$HOME/build/logs/cobertura.xml"}
export ORCA_COVERAGE_ENABLE=${ORCA_COVERAGE_ENABLE:="FALSE"}
export ORCA_COVERAGE_COBERTURA_ENABLE=${ORCA_COVERAGE_COBERTURA_ENABLE:="FALSE"}
export ORCA_COVERAGE_CLOVER_ENABLE=${ORCA_COVERAGE_CLOVER_ENABLE:="FALSE"}
export ORCA_FIXTURE_DIR=${ORCA_FIXTURE_DIR:="$ORCA_ROOT/../orca-build"}
export ORCA_FIXTURE_PROFILE=${ORCA_FIXTURE_PROFILE:="orca"}
export ORCA_JUNIT_LOG=${ORCA_JUNIT_LOG:="$HOME/build/logs/junitLog.xml"}
Expand All @@ -73,6 +76,18 @@ export DRUPAL_TEST_DB_URL="sqlite://localhost/sites/default/files/db.sqlite"
export DRUPAL_TEST_WEBDRIVER_CHROME_ARGS="--disable-gpu --headless --no-sandbox"
export DRUPAL_TEST_WEBDRIVER_HOSTNAME="localhost"
export DRUPAL_TEST_WEBDRIVER_PORT="4444"
export DRUPAL_NIGHTWATCH_SEARCH_DIRECTORY=../../

if [[ "$GITLAB_CI" ]]; then
# In Gitlab we are using a separate container to run ChromeDriver on port 9515.
export DRUPAL_TEST_WEBDRIVER_PORT="9515"
# Nightwatch tests are crashing when they run on SHM due to size constraint, hence disabling.
export DRUPAL_TEST_WEBDRIVER_CHROME_ARGS="--disable-dev-shm-usage --disable-gpu --headless --no-sandbox"
# We are facing intermittent failures for Nightwatch tests of toolbar module, hence ignoring.
export DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES="node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest,/builds/project/orca-build/docroot/core/modules/toolbar/tests/src/Nightwatch/Tests/*"
# Set DRUPAL_NIGHTWATCH_OUTPUT to a path inside project dir.
export DRUPAL_NIGHTWATCH_OUTPUT="$CI_PROJECT_DIR/reports/nightwatch"
fi

if [[ ! "$ORCA_TEMP_DIR" ]]; then
# GitHub Actions.
Expand Down Expand Up @@ -102,6 +117,12 @@ export PATH="/usr/local/bin/:$PATH"
# Add convenient aliases.
alias drush='drush -r "$ORCA_FIXTURE_DIR"'

if [[ "$ORCA_COVERAGE_ENABLE" == TRUE || "$ORCA_COVERAGE_COBERTURA_ENABLE" == TRUE || "$ORCA_COVERAGE_CLOVER_ENABLE" == TRUE ]]; then
export ORCA_ANY_COVERAGE_IS_ENABLED=TRUE
else
export ORCA_ANY_COVERAGE_IS_ENABLED=FALSE
fi

# Commands exiting with a non-zero status prior to this point constitute an
# error, i.e. an ORCA configuration problem, and always stop execution.
# Commands exiting with a non-zero status after this point constitute a failure,
Expand All @@ -122,10 +143,17 @@ allowed_failures=(
"INTEGRATED_TEST_ON_NEXT_MAJOR_LATEST_MINOR_BETA_OR_LATER"
)
if [[ " ${allowed_failures[*]} " =~ " ${ORCA_JOB} " ]]; then
set +e
export ORCA_IS_ALLOWED_FAILURE="TRUE"
notice "This job is allowed to fail and will report as passing regardless of outcome."
fi

function shutdown() {
if [[ "$ORCA_IS_ALLOWED_FAILURE" == "TRUE" ]]; then
exit 0
fi
}

trap shutdown ERR

# Make the shell print all lines in the script before executing them.
set -v
2 changes: 1 addition & 1 deletion bin/ci/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cd "$(dirname "$0")" || exit; source _includes.sh
yarn --version

# Disable Xdebug except on code coverage jobs.
if [[ ! "$ORCA_COVERAGE_ENABLE" == TRUE ]]; then
if [[ ! "$ORCA_ANY_COVERAGE_IS_ENABLED" == TRUE ]]; then
if [[ "$GITHUB_ACTIONS" ]]; then
# phpdismod would be simpler but flaky
# @see https://github.com/shivammathur/setup-php/issues/350#issuecomment-735370872
Expand Down
19 changes: 12 additions & 7 deletions bin/ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@

cd "$(dirname "$0")" || exit; source _includes.sh

if [[ "$ORCA_JOB" ]]; then
eval "orca ci:run $ORCA_JOB script $ORCA_SUT_NAME"
fi

if [[ "$ORCA_ENABLE_NIGHTWATCH" == "TRUE" && "$ORCA_SUT_HAS_NIGHTWATCH_TESTS" && -d "$ORCA_YARN_DIR" ]]; then
(
cd "$ORCA_YARN_DIR" || exit
orca fixture:run-server &
SERVER_PID=$!

# @todo could we set DRUPAL_TEST_CHROMEDRIVER_AUTOSTART instead of launching Chromedriver manually?
chromedriver --disable-dev-shm-usage --disable-extensions --disable-gpu --headless --no-sandbox --port=4444 &
CHROMEDRIVER_PID=$!
if [[ "$GITLAB_CI" ]]; then
echo "ChromeDriver initialized via separate container..."
else
# @todo could we set DRUPAL_TEST_CHROMEDRIVER_AUTOSTART instead of launching Chromedriver manually?
chromedriver --disable-dev-shm-usage --disable-extensions --disable-gpu --headless --no-sandbox --port=4444 &
CHROMEDRIVER_PID=$!
fi

eval "yarn test:nightwatch \\
--headless \\
Expand All @@ -34,3 +34,8 @@ if [[ "$ORCA_ENABLE_NIGHTWATCH" == "TRUE" && "$ORCA_SUT_HAS_NIGHTWATCH_TESTS" &&
kill -0 $CHROMEDRIVER_PID
)
fi

if [[ "$ORCA_JOB" ]]; then
eval "orca ci:run $ORCA_JOB script $ORCA_SUT_NAME"
fi

27 changes: 18 additions & 9 deletions bin/ci/self-test/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ cd ../../../ || exit 1

XDEBUG_IS_ENABLED=$(php -r 'echo function_exists("xdebug_get_code_coverage") ? "TRUE" : "FALSE";')

if [[ "$ORCA_COVERAGE_ENABLE" == TRUE && "$XDEBUG_IS_ENABLED" == "FALSE" ]]; then
echo "ORCA_COVERAGE_ENABLE is on but Xdebug is disabled"
if [[ "$ORCA_ANY_COVERAGE_IS_ENABLED" == TRUE && "$XDEBUG_IS_ENABLED" == "FALSE" ]]; then
echo "Coverage generation is on but Xdebug is disabled"
exit 1
fi

if [[ "$ORCA_COVERAGE_ENABLE" == FALSE && "$XDEBUG_IS_ENABLED" == "TRUE" ]]; then
echo "ORCA_COVERAGE_ENABLE is off but Xdebug is enabled"
if [[ "$ORCA_ANY_COVERAGE_IS_ENABLED" == FALSE && "$XDEBUG_IS_ENABLED" == "TRUE" ]]; then
echo "Coverage generation is off but Xdebug is enabled"
exit 1
fi

Expand All @@ -33,8 +33,10 @@ if [[ "$ORCA_JOB" == "STATIC_CODE_ANALYSIS" ]]; then

echo

if [[ "$ORCA_COVERAGE_ENABLE" == TRUE ]]; then
if [[ "$ORCA_COVERAGE_ENABLE" == TRUE || "$ORCA_COVERAGE_CLOVER_ENABLE" == TRUE ]]; then
eval './vendor/bin/phpunit --coverage-clover="$ORCA_SELF_TEST_COVERAGE_CLOVER"'
elif [[ "$ORCA_COVERAGE_COBERTURA_ENABLE" == TRUE ]]; then
eval './vendor/bin/phpunit --coverage-cobertura="$ORCA_SELF_TEST_COVERAGE_COBERTURA"'
else
eval './vendor/bin/phpunit'
fi
Expand All @@ -50,9 +52,14 @@ if [[ "$ORCA_ENABLE_NIGHTWATCH" == "TRUE" && "$ORCA_SUT_HAS_NIGHTWATCH_TESTS" &&
orca fixture:run-server &
SERVER_PID=$!

# @todo could we set DRUPAL_TEST_CHROMEDRIVER_AUTOSTART instead of launching Chromedriver manually?
chromedriver --disable-dev-shm-usage --disable-extensions --disable-gpu --headless --no-sandbox --port=4444 &
CHROMEDRIVER_PID=$!
if [[ "$GITLAB_CI" ]]; then
echo "ChromeDriver initialized via separate container..."
else
# @todo Could we set DRUPAL_TEST_CHROMEDRIVER_AUTOSTART instead of launching ChromeDriver manually?
chromedriver --disable-dev-shm-usage --disable-extensions --disable-gpu --headless --no-sandbox --port=4444 &
CHROMEDRIVER_PID=$!
fi


eval "yarn test:nightwatch \\
--headless \\
Expand All @@ -65,6 +72,8 @@ if [[ "$ORCA_ENABLE_NIGHTWATCH" == "TRUE" && "$ORCA_SUT_HAS_NIGHTWATCH_TESTS" &&
--tag=core"

kill -0 $SERVER_PID
kill -0 $CHROMEDRIVER_PID
if [ $CHROMEDRIVER_PID ]; then
kill -0 $CHROMEDRIVER_PID
fi
)
fi
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"hassankhan/config": "^3.1",
"mglaman/drupal-check": "^1.4",
"myclabs/php-enum": "^1.8.4",
"oscarotero/env": "^1.2",
"oscarotero/env": "^2.1",
"php-parallel-lint/php-console-highlighter": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.3.2",
"phploc/phploc": "^7.0.2",
Expand All @@ -46,13 +46,13 @@
"symfony/console": "^5.4.22",
"symfony/dependency-injection": "^6.0.20",
"symfony/event-dispatcher": "^6.3",
"symfony/expression-language": "^5.4.21",
"symfony/filesystem": "^5.4.21",
"symfony/expression-language": "^6.3.0",
"symfony/filesystem": "^6.4.0",
"symfony/finder": "^6.2.7",
"symfony/http-client": "^6.2.10",
"symfony/options-resolver": "^5.4.21",
"symfony/phpunit-bridge": "^6.2.7",
"symfony/process": "^5.4.22",
"symfony/options-resolver": "^6.3.0",
"symfony/phpunit-bridge": "^7.0.1",
"symfony/process": "^6.4.2",
"symfony/yaml": "^6.3.0",
"weitzman/drupal-test-traits": "^2.1"
},
Expand Down
Loading

0 comments on commit b5e1c02

Please sign in to comment.