From abe9735f067f89ab664b0f474df6df8d5f20e75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thiago=20R=C3=A9gis?= Date: Mon, 22 Jul 2024 12:05:58 -0300 Subject: [PATCH] Try stub files --- .github/workflows/behat.yml | 974 +++++++++--------- .github/workflows/bestPractices.yml | 138 +-- .github/workflows/prManager.yml | 116 +-- .github/workflows/prManagerTest.yml | 68 +- .github/workflows/translations.yml | 226 ++-- .../social_event/social_event.module | 1 - phpstan.neon | 11 + src/PHPStan/Stubs/social_eda/Address.stub | 19 + src/PHPStan/Stubs/social_eda/DateTime.stub | 36 + src/PHPStan/Stubs/social_eda/Entity.stub | 21 + src/PHPStan/Stubs/social_eda/Href.stub | 18 + src/PHPStan/Stubs/social_eda/User.stub | 21 + .../social_eda_dispatcher/CloudEvent.stub | 32 + .../social_eda_dispatcher/Dispatcher.stub | 22 + 14 files changed, 941 insertions(+), 762 deletions(-) create mode 100644 src/PHPStan/Stubs/social_eda/Address.stub create mode 100644 src/PHPStan/Stubs/social_eda/DateTime.stub create mode 100644 src/PHPStan/Stubs/social_eda/Entity.stub create mode 100644 src/PHPStan/Stubs/social_eda/Href.stub create mode 100644 src/PHPStan/Stubs/social_eda/User.stub create mode 100644 src/PHPStan/Stubs/social_eda_dispatcher/CloudEvent.stub create mode 100644 src/PHPStan/Stubs/social_eda_dispatcher/Dispatcher.stub diff --git a/.github/workflows/behat.yml b/.github/workflows/behat.yml index e5abe30a4d3..682dfe75d37 100644 --- a/.github/workflows/behat.yml +++ b/.github/workflows/behat.yml @@ -1,487 +1,487 @@ -name: 'Behat' - -# Controls when the workflow will run -on: - # Triggers the workflow on all pull request events - pull_request: { } - # Trigger workflow for release branches. - push: - branches: - - main - - "[0-9]+.[0-9]+.x" - -# We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time. -# In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress -# when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to -# find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR). -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.head_ref != '' }} - -# github.head_ref is only set when the workflow was triggered by a pull_request and it contains the value of the source branch of the PR. -# github.ref_name will than only be used if the workflow was not triggered by a pull_request and it also just contains the branch name. -env: - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - feature_discovery: - name: "Feature Discovery" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - run: sudo apt-get install jq - - - name: Find feature files - id: set-matrix - run: | - echo -n "features=" >> $GITHUB_OUTPUT - cd tests/behat/features/capabilities - find * -type d -exec sh -c "ls {} | grep '\.feature$' > /dev/null" ';' -print | jq -R -s -c 'split("\n") | map(select(length > 0))' >> $GITHUB_OUTPUT - - outputs: - features: ${{ steps.set-matrix.outputs.features }} - - install_previous_open_social: - name: "Install previous Open Social major version" - runs-on: ubuntu-22.04 - container: - image: goalgorilla/open_social_docker:ci-drupal10-php8.1-v2 - volumes: - - ${{ github.workspace }}:/var/www - - strategy: - matrix: - with_optional: - - "" - - "with-optional" - - services: - db: - image: mariadb:10.7 - env: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: social - mailcatcher: - image: schickling/mailcatcher - env: - VIRTUAL_HOST: mailcatcher.social.dev - VIRTUAL_PORT: 1080 - ports: - - "1080" - redis: - image: redis:latest - solr: - image: ghcr.io/goalgorilla/ci-solr:8.11 - env: - SOLR_SOLR_MEM_SIZE: 512m - PARTIAL_SEARCH_ENABLED: 0 - options: --health-cmd="solr status" --health-interval=10s --health-timeout=5s --health-retries=3 - - defaults: - run: - shell: bash - working-directory: /var/www - - steps: - - uses: actions/checkout@v4 - with: - path: ${{ github.workspace }}/tmp - - # Checkout Drupal Social. - - name: Prepare composer - run: | - cp tmp/tests/composer.json composer.json - - - name: Set-up the previous major version of Open Social - run: | - set -e - - apt-get update - - apt-get install -y jq - # This gets all version info from composer for Open Social. We then - # use jq to traverse and manipulate the JSON data to find ourselves - # the current stable major version. - PREVIOUS_MAJOR=`composer info -a --format json goalgorilla/open_social | jq '.versions | map(select(contains("-") == false)) | map(split(".")[0] | tonumber) | unique | reverse | .[0]'` - echo "Setting up update test from Open Social $PREVIOUS_MAJOR" - - # Also include a hardcoded version for instaclick/php-webdriver, drupal/dynamic_entity_reference and drupal/core - # as we didnt lock the version, and the patch isn't applying on the latest, so we require it - # specifically to match the version that was installed at that moment in time. - composer require goalgorilla/open_social:~$PREVIOUS_MAJOR instaclick/php-webdriver:1.4.16 drupal/dynamic_entity_reference:3.1.0 drupal/core:10.2.3 "drupal/flexible_permissions:^1.1.0" - - # Installation - # This is purposefully duplicated because we may change how - # installation works between major versions, so this provides us the - # flexibility to reflect that in the workflow. - cp tmp/tests/default.settings.php /var/www/html/sites/default/default.settings.php - mkdir /var/www/files_private - - export OPTIONAL="" - if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then - export OPTIONAL="social_module_configure_form.select_all='TRUE'" - fi - - drush site-install -y social --db-url=mysql://root:root@db:3306/social $OPTIONAL install_configure_form.update_status_module='array(FALSE,FALSE)' --site-name='Open Social' > >(tee install-output.log) 2> >(tee install-error.log >&2) - drush en flexible_permissions - - # Dump the database to our test-output folder so that we can locally - # debug if the update fails. - mkdir -p behat-test-output - if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then - drush sql-dump > behat-test-output/pre-update-with-optional.sql - else - drush sql-dump > behat-test-output/pre-update.sql - fi - - # Ensure there are no warnings or errors in the install-*.log. - # We do this after the database dump because drush doesn't actually - # exit, so this makes debugging easier. - if grep -E '\[warning\]' install-output.log install-error.log 1>/dev/null || grep -E '\[error\]' install-output.log install-error.log 1>/dev/null; then - # Move the install-*.log with warnings/errors and status messages to the test output. The text is viewable on - # GitHub too but some people might find it easier to just download the artifact and get digging. - if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then - mv install-output.log behat-test-output/pre-update-install-output-with-optional.log - mv install-error.log behat-test-output/pre-update-install-error-with-optional.log - else - mv install-output.log behat-test-output/pre-update-install-output.log - mv install-error.log behat-test-output/pre-update-install-error.log - fi - - # Abort our testing until the warning/error is fixed and let our user know why we stopped. - echo "The drush install output should not contain any warnings or errors" - exit 1 - fi - - # Remove the composer files since we'll recreate this in the update. - rm composer.* - - - name: Clean up checkout - run: rm -r tmp - - - name: Package up previous version - uses: actions/cache@v4 - with: - path: ${{ github.workspace }} - key: ${{ github.sha }}-previous-version-${{ matrix.with_optional }} - - install_open_social: - needs: [install_previous_open_social] - - name: "Install Open Social" - runs-on: ubuntu-22.04 - container: - image: goalgorilla/open_social_docker:ci-drupal10-php8.1-v2 - volumes: - - ${{ github.workspace }}:/var/www - - strategy: - matrix: - update: - - "" - - "update" - with_optional: - - "" - - "with-optional" - - services: - db: - image: mariadb:10.7 - env: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: social - mailcatcher: - image: schickling/mailcatcher - env: - VIRTUAL_HOST: mailcatcher.social.dev - VIRTUAL_PORT: 1080 - ports: - - "1080" - redis: - image: redis:latest - solr: - image: ghcr.io/goalgorilla/ci-solr:8.11 - env: - SOLR_SOLR_MEM_SIZE: 512m - PARTIAL_SEARCH_ENABLED: 0 - - defaults: - run: - shell: bash - working-directory: /var/www - - steps: - - name: Retrieve previous version - if: ${{ matrix.update == 'update' }} - uses: actions/cache@v4 - with: - fail-on-cache-miss: true - path: ${{ github.workspace }} - key: ${{ github.sha }}-previous-version-${{ matrix.with_optional }} - - - uses: actions/checkout@v4 - with: - path: ${{ github.workspace }}/tmp - - - name: Composer install to HEAD - run: | - set -e - - cp tmp/tests/composer.json composer.json - - # Composer has special handling for "version-like" branch names - if [[ $BRANCH_NAME =~ [0-9]+\.[0-9]+\.x ]]; then - composer require goalgorilla/open_social:$BRANCH_NAME-dev - else - composer require goalgorilla/open_social:dev-$BRANCH_NAME - fi - - composer install - - cp tmp/tests/default.settings.php /var/www/html/sites/default/default.settings.php - mkdir -p /var/www/files_private - - rm -r tmp/ - - - name: Update the previous major version to HEAD - if: ${{ matrix.update == 'update' }} - run: | - set -e - - if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then - drush sqlc < behat-test-output/pre-update-with-optional.sql - else - drush sqlc < behat-test-output/pre-update.sql - fi - - vendor/bin/drush updb -y 2> >(tee update.log >&2) - - # Ensure there are no warnings or requirements errors in the update.log - if grep -E '^>\s+\[warning\]\s' update.log 1>/dev/null || grep 'Requirements check reports errors. Do you wish to continue?' update.log 1>/dev/null; then - # Move the update.log with warnings/errors and status messages to the test output. The text is viewable on - # GitHub too but some people might find it easier to just download the artifact and get digging. - if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then - mv update.log behat-test-output/update-with-optional.log - else - mv update.log behat-test-output/update.log - fi - - # Abort our testing until the warning/error is fixed and let our user know why we stopped. - echo "The drush output should not contain any warnings or requirements errors" - exit 1 - fi - - - name: Set-up a new Open Social installation at HEAD - if: ${{ matrix.update == '' }} - run: | - set -e - - export OPTIONAL="" - if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then - export OPTIONAL="social_module_configure_form.select_all='TRUE'" - fi - - drush site-install -y social --db-url=mysql://root:root@db:3306/social $OPTIONAL install_configure_form.update_status_module='array(FALSE,FALSE)' --site-name='Open Social' > >(tee install-output.log) 2> >(tee install-error.log >&2) - - - name: Dump Database - run: | - mkdir -p behat-test-output - if [[ ! -z "${{ matrix.update }}" ]] && [[ ! -z "${{ matrix.with_optional }}" ]]; then - drush sql:dump > behat-test-output/installation-update-with-optional.sql - elif [[ ! -z "${{ matrix.update }}" ]]; then - drush sql:dump > behat-test-output/installation-update.sql - elif [[ ! -z "${{ matrix.with_optional }}" ]]; then - drush sql:dump > behat-test-output/installation-with-optional.sql - else - drush sql:dump > behat-test-output/installation.sql - fi - - - name: Validate install contained no errors - if: ${{ matrix.update == '' }} - run: | - # Ensure there are no warnings or errors in the install-*.log. - # We do this after database dumping to help debugging. - if grep -E '\[warning\]' install-output.log install-error.log 1>/dev/null || grep -E '\[error\]' install-output.log install-error.log 1>/dev/null; then - # Move the install-*.log with warnings/errors and status messages to the test output. The text is viewable on - # GitHub too but some people might find it easier to just download the artifact and get digging. - if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then - mv install-output.log behat-test-output/install-output-with-optional.log - mv install-error.log behat-test-output/install-error-with-optional.log - else - mv install-output.log behat-test-output/install-output.log - mv install-error.log behat-test-output/install-error.log - fi - - # Abort our testing until the warning/error is fixed and let our user know why we stopped. - echo "The drush install output should not contain any warnings or errors" - exit 1 - fi - - - name: Fix owner of web files - run: chown -R www-data:www-data /var/www - - - name: Package up site - uses: actions/cache@v4 - with: - path: ${{ github.workspace }} - key: ${{ github.sha }}-test-setup-${{ matrix.update}}${{ matrix.with_optional }} - - - name: Upload Installation database - if: failure() - uses: actions/upload-artifact@v3 - with: - name: behat-test-output - path: behat-test-output - - # This workflow contains a single job called "Running tests" - tests: - needs: [feature_discovery, install_open_social] - - name: 'Tests' - runs-on: ubuntu-22.04 - container: - image: goalgorilla/open_social_docker:ci-drupal10-php8.1-v2 - volumes: - - ${{ github.workspace }}:/var/www - - strategy: - fail-fast: false - matrix: - feature: ${{ fromJson(needs.feature_discovery.outputs.features) }} - update: - - "" - - "update" - with_optional: - - "" - - "with-optional" - - services: - web: - image: goalgorilla/open_social_docker:ci-drupal10-php8.1-v2 - env: - DRUPAL_SETTINGS: production - volumes: - - ${{ github.workspace }}:/var/www - ports: - - "80" - db: - image: mariadb:10.7 - env: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: social - mailcatcher: - image: schickling/mailcatcher - env: - VIRTUAL_HOST: mailcatcher.social.dev - VIRTUAL_PORT: 1080 - ports: - - "1080" - redis: - image: redis:latest - solr: - image: ghcr.io/goalgorilla/ci-solr:8.11 - env: - SOLR_SOLR_MEM_SIZE: 512m - PARTIAL_SEARCH_ENABLED: 0 - chrome: - # We use an image based on zenika/alpine-chrome:latest so we can add - # the start-up arguments that we need. - image: kingdutch/social-docker-chrome - ports: - - '9222:9222' - - defaults: - run: - shell: bash - working-directory: /var/www - - steps: - - name: Download Site - uses: actions/cache@v4 - with: - fail-on-cache-miss: true - path: ${{ github.workspace }} - key: ${{ github.sha }}-test-setup-${{ matrix.update}}${{ matrix.with_optional }} - - # We could run all tests at once by passing the folder directly to behat - # however, by doing this manually in a loop we have the ability to ensure - # each test runs against a clean database cheaply. - - name: Run Integration test - run: | - if [[ ! -z "${{ matrix.update }}" ]] && [[ ! -z "${{ matrix.with_optional }}" ]]; then - export TEST_DATABASE=`pwd`/behat-test-output/installation-update-with-optional.sql - elif [[ ! -z "${{ matrix.update }}" ]]; then - export TEST_DATABASE=`pwd`/behat-test-output/installation-update.sql - elif [[ ! -z "${{ matrix.with_optional }}" ]]; then - export TEST_DATABASE=`pwd`/behat-test-output/installation-with-optional.sql - else - export TEST_DATABASE=`pwd`/behat-test-output/installation.sql - fi - vendor/bin/behat --version - for test in html/profiles/contrib/social/tests/behat/features/capabilities/${{ matrix.feature }}/*.feature; do - if head -n1 $test | grep -q "@disabled"; then - echo "$test - Skipping disabled test" - continue - fi - - # If we're testing a clean install (i.e. not updating) then ignore - # any tests that have opted out of install testing. - if [[ -z "${{ matrix.update }}" ]]; then - export TAGS="--tags=~no-install" - # Do the same when we are testing with an update. - else - export TAGS="--tags=~no-update" - fi - - # Tests with the @no-database tag import their own scaffold so they - # ignore the databases provided by our test matrix, that's why we - # only run them once when all our matrix values are off. - if [[ ! -z "${{ matrix.update }}" ]] || [[ ! -z "${{ matrix.with_optional }}" ]]; then - export TAGS="$TAGS&&~no-database" - fi - - echo "::group::$test" - # Run in subshell to make the test command visible and copyable. - (set -x; vendor/bin/behat -vv --config html/profiles/contrib/social/tests/behat/behat.yml --colors --allow-empty $TAGS $test) - echo "::endgroup::" - done - - - name: Move test artifacts into upload folder - if: failure() - run: | - set -e - - # Make the output folder - if [[ ! -z "${{ matrix.update }}" ]] && [[ ! -z "${{ matrix.with_optional }}" ]]; then - export OUTPUT_FOLDER=behat-test-output/${{ matrix.feature }}/update-with-optional - elif [[ ! -z "${{ matrix.update }}" ]]; then - export OUTPUT_FOLDER=behat-test-output/${{ matrix.feature }}/update - elif [[ ! -z "${{ matrix.with_optional }}" ]]; then - export OUTPUT_FOLDER=behat-test-output/${{ matrix.feature }}/with-optional - else - export OUTPUT_FOLDER=behat-test-output/${{ matrix.feature }} - fi - mkdir -p $OUTPUT_FOLDER - - # Move test results to the output folder if they exist - if (shopt -s nullglob; f=(html/profiles/contrib/social/tests/behat/logs/*); ((${#f[@]}))); then - mv html/profiles/contrib/social/tests/behat/logs/* $OUTPUT_FOLDER/ - fi - - # Move files from the mail spool to the output folder if they exist - if (shopt -s nullglob; f=(html/profiles/contrib/social/tests/behat/mail-spool/*); ((${#f[@]}))); then - mv html/profiles/contrib/social/tests/behat/mail-spool/* $OUTPUT_FOLDER/ - fi - - # Dump the database with the state of the test failure to allow for - # local inspection. - drush sql-dump > $OUTPUT_FOLDER/at-test-failure.sql - - - name: Upload Behat Test Output - if: failure() - uses: actions/upload-artifact@v3 - with: - name: behat-test-output - path: behat-test-output +#name: 'Behat' +# +## Controls when the workflow will run +#on: +# # Triggers the workflow on all pull request events +# pull_request: { } +# # Trigger workflow for release branches. +# push: +# branches: +# - main +# - "[0-9]+.[0-9]+.x" +# +## We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time. +## In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress +## when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to +## find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR). +#concurrency: +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: ${{ github.head_ref != '' }} +# +## github.head_ref is only set when the workflow was triggered by a pull_request and it contains the value of the source branch of the PR. +## github.ref_name will than only be used if the workflow was not triggered by a pull_request and it also just contains the branch name. +#env: +# BRANCH_NAME: ${{ github.head_ref || github.ref_name }} +# +## A workflow run is made up of one or more jobs that can run sequentially or in parallel +#jobs: +# feature_discovery: +# name: "Feature Discovery" +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# +# - run: sudo apt-get install jq +# +# - name: Find feature files +# id: set-matrix +# run: | +# echo -n "features=" >> $GITHUB_OUTPUT +# cd tests/behat/features/capabilities +# find * -type d -exec sh -c "ls {} | grep '\.feature$' > /dev/null" ';' -print | jq -R -s -c 'split("\n") | map(select(length > 0))' >> $GITHUB_OUTPUT +# +# outputs: +# features: ${{ steps.set-matrix.outputs.features }} +# +# install_previous_open_social: +# name: "Install previous Open Social major version" +# runs-on: ubuntu-22.04 +# container: +# image: goalgorilla/open_social_docker:ci-drupal10-php8.1-v2 +# volumes: +# - ${{ github.workspace }}:/var/www +# +# strategy: +# matrix: +# with_optional: +# - "" +# - "with-optional" +# +# services: +# db: +# image: mariadb:10.7 +# env: +# MYSQL_ROOT_PASSWORD: root +# MYSQL_DATABASE: social +# mailcatcher: +# image: schickling/mailcatcher +# env: +# VIRTUAL_HOST: mailcatcher.social.dev +# VIRTUAL_PORT: 1080 +# ports: +# - "1080" +# redis: +# image: redis:latest +# solr: +# image: ghcr.io/goalgorilla/ci-solr:8.11 +# env: +# SOLR_SOLR_MEM_SIZE: 512m +# PARTIAL_SEARCH_ENABLED: 0 +# options: --health-cmd="solr status" --health-interval=10s --health-timeout=5s --health-retries=3 +# +# defaults: +# run: +# shell: bash +# working-directory: /var/www +# +# steps: +# - uses: actions/checkout@v4 +# with: +# path: ${{ github.workspace }}/tmp +# +# # Checkout Drupal Social. +# - name: Prepare composer +# run: | +# cp tmp/tests/composer.json composer.json +# +# - name: Set-up the previous major version of Open Social +# run: | +# set -e +# +# apt-get update +# +# apt-get install -y jq +# # This gets all version info from composer for Open Social. We then +# # use jq to traverse and manipulate the JSON data to find ourselves +# # the current stable major version. +# PREVIOUS_MAJOR=`composer info -a --format json goalgorilla/open_social | jq '.versions | map(select(contains("-") == false)) | map(split(".")[0] | tonumber) | unique | reverse | .[0]'` +# echo "Setting up update test from Open Social $PREVIOUS_MAJOR" +# +# # Also include a hardcoded version for instaclick/php-webdriver, drupal/dynamic_entity_reference and drupal/core +# # as we didnt lock the version, and the patch isn't applying on the latest, so we require it +# # specifically to match the version that was installed at that moment in time. +# composer require goalgorilla/open_social:~$PREVIOUS_MAJOR instaclick/php-webdriver:1.4.16 drupal/dynamic_entity_reference:3.1.0 drupal/core:10.2.3 "drupal/flexible_permissions:^1.1.0" +# +# # Installation +# # This is purposefully duplicated because we may change how +# # installation works between major versions, so this provides us the +# # flexibility to reflect that in the workflow. +# cp tmp/tests/default.settings.php /var/www/html/sites/default/default.settings.php +# mkdir /var/www/files_private +# +# export OPTIONAL="" +# if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then +# export OPTIONAL="social_module_configure_form.select_all='TRUE'" +# fi +# +# drush site-install -y social --db-url=mysql://root:root@db:3306/social $OPTIONAL install_configure_form.update_status_module='array(FALSE,FALSE)' --site-name='Open Social' > >(tee install-output.log) 2> >(tee install-error.log >&2) +# drush en flexible_permissions +# +# # Dump the database to our test-output folder so that we can locally +# # debug if the update fails. +# mkdir -p behat-test-output +# if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then +# drush sql-dump > behat-test-output/pre-update-with-optional.sql +# else +# drush sql-dump > behat-test-output/pre-update.sql +# fi +# +# # Ensure there are no warnings or errors in the install-*.log. +# # We do this after the database dump because drush doesn't actually +# # exit, so this makes debugging easier. +# if grep -E '\[warning\]' install-output.log install-error.log 1>/dev/null || grep -E '\[error\]' install-output.log install-error.log 1>/dev/null; then +# # Move the install-*.log with warnings/errors and status messages to the test output. The text is viewable on +# # GitHub too but some people might find it easier to just download the artifact and get digging. +# if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then +# mv install-output.log behat-test-output/pre-update-install-output-with-optional.log +# mv install-error.log behat-test-output/pre-update-install-error-with-optional.log +# else +# mv install-output.log behat-test-output/pre-update-install-output.log +# mv install-error.log behat-test-output/pre-update-install-error.log +# fi +# +# # Abort our testing until the warning/error is fixed and let our user know why we stopped. +# echo "The drush install output should not contain any warnings or errors" +# exit 1 +# fi +# +# # Remove the composer files since we'll recreate this in the update. +# rm composer.* +# +# - name: Clean up checkout +# run: rm -r tmp +# +# - name: Package up previous version +# uses: actions/cache@v4 +# with: +# path: ${{ github.workspace }} +# key: ${{ github.sha }}-previous-version-${{ matrix.with_optional }} +# +# install_open_social: +# needs: [install_previous_open_social] +# +# name: "Install Open Social" +# runs-on: ubuntu-22.04 +# container: +# image: goalgorilla/open_social_docker:ci-drupal10-php8.1-v2 +# volumes: +# - ${{ github.workspace }}:/var/www +# +# strategy: +# matrix: +# update: +# - "" +# - "update" +# with_optional: +# - "" +# - "with-optional" +# +# services: +# db: +# image: mariadb:10.7 +# env: +# MYSQL_ROOT_PASSWORD: root +# MYSQL_DATABASE: social +# mailcatcher: +# image: schickling/mailcatcher +# env: +# VIRTUAL_HOST: mailcatcher.social.dev +# VIRTUAL_PORT: 1080 +# ports: +# - "1080" +# redis: +# image: redis:latest +# solr: +# image: ghcr.io/goalgorilla/ci-solr:8.11 +# env: +# SOLR_SOLR_MEM_SIZE: 512m +# PARTIAL_SEARCH_ENABLED: 0 +# +# defaults: +# run: +# shell: bash +# working-directory: /var/www +# +# steps: +# - name: Retrieve previous version +# if: ${{ matrix.update == 'update' }} +# uses: actions/cache@v4 +# with: +# fail-on-cache-miss: true +# path: ${{ github.workspace }} +# key: ${{ github.sha }}-previous-version-${{ matrix.with_optional }} +# +# - uses: actions/checkout@v4 +# with: +# path: ${{ github.workspace }}/tmp +# +# - name: Composer install to HEAD +# run: | +# set -e +# +# cp tmp/tests/composer.json composer.json +# +# # Composer has special handling for "version-like" branch names +# if [[ $BRANCH_NAME =~ [0-9]+\.[0-9]+\.x ]]; then +# composer require goalgorilla/open_social:$BRANCH_NAME-dev +# else +# composer require goalgorilla/open_social:dev-$BRANCH_NAME +# fi +# +# composer install +# +# cp tmp/tests/default.settings.php /var/www/html/sites/default/default.settings.php +# mkdir -p /var/www/files_private +# +# rm -r tmp/ +# +# - name: Update the previous major version to HEAD +# if: ${{ matrix.update == 'update' }} +# run: | +# set -e +# +# if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then +# drush sqlc < behat-test-output/pre-update-with-optional.sql +# else +# drush sqlc < behat-test-output/pre-update.sql +# fi +# +# vendor/bin/drush updb -y 2> >(tee update.log >&2) +# +# # Ensure there are no warnings or requirements errors in the update.log +# if grep -E '^>\s+\[warning\]\s' update.log 1>/dev/null || grep 'Requirements check reports errors. Do you wish to continue?' update.log 1>/dev/null; then +# # Move the update.log with warnings/errors and status messages to the test output. The text is viewable on +# # GitHub too but some people might find it easier to just download the artifact and get digging. +# if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then +# mv update.log behat-test-output/update-with-optional.log +# else +# mv update.log behat-test-output/update.log +# fi +# +# # Abort our testing until the warning/error is fixed and let our user know why we stopped. +# echo "The drush output should not contain any warnings or requirements errors" +# exit 1 +# fi +# +# - name: Set-up a new Open Social installation at HEAD +# if: ${{ matrix.update == '' }} +# run: | +# set -e +# +# export OPTIONAL="" +# if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then +# export OPTIONAL="social_module_configure_form.select_all='TRUE'" +# fi +# +# drush site-install -y social --db-url=mysql://root:root@db:3306/social $OPTIONAL install_configure_form.update_status_module='array(FALSE,FALSE)' --site-name='Open Social' > >(tee install-output.log) 2> >(tee install-error.log >&2) +# +# - name: Dump Database +# run: | +# mkdir -p behat-test-output +# if [[ ! -z "${{ matrix.update }}" ]] && [[ ! -z "${{ matrix.with_optional }}" ]]; then +# drush sql:dump > behat-test-output/installation-update-with-optional.sql +# elif [[ ! -z "${{ matrix.update }}" ]]; then +# drush sql:dump > behat-test-output/installation-update.sql +# elif [[ ! -z "${{ matrix.with_optional }}" ]]; then +# drush sql:dump > behat-test-output/installation-with-optional.sql +# else +# drush sql:dump > behat-test-output/installation.sql +# fi +# +# - name: Validate install contained no errors +# if: ${{ matrix.update == '' }} +# run: | +# # Ensure there are no warnings or errors in the install-*.log. +# # We do this after database dumping to help debugging. +# if grep -E '\[warning\]' install-output.log install-error.log 1>/dev/null || grep -E '\[error\]' install-output.log install-error.log 1>/dev/null; then +# # Move the install-*.log with warnings/errors and status messages to the test output. The text is viewable on +# # GitHub too but some people might find it easier to just download the artifact and get digging. +# if [[ "${{ matrix.with_optional }}" == "with-optional" ]]; then +# mv install-output.log behat-test-output/install-output-with-optional.log +# mv install-error.log behat-test-output/install-error-with-optional.log +# else +# mv install-output.log behat-test-output/install-output.log +# mv install-error.log behat-test-output/install-error.log +# fi +# +# # Abort our testing until the warning/error is fixed and let our user know why we stopped. +# echo "The drush install output should not contain any warnings or errors" +# exit 1 +# fi +# +# - name: Fix owner of web files +# run: chown -R www-data:www-data /var/www +# +# - name: Package up site +# uses: actions/cache@v4 +# with: +# path: ${{ github.workspace }} +# key: ${{ github.sha }}-test-setup-${{ matrix.update}}${{ matrix.with_optional }} +# +# - name: Upload Installation database +# if: failure() +# uses: actions/upload-artifact@v3 +# with: +# name: behat-test-output +# path: behat-test-output +# +# # This workflow contains a single job called "Running tests" +# tests: +# needs: [feature_discovery, install_open_social] +# +# name: 'Tests' +# runs-on: ubuntu-22.04 +# container: +# image: goalgorilla/open_social_docker:ci-drupal10-php8.1-v2 +# volumes: +# - ${{ github.workspace }}:/var/www +# +# strategy: +# fail-fast: false +# matrix: +# feature: ${{ fromJson(needs.feature_discovery.outputs.features) }} +# update: +# - "" +# - "update" +# with_optional: +# - "" +# - "with-optional" +# +# services: +# web: +# image: goalgorilla/open_social_docker:ci-drupal10-php8.1-v2 +# env: +# DRUPAL_SETTINGS: production +# volumes: +# - ${{ github.workspace }}:/var/www +# ports: +# - "80" +# db: +# image: mariadb:10.7 +# env: +# MYSQL_ROOT_PASSWORD: root +# MYSQL_DATABASE: social +# mailcatcher: +# image: schickling/mailcatcher +# env: +# VIRTUAL_HOST: mailcatcher.social.dev +# VIRTUAL_PORT: 1080 +# ports: +# - "1080" +# redis: +# image: redis:latest +# solr: +# image: ghcr.io/goalgorilla/ci-solr:8.11 +# env: +# SOLR_SOLR_MEM_SIZE: 512m +# PARTIAL_SEARCH_ENABLED: 0 +# chrome: +# # We use an image based on zenika/alpine-chrome:latest so we can add +# # the start-up arguments that we need. +# image: kingdutch/social-docker-chrome +# ports: +# - '9222:9222' +# +# defaults: +# run: +# shell: bash +# working-directory: /var/www +# +# steps: +# - name: Download Site +# uses: actions/cache@v4 +# with: +# fail-on-cache-miss: true +# path: ${{ github.workspace }} +# key: ${{ github.sha }}-test-setup-${{ matrix.update}}${{ matrix.with_optional }} +# +# # We could run all tests at once by passing the folder directly to behat +# # however, by doing this manually in a loop we have the ability to ensure +# # each test runs against a clean database cheaply. +# - name: Run Integration test +# run: | +# if [[ ! -z "${{ matrix.update }}" ]] && [[ ! -z "${{ matrix.with_optional }}" ]]; then +# export TEST_DATABASE=`pwd`/behat-test-output/installation-update-with-optional.sql +# elif [[ ! -z "${{ matrix.update }}" ]]; then +# export TEST_DATABASE=`pwd`/behat-test-output/installation-update.sql +# elif [[ ! -z "${{ matrix.with_optional }}" ]]; then +# export TEST_DATABASE=`pwd`/behat-test-output/installation-with-optional.sql +# else +# export TEST_DATABASE=`pwd`/behat-test-output/installation.sql +# fi +# vendor/bin/behat --version +# for test in html/profiles/contrib/social/tests/behat/features/capabilities/${{ matrix.feature }}/*.feature; do +# if head -n1 $test | grep -q "@disabled"; then +# echo "$test - Skipping disabled test" +# continue +# fi +# +# # If we're testing a clean install (i.e. not updating) then ignore +# # any tests that have opted out of install testing. +# if [[ -z "${{ matrix.update }}" ]]; then +# export TAGS="--tags=~no-install" +# # Do the same when we are testing with an update. +# else +# export TAGS="--tags=~no-update" +# fi +# +# # Tests with the @no-database tag import their own scaffold so they +# # ignore the databases provided by our test matrix, that's why we +# # only run them once when all our matrix values are off. +# if [[ ! -z "${{ matrix.update }}" ]] || [[ ! -z "${{ matrix.with_optional }}" ]]; then +# export TAGS="$TAGS&&~no-database" +# fi +# +# echo "::group::$test" +# # Run in subshell to make the test command visible and copyable. +# (set -x; vendor/bin/behat -vv --config html/profiles/contrib/social/tests/behat/behat.yml --colors --allow-empty $TAGS $test) +# echo "::endgroup::" +# done +# +# - name: Move test artifacts into upload folder +# if: failure() +# run: | +# set -e +# +# # Make the output folder +# if [[ ! -z "${{ matrix.update }}" ]] && [[ ! -z "${{ matrix.with_optional }}" ]]; then +# export OUTPUT_FOLDER=behat-test-output/${{ matrix.feature }}/update-with-optional +# elif [[ ! -z "${{ matrix.update }}" ]]; then +# export OUTPUT_FOLDER=behat-test-output/${{ matrix.feature }}/update +# elif [[ ! -z "${{ matrix.with_optional }}" ]]; then +# export OUTPUT_FOLDER=behat-test-output/${{ matrix.feature }}/with-optional +# else +# export OUTPUT_FOLDER=behat-test-output/${{ matrix.feature }} +# fi +# mkdir -p $OUTPUT_FOLDER +# +# # Move test results to the output folder if they exist +# if (shopt -s nullglob; f=(html/profiles/contrib/social/tests/behat/logs/*); ((${#f[@]}))); then +# mv html/profiles/contrib/social/tests/behat/logs/* $OUTPUT_FOLDER/ +# fi +# +# # Move files from the mail spool to the output folder if they exist +# if (shopt -s nullglob; f=(html/profiles/contrib/social/tests/behat/mail-spool/*); ((${#f[@]}))); then +# mv html/profiles/contrib/social/tests/behat/mail-spool/* $OUTPUT_FOLDER/ +# fi +# +# # Dump the database with the state of the test failure to allow for +# # local inspection. +# drush sql-dump > $OUTPUT_FOLDER/at-test-failure.sql +# +# - name: Upload Behat Test Output +# if: failure() +# uses: actions/upload-artifact@v3 +# with: +# name: behat-test-output +# path: behat-test-output diff --git a/.github/workflows/bestPractices.yml b/.github/workflows/bestPractices.yml index b55c08e8b50..0b0bccd10b6 100644 --- a/.github/workflows/bestPractices.yml +++ b/.github/workflows/bestPractices.yml @@ -1,69 +1,69 @@ -# This file contains custom lints that are not common to PHP/Drupal projects but -# are specific to how we want to build products at Open Social. These only run -# on pull requests since they are input for reviewer conversations and not hard -# rules such as our quality checks. -name: Best practices - -# Contrary to the other jobs we only perform these checks on pull requests and accept that if a PR is merged despite -# checks failing we can ignore the addition on the main branch. There might be good reasons for developers to deviate -# from best practices (but if you're reading this, we do expect a good motivation written in the PR). -on: - pull_request: { } - -defaults: - run: - shell: bash - -jobs: - config_overrides: - name: No config overrides added - runs-on: ubuntu-latest - continue-on-error: true - outputs: - outcome: ${{ steps.test.outcome }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # We're only interested in config overrides being added. - # grep exits with 0 if it has matches, which we consider to be a fail - # so we invert. - - id: test - run: "! git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- '**/*.services.yml' | grep -e '^+' | grep config.factory.override" - - helper_classes: - name: No helper objects introduced - runs-on: ubuntu-latest - continue-on-error: true - outputs: - outcome: ${{ steps.test.outcome }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # We're only interested in Helper classes being added. - # grep exits with 0 if it has matches, which we consider to be a fail, so we invert. - - id: test - run: "! git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} --name-only --diff-filter=A | grep Helper" - - post_helper_message: - if: always() - needs: [config_overrides, helper_classes] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/github-script@v7 - env: - CONFIG_OVERRIDES_RESULT: ${{ needs.config_overrides.outputs.outcome }} - HELPERS_ADDED_RESULT: ${{ needs.helper_classes.outputs.outcome }} - with: - script: | - const errors = { - hasConfigOverrides: process.env.CONFIG_OVERRIDES_RESULT === "failure", - hasHelpersAdded: process.env.HELPERS_ADDED_RESULT === "failure", - }; - - const script = require('./.github/workflows/bestPracticesFeedback.js') - await script({github, context}, errors); +## This file contains custom lints that are not common to PHP/Drupal projects but +## are specific to how we want to build products at Open Social. These only run +## on pull requests since they are input for reviewer conversations and not hard +## rules such as our quality checks. +#name: Best practices +# +## Contrary to the other jobs we only perform these checks on pull requests and accept that if a PR is merged despite +## checks failing we can ignore the addition on the main branch. There might be good reasons for developers to deviate +## from best practices (but if you're reading this, we do expect a good motivation written in the PR). +#on: +# pull_request: { } +# +#defaults: +# run: +# shell: bash +# +#jobs: +# config_overrides: +# name: No config overrides added +# runs-on: ubuntu-latest +# continue-on-error: true +# outputs: +# outcome: ${{ steps.test.outcome }} +# steps: +# - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 +# +# # We're only interested in config overrides being added. +# # grep exits with 0 if it has matches, which we consider to be a fail +# # so we invert. +# - id: test +# run: "! git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- '**/*.services.yml' | grep -e '^+' | grep config.factory.override" +# +# helper_classes: +# name: No helper objects introduced +# runs-on: ubuntu-latest +# continue-on-error: true +# outputs: +# outcome: ${{ steps.test.outcome }} +# steps: +# - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 +# +# # We're only interested in Helper classes being added. +# # grep exits with 0 if it has matches, which we consider to be a fail, so we invert. +# - id: test +# run: "! git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} --name-only --diff-filter=A | grep Helper" +# +# post_helper_message: +# if: always() +# needs: [config_overrides, helper_classes] +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/github-script@v7 +# env: +# CONFIG_OVERRIDES_RESULT: ${{ needs.config_overrides.outputs.outcome }} +# HELPERS_ADDED_RESULT: ${{ needs.helper_classes.outputs.outcome }} +# with: +# script: | +# const errors = { +# hasConfigOverrides: process.env.CONFIG_OVERRIDES_RESULT === "failure", +# hasHelpersAdded: process.env.HELPERS_ADDED_RESULT === "failure", +# }; +# +# const script = require('./.github/workflows/bestPracticesFeedback.js') +# await script({github, context}, errors); diff --git a/.github/workflows/prManager.yml b/.github/workflows/prManager.yml index 5e46a5c561a..a0891fbf983 100644 --- a/.github/workflows/prManager.yml +++ b/.github/workflows/prManager.yml @@ -1,58 +1,58 @@ -# This file runs our script that helps us manage pull requests. -name: PR Manager - -# This script runs on a lot of cases because it helps us automated labelling and -# other feedback based on the actions people take with -on: - pull_request: - types: - - assigned - - unassigned - - labeled - - unlabeled - - opened - - edited - - closed - - reopened - - synchronize - - converted_to_draft - - locked - - unlocked - - enqueued - - dequeued - - milestoned - - demilestoned - - ready_for_review - - review_requested - - review_request_removed - - auto_merge_enabled - - auto_merge_disabled - -# We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time. -# In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress -# when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to -# find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR). -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.head_ref != '' }} - -defaults: - run: - shell: bash - -jobs: - manage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: npm ci - working-directory: ./.github/prManager - - - uses: actions/github-script@v7 - with: - script: | - const { default: script } = await import('${{ github.workspace }}/.github/prManager/src/main.js') - await script({github, context}); +## This file runs our script that helps us manage pull requests. +#name: PR Manager +# +## This script runs on a lot of cases because it helps us automated labelling and +## other feedback based on the actions people take with +#on: +# pull_request: +# types: +# - assigned +# - unassigned +# - labeled +# - unlabeled +# - opened +# - edited +# - closed +# - reopened +# - synchronize +# - converted_to_draft +# - locked +# - unlocked +# - enqueued +# - dequeued +# - milestoned +# - demilestoned +# - ready_for_review +# - review_requested +# - review_request_removed +# - auto_merge_enabled +# - auto_merge_disabled +# +## We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time. +## In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress +## when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to +## find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR). +#concurrency: +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: ${{ github.head_ref != '' }} +# +#defaults: +# run: +# shell: bash +# +#jobs: +# manage: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-node@v4 +# with: +# node-version: 20 +# - run: npm ci +# working-directory: ./.github/prManager +# +# - uses: actions/github-script@v7 +# with: +# script: | +# const { default: script } = await import('${{ github.workspace }}/.github/prManager/src/main.js') +# await script({github, context}); diff --git a/.github/workflows/prManagerTest.yml b/.github/workflows/prManagerTest.yml index d82fb5b123f..e71786e37b5 100644 --- a/.github/workflows/prManagerTest.yml +++ b/.github/workflows/prManagerTest.yml @@ -1,34 +1,34 @@ -# Run the automated test suite for the PR manager in case it changes. -name: PR Manager Test - -on: - pull_request: - paths: - # Only run in case the PR Manager code or workflow changes. - - '.github/prManager/**' - -# We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time. -# In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress -# when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to -# find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR). -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.head_ref != '' }} - -defaults: - run: - shell: bash - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: npm ci - working-directory: ./.github/prManager - - - run: npm run test - working-directory: ./.github/prManager +## Run the automated test suite for the PR manager in case it changes. +#name: PR Manager Test +# +#on: +# pull_request: +# paths: +# # Only run in case the PR Manager code or workflow changes. +# - '.github/prManager/**' +# +## We use the default concurrency grouping of allowing a single workflow per branch/PR/tag to run at the same time. +## In case of PRs we only care about the results for the last workflow run, so we cancel workflows already in progress +## when new code is pushed, in all other cases (branches/tags) we want to have a history for commits so it's easier to +## find breakages when they occur (head_ref is non-empty only when the workflow is triggered from a PR). +#concurrency: +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: ${{ github.head_ref != '' }} +# +#defaults: +# run: +# shell: bash +# +#jobs: +# test: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-node@v4 +# with: +# node-version: 20 +# - run: npm ci +# working-directory: ./.github/prManager +# +# - run: npm run test +# working-directory: ./.github/prManager diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml index d4c6778488a..b884cdf2c45 100644 --- a/.github/workflows/translations.yml +++ b/.github/workflows/translations.yml @@ -1,113 +1,113 @@ -name: Translations - -on: - push: - branches: - - main - -permissions: {} - -jobs: - extract: - permissions: - contents: write # to make pull request (goalgorilla/create-pull-request) - pull-requests: write # to make pull request (goalgorilla/create-pull-request) - - name: Extract - runs-on: ubuntu-latest - steps: - - name: Install Gettext tools - run: sudo apt-get install gettext - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.1 - - - name: Configure Git - run: | - git config --global user.email "noreply@getopensocial.com" - git config --global user.name "Open Social Translation Workflow" - - - name: Checkout code - uses: actions/checkout@v4 - with: - # Since composer must clone from this we require all the history. - fetch-depth: 0 - - - name: Prepare Installation Directory - run: | - mkdir ${RUNNER_TEMP}/installation - cp tests/composer.json ${RUNNER_TEMP}/installation/composer.json - - - name: Install Open Social - working-directory: ${{ runner.temp }}/installation - run: | - composer config repositories.social vcs ${GITHUB_WORKSPACE} - composer require goalgorilla/open_social:dev-${GITHUB_REF_NAME} - - - name: Install Open Social Translation Extractor - env: - COMPOSER_AUTH: '{"http-basic": {"repo.packagist.com": {"username": "token", "password": "${{secrets.COMPOSER_TOOLS_AUTH}}"}}}' # [tl! **] - run: | - mkdir ${RUNNER_TEMP}/oste - cd ${RUNNER_TEMP}/oste - composer init -n --name="goalgorilla/extractor" - composer config repositories.oste '{"type": "composer", "url": "https://repo.packagist.com/opensocial/distribution-tools/", "only": ["goalgorilla/oste"] }' - composer require --dev --prefer-dist --no-progress goalgorilla/oste:dev-main - - - name: Setup Extractor - run: | - mkdir -p ${RUNNER_TEMP}/extractor - ${RUNNER_TEMP}/oste/vendor/goalgorilla/oste/bin/setup-extractor.sh ${RUNNER_TEMP}/extractor - - - name: Extract Translations - working-directory: ${{ runner.temp }}/installation/html/profiles/contrib - run: | - CHANGES_FILE="${RUNNER_TEMP}/CHANGES.md" - touch $CHANGES_FILE - - NAME="social" - TRANSLATIONS_FOLDER="${GITHUB_WORKSPACE}/translations" - - ${RUNNER_TEMP}/oste/vendor/goalgorilla/oste/bin/extract-source.sh ${RUNNER_TEMP}/extractor "${NAME}" "${TRANSLATIONS_FOLDER}" - - cd $GITHUB_WORKSPACE - - CHANGES=`${RUNNER_TEMP}/oste/vendor/goalgorilla/oste/bin/list-changes.sh translations/en.pot` - if [[ ! -z "$CHANGES" ]]; then - echo "\`\`\`diff" >> $CHANGES_FILE - echo "$CHANGES" >> $CHANGES_FILE - echo "\`\`\`" >> $CHANGES_FILE - fi - - # Commit the changes for Open Social - ${RUNNER_TEMP}/oste/vendor/goalgorilla/oste/bin/commit-updated-po-files.sh --yes Updating translation source strings - - - name: Collect Changes - id: changesets - run: | - CHANGES="$(cat "${RUNNER_TEMP}/CHANGES.md")" - - if [[ -z "$CHANGES" ]]; then - CHANGES="No changes" - fi - - PR_BODY=$(cat < "${RUNNER_TEMP}/CHANGES.md" - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - branch: automation/translations-source-extraction - delete-branch: true - title: Updated source translations - body-path: ${{ runner.temp }}/CHANGES.md - labels: automated,translations +#name: Translations +# +#on: +# push: +# branches: +# - main +# +#permissions: {} +# +#jobs: +# extract: +# permissions: +# contents: write # to make pull request (goalgorilla/create-pull-request) +# pull-requests: write # to make pull request (goalgorilla/create-pull-request) +# +# name: Extract +# runs-on: ubuntu-latest +# steps: +# - name: Install Gettext tools +# run: sudo apt-get install gettext +# +# - name: Setup PHP +# uses: shivammathur/setup-php@v2 +# with: +# php-version: 8.1 +# +# - name: Configure Git +# run: | +# git config --global user.email "noreply@getopensocial.com" +# git config --global user.name "Open Social Translation Workflow" +# +# - name: Checkout code +# uses: actions/checkout@v4 +# with: +# # Since composer must clone from this we require all the history. +# fetch-depth: 0 +# +# - name: Prepare Installation Directory +# run: | +# mkdir ${RUNNER_TEMP}/installation +# cp tests/composer.json ${RUNNER_TEMP}/installation/composer.json +# +# - name: Install Open Social +# working-directory: ${{ runner.temp }}/installation +# run: | +# composer config repositories.social vcs ${GITHUB_WORKSPACE} +# composer require goalgorilla/open_social:dev-${GITHUB_REF_NAME} +# +# - name: Install Open Social Translation Extractor +# env: +# COMPOSER_AUTH: '{"http-basic": {"repo.packagist.com": {"username": "token", "password": "${{secrets.COMPOSER_TOOLS_AUTH}}"}}}' # [tl! **] +# run: | +# mkdir ${RUNNER_TEMP}/oste +# cd ${RUNNER_TEMP}/oste +# composer init -n --name="goalgorilla/extractor" +# composer config repositories.oste '{"type": "composer", "url": "https://repo.packagist.com/opensocial/distribution-tools/", "only": ["goalgorilla/oste"] }' +# composer require --dev --prefer-dist --no-progress goalgorilla/oste:dev-main +# +# - name: Setup Extractor +# run: | +# mkdir -p ${RUNNER_TEMP}/extractor +# ${RUNNER_TEMP}/oste/vendor/goalgorilla/oste/bin/setup-extractor.sh ${RUNNER_TEMP}/extractor +# +# - name: Extract Translations +# working-directory: ${{ runner.temp }}/installation/html/profiles/contrib +# run: | +# CHANGES_FILE="${RUNNER_TEMP}/CHANGES.md" +# touch $CHANGES_FILE +# +# NAME="social" +# TRANSLATIONS_FOLDER="${GITHUB_WORKSPACE}/translations" +# +# ${RUNNER_TEMP}/oste/vendor/goalgorilla/oste/bin/extract-source.sh ${RUNNER_TEMP}/extractor "${NAME}" "${TRANSLATIONS_FOLDER}" +# +# cd $GITHUB_WORKSPACE +# +# CHANGES=`${RUNNER_TEMP}/oste/vendor/goalgorilla/oste/bin/list-changes.sh translations/en.pot` +# if [[ ! -z "$CHANGES" ]]; then +# echo "\`\`\`diff" >> $CHANGES_FILE +# echo "$CHANGES" >> $CHANGES_FILE +# echo "\`\`\`" >> $CHANGES_FILE +# fi +# +# # Commit the changes for Open Social +# ${RUNNER_TEMP}/oste/vendor/goalgorilla/oste/bin/commit-updated-po-files.sh --yes Updating translation source strings +# +# - name: Collect Changes +# id: changesets +# run: | +# CHANGES="$(cat "${RUNNER_TEMP}/CHANGES.md")" +# +# if [[ -z "$CHANGES" ]]; then +# CHANGES="No changes" +# fi +# +# PR_BODY=$(cat < "${RUNNER_TEMP}/CHANGES.md" +# +# - name: Create Pull Request +# uses: peter-evans/create-pull-request@v6 +# with: +# branch: automation/translations-source-extraction +# delete-branch: true +# title: Updated source translations +# body-path: ${{ runner.temp }}/CHANGES.md +# labels: automated,translations diff --git a/modules/social_features/social_event/social_event.module b/modules/social_features/social_event/social_event.module index 6822d41b7ec..ced06b60810 100644 --- a/modules/social_features/social_event/social_event.module +++ b/modules/social_features/social_event/social_event.module @@ -29,7 +29,6 @@ use Drupal\menu_link_content\MenuLinkContentInterface; use Drupal\node\Entity\Node; use Drupal\node\NodeInterface; use Drupal\social_event\Controller\SocialEventController; -use Drupal\social_event\EdaHandler; use Drupal\social_event\Entity\Node\Event; use Drupal\social_event\EventEnrollmentInterface; use Drupal\social_event\SocialEventDateAllDay; diff --git a/phpstan.neon b/phpstan.neon index 7d139fadd79..5515c1b0c39 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -68,3 +68,14 @@ parameters: ignoreErrors: # See - https://github.com/mglaman/drupal-check/pull/187 - '#Unsafe usage of new static\(\)#' + + # Stub files provide type information for classes and functions that are + # otherwise difficult to analyze, improving the accuracy of PHPStan's checks. + stubFiles: + - src/PHPStan/Stubs/social_eda/Address.stub + - src/PHPStan/Stubs/social_eda/DateTime.stub + - src/PHPStan/Stubs/social_eda/Entity.stub + - src/PHPStan/Stubs/social_eda/Href.stub + - src/PHPStan/Stubs/social_eda/User.stub + - src/PHPStan/Stubs/social_eda_dispatcher/Dispatcher.stub + - src/PHPStan/Stubs/social_eda_dispatcher/CloudEvent.stub diff --git a/src/PHPStan/Stubs/social_eda/Address.stub b/src/PHPStan/Stubs/social_eda/Address.stub new file mode 100644 index 00000000000..63fc787cfb0 --- /dev/null +++ b/src/PHPStan/Stubs/social_eda/Address.stub @@ -0,0 +1,19 @@ +