Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Nov 20, 2024
1 parent 0ad3ef0 commit c462139
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 7 deletions.
11 changes: 8 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ jobs:
docker:
- image: cimg/php:8.2-browsers
environment:
DRUPAL_VERSION: 10@beta
DRUPAL_VERSION: 10.4@beta
CI_PHPSTAN_IGNORE_FAILURE: 1 # PHPStan levels for canary releases are not the same as for this project.
<<: *job-test

test-php-8.3-d10-legacy:
Expand All @@ -144,7 +145,8 @@ jobs:
docker:
- image: cimg/php:8.3-browsers
environment:
DRUPAL_VERSION: 10@beta
DRUPAL_VERSION: 10.4@beta
CI_PHPSTAN_IGNORE_FAILURE: 1 # PHPStan levels for canary releases are not the same as for this project.
<<: *job-test

test-php-8.4-d10-legacy:
Expand All @@ -168,7 +170,8 @@ jobs:
docker:
- image: cimg/php:8.3-browsers # PHP 8.4 is not available yet.
environment:
DRUPAL_VERSION: 10@beta
DRUPAL_VERSION: 10.4@beta
CI_PHPSTAN_IGNORE_FAILURE: 1 # PHPStan levels for canary releases are not the same as for this project.
<<: *job-test

test-php-8.3-d11-legacy:
Expand All @@ -193,6 +196,7 @@ jobs:
- image: cimg/php:8.3-browsers
environment:
DRUPAL_VERSION: 11@beta
CI_PHPSTAN_IGNORE_FAILURE: 1 # PHPStan levels for canary releases are not the same as for this project.
<<: *job-test

test-php-8.4-d11-legacy:
Expand All @@ -217,6 +221,7 @@ jobs:
- image: cimg/php:8.3-browsers # PHP 8.4 is not available yet.
environment:
DRUPAL_VERSION: 11@beta
CI_PHPSTAN_IGNORE_FAILURE: 1 # PHPStan levels for canary releases are not the same as for this project.
<<: *job-test

deploy:
Expand Down
31 changes: 30 additions & 1 deletion .devtools/assemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ fi
info "Creating Drupal codebase."

drupal_version_major="$(echo "${DRUPAL_VERSION}" | cut -d '.' -f 1 | cut -d '@' -f 1)"
drupal_version_stability="$(echo "${DRUPAL_VERSION}" | sed -n 's/.*@\(.*\)/\1/p')"
drupal_version_stability="${drupal_version_stability:-stable}"

DRUPAL_PROJECT_SHA="${DRUPAL_PROJECT_SHA:-"${drupal_version_major}.x"}"

note "Initialising Drupal site from the scaffold repo ${DRUPAL_PROJECT_REPO} ref ${DRUPAL_PROJECT_SHA}."
note "Initialising Drupal ${DRUPAL_VERSION} site from the scaffold repo ${DRUPAL_PROJECT_REPO} ref ${DRUPAL_PROJECT_SHA}."

# Clone Drupal project at the specific commit SHA.
git clone -n "${DRUPAL_PROJECT_REPO}" "build"
Expand All @@ -105,6 +108,18 @@ sed_opts=(-i) && [ "$(uname)" == "Darwin" ] && sed_opts=(-i '')
sed "${sed_opts[@]}" 's|\(.*"drupal\/core.*"\): "\(.*\)",.*|\1: '"\"~$DRUPAL_VERSION\",|" "build/composer.json"
grep '"drupal/core-.*": "' "build/composer.json"

note "Updating stability to ${drupal_version_stability}."
# Do not rely on the values coming from the scaffold and always set them.
sed "${sed_opts[@]}" 's|\(.*"minimum-stability"\): "\(.*\)",.*|\1: '"\"${drupal_version_stability}\",|" "build/composer.json"
grep 'minimum-stability' "build/composer.json"

drupal_version_prefer_stable="true"
if [ "${drupal_version_stability}" != "stable" ]; then
drupal_version_prefer_stable="false"
fi
sed "${sed_opts[@]}" 's|\(.*"prefer-stable"\): \(.*\),.*|\1: '${drupal_version_prefer_stable}',|' "build/composer.json"
grep 'prefer-stable' "build/composer.json"

pass "Drupal codebase created."

info "Merging configuration from composer.dev.json."
Expand Down Expand Up @@ -147,6 +162,20 @@ for composer_suggest in $composer_suggests; do
done
pass "Suggested dependencies installed."

# Some versions of Drupal enforce maximum verbosity for errors by default. This
# leads to functional tests failing due to deprecation notices showing up in
# the page output, which is then interpreted as a test failure by PHPUnit.
# To address this, we inject the error_reporting() without deprecations into
# the default.settings.php file used by the system under test. But we do this
# only if the deprecations helper is set to `disable` which means to ignore
# deprecation notices.
# @see https://www.drupal.org/project/drupal/issues/1267246
if [ "${SYMFONY_DEPRECATIONS_HELPER-}" == "disabled" ]; then
info "Disabling deprecation notices in functional tests."
echo "error_reporting(E_ALL & ~E_DEPRECATED);" >>build/web/sites/default/default.settings.php
pass "Deprecation notices disabled."
fi

# If front-end dependencies are used in the project, package-lock.json is
# expected to be committed to the repository.
if [ -f "package-lock.json" ]; then
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/scaffold-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ jobs:
"$(pwd)"/.scaffold-coverage-html \
.scaffold/tests/node_modules/.bin/bats \
.scaffold/tests/bats --filter-tags "${{ matrix.bats-tags }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload coverage report as an artifact
uses: actions/upload-artifact@v4
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:

- name: test-php-8.2-d10-canary
php-version: 8.2
drupal-version: 10@beta
drupal-version: 10.4@beta
stability: canary

- name: test-php-8.3-d10-legacy
php-version: 8.3
Expand All @@ -40,7 +41,8 @@ jobs:

- name: test-php-8.3-d10-canary
php-version: 8.3
drupal-version: 10@beta
drupal-version: 10.4@beta
stability: canary

- name: test-php-8.4-d10-legacy
php-version: 8.4
Expand All @@ -52,7 +54,7 @@ jobs:

- name: test-php-8.4-d10-canary
php-version: 8.4
drupal-version: 10@beta
drupal-version: 10.4@beta

- name: test-php-8.3-d11-legacy
php-version: 8.3
Expand Down Expand Up @@ -106,8 +108,16 @@ jobs:
php-version: ${{ matrix.php-version }}
extensions: gd, sqlite, pdo_sqlite

# Disable Symfony deprecations helper for PHP 8.4+ until minor
# versions of Drupal 10 and 11 fully support PHP 8.4.
# @see https://www.drupal.org/project/drupal/issues/1267246
- name: Update SYMFONY_DEPRECATIONS_HELPER for PHP 8.4
run: if [ "${{ matrix.php-version }}" == "8.4" ]; then echo "SYMFONY_DEPRECATIONS_HELPER=disabled" >> "$GITHUB_ENV"; fi

- name: Assemble the codebase
run: .devtools/assemble.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Start built-in PHP server
run: .devtools/start.sh
Expand All @@ -122,6 +132,7 @@ jobs:
- name: Lint code with PHPStan
working-directory: build
run: vendor/bin/phpstan || [ "${CI_PHPSTAN_IGNORE_FAILURE:-0}" -eq 1 ]
continue-on-error: ${{ endsWith(matrix.name, 'canary') }} # PHPStan levels for canary releases are not the same as for this project.

- name: Lint code with Rector
working-directory: build
Expand Down

0 comments on commit c462139

Please sign in to comment.