acquia-cms-starterkit CI #2715
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: acquia-cms-starterkit CI | |
on: | |
schedule: | |
# "At minute 0 past hour 4 and 8 UTC." | |
- cron: '0 4,8 * * *' | |
push: | |
branches: [ develop, main, ACMS* ] | |
paths-ignore: | |
- README.md | |
pull_request: | |
branches: [ develop ] | |
paths-ignore: | |
- README.md | |
env: | |
ORCA_SUT_NAME: acquia/acquia-cms-starterkit | |
ORCA_SUT_BRANCH: develop | |
ORCA_VERSION: ^4 | |
ORCA_PACKAGES_CONFIG_ALTER: ../acquia-cms-starterkit/tests/packages_alter.yml | |
ORCA_ENABLE_NIGHTWATCH: "FALSE" | |
DB_DATABASE: drupal | |
DB_USER: drupal | |
DB_PASSWORD: drupal | |
ORCA_PHPCS_STANDARD: AcquiaPHP | |
COMPOSER_PROCESS_TIMEOUT: 1800 | |
jobs: | |
# @todo add tests to validate each starter-kit use case. | |
STATIC_CODE_ANALYSIS: | |
name: "Static Code Analysis" | |
runs-on: ubuntu-latest | |
env: | |
ORCA_JOB: STATIC_CODE_ANALYSIS | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: xdebug | |
- name: Download ORCA | |
run: composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n | |
- name: Run GrumpPHP tests | |
run: | | |
composer install | |
./vendor/bin/grumphp run | |
- name: Before Install | |
run: ../orca/bin/ci/before_install.sh | |
- name: Install | |
shell: 'script -q -e -c "bash {0}"' | |
run: ../orca/bin/ci/install.sh | |
- name: Before script | |
run: ../orca/bin/ci/before_script.sh | |
- name: Script | |
run: ../orca/bin/ci/script.sh | |
- name: After script | |
run: | | |
../orca/bin/ci/after_success.sh | |
../orca/bin/ci/after_failure.sh | |
../orca/bin/ci/after_script.sh | |
VERIFY_ACMS_STARTERKIT_ON_DRUPAL_PROJECT: | |
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} | |
name: "Verify ${{ matrix.starter-kits }} with demo-content=${{ matrix.demo-content }}, content-model=${{ matrix.content-model }}, dam-integration=${{ matrix.dam-integration }}, gdpr-integration=${{ matrix.gdpr-integration }}, core-version=${{ matrix.core-version }} on acquia/drupal-recommended-project" | |
runs-on: ubuntu-latest | |
env: | |
demo_content: ${{ matrix.demo-content }} | |
content_model: ${{ matrix.content-model }} | |
dam_integration: ${{ matrix.dam-integration }} | |
CONNECTOR_ID: ${{ secrets.CONNECTOR_ID }} | |
GMAPS_KEY: ${{ secrets.GMAPS_KEY }} | |
SEARCH_UUID: ${{ secrets.SEARCH_UUID }} | |
SITESTUDIO_API_KEY: ${{ secrets.SITESTUDIO_API_KEY }} | |
SITESTUDIO_ORG_KEY: ${{ secrets.SITESTUDIO_ORG_KEY }} | |
gdpr_integration: ${{ matrix.gdpr-integration }} | |
CI: TRUE | |
strategy: | |
matrix: | |
core-version: ["CURRENT", "OLDEST_SUPPORTED"] | |
starter-kits: ["acquia_cms_enterprise_low_code", "acquia_cms_community", "acquia_cms_headless"] | |
demo-content: ["yes", "no"] | |
content-model: ["yes", "no"] | |
dam-integration: ["yes", "no"] | |
gdpr-integration: ["yes", "no"] | |
exclude: | |
- demo-content: "yes" | |
content-model: "yes" | |
- demo-content: "no" | |
content-model: "no" | |
dam-integration: "yes" | |
- demo-content: "yes" | |
content-model: "no" | |
dam-integration: "no" | |
- demo-content: "no" | |
content-model: "no" | |
gdpr-integration: "yes" | |
- demo-content: "yes" | |
content-model: "no" | |
gdpr-integration: "no" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: xdebug | |
- name: Set up MySQL | |
run: | | |
sudo /etc/init.d/mysql start | |
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -uroot -proot | |
mysql -e 'SHOW DATABASES;' -uroot -proot | |
mysql -e 'CREATE USER "drupal"@"localhost" IDENTIFIED BY "drupal";' -uroot -proot | |
mysql -e 'GRANT ALL PRIVILEGES ON *.* TO "drupal"@"localhost" WITH GRANT OPTION;' -uroot -proot | |
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot | |
mysql -e 'SHOW GRANTS FOR "drupal"@"localhost";' -uroot -proot | |
- name: Download Composer Dependencies | |
run: composer install | |
- name: Download ORCA | |
run: | | |
cd .. | |
composer create-project --no-dev --ignore-platform-req=php acquia/orca orca "$ORCA_VERSION" | |
cd - | |
- name: Before Install | |
run: ../orca/bin/orca fixture:init --core=${{ matrix.core-version }} --sut=${ORCA_SUT_NAME} --profile=minimal --no-site-install --no-sqlite | |
- name: Install | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
cd ../orca-build | |
composer config -g github-oauth.github.com ${{ secrets.OAUTH_TOKEN }} | |
# For drupal core 10.1.x, we've to use Acquia CMS Common of release 3.2.x. | |
bash -c 'VERSION=$(composer show drupal/core | grep "versions" | sed "s/[^0-9.]//g"); [[ "${VERSION}" == 10.1.* ]] && sed -i "s/shield/shield\n - acquia_cms_common:~3.2.8/" ../acquia-cms-starterkit/acms/acms.yml;' | |
./vendor/bin/acms acms:install ${{ matrix.starter-kits }} --uri=${{ matrix.starter-kits }} --no-interaction | |
# Revert back, after above command runs. | |
cd - && git checkout . | |
- name: Execute all PHPUnit tests | |
run: ./vendor/bin/phpunit | |
- name: Before script | |
run: ../orca/bin/ci/before_script.sh | |
- name: Script | |
run: ../orca/bin/ci/script.sh | |
- name: After script | |
run: | | |
../orca/bin/ci/after_success.sh | |
../orca/bin/ci/after_failure.sh | |
../orca/bin/ci/after_script.sh | |
VERIFY_ACMS_HEADLESS_WITH_NEXTJS: | |
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} | |
name: "Verify ACMS Headless and NextJs with core-version=${{ matrix.core-version }} on acquia/drupal-recommended-project" | |
runs-on: ubuntu-latest | |
env: | |
demo_content: "yes" | |
CONNECTOR_ID: ${{ secrets.CONNECTOR_ID }} | |
GMAPS_KEY: ${{ secrets.GMAPS_KEY }} | |
SEARCH_UUID: ${{ secrets.SEARCH_UUID }} | |
nextjs_app: "yes" | |
nextjs_app_site_url: "http://localhost:3000" | |
nextjs_app_site_name: "Headless Site 1" | |
nextjs_app_env_file: "" | |
CI: TRUE | |
strategy: | |
matrix: | |
core-version: ["CURRENT", "OLDEST_SUPPORTED"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: xdebug | |
- name: Setup NextJs Application | |
run: | | |
cd .. | |
npx create-next-app -e https://github.com/acquia/next-acms/tree/main/starters/basic-starter nextjs_app | |
cd nextjs_app | |
cp .env.example .env.local | |
nextjs_app_path=$(pwd) | |
echo "${nextjs_app_path}" | |
echo "nextjs_app_env_file=${nextjs_app_path}/.env.local" >> ${GITHUB_ENV} | |
- name: Set up MySQL | |
run: | | |
sudo /etc/init.d/mysql start | |
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -uroot -proot | |
mysql -e 'SHOW DATABASES;' -uroot -proot | |
mysql -e 'CREATE USER "drupal"@"localhost" IDENTIFIED BY "drupal";' -uroot -proot | |
mysql -e 'GRANT ALL PRIVILEGES ON *.* TO "drupal"@"localhost" WITH GRANT OPTION;' -uroot -proot | |
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot | |
mysql -e 'SHOW GRANTS FOR "drupal"@"localhost";' -uroot -proot | |
- name: Download Composer Dependencies | |
run: composer install | |
- name: Download ORCA | |
run: | | |
cd .. | |
composer create-project --no-dev --ignore-platform-req=php acquia/orca orca "$ORCA_VERSION" | |
cd - | |
- name: Before Install | |
run: ../orca/bin/orca fixture:init --core=${{ matrix.core-version }} --sut=${ORCA_SUT_NAME} --profile=minimal --no-site-install --no-sqlite | |
- name: Install | |
shell: 'script -q -e -c "bash {0}"' | |
run: | | |
cd ../orca-build | |
composer config -g github-oauth.github.com ${{ secrets.OAUTH_TOKEN }} | |
# The composer tries to download the latest minor release of Acquia CMS Common i.e 3.3.x, | |
# but it supports 10.2.x and above. So for drupal core 10.1.x, we've to use release 3.2.x. | |
bash -c 'VERSION=$(composer show drupal/core | grep "versions" | sed "s/[^0-9.]//g"); [[ "${VERSION}" == 10.1.* ]] && sed -i "s/shield/shield\n - acquia_cms_common:~3.2.8/" ../acquia-cms-starterkit/acms/acms.yml;' | |
./vendor/bin/acms acms:install acquia_cms_headless --no-interaction | |
# Revert back acms.yml file changes that we've updated earlier to make sure CI pass for Drupal Core 10.1.x. | |
cd - && git checkout . | |
- name: Execute all PHPUnit tests | |
run: ./vendor/bin/phpunit | |
- name: Before script | |
run: ../orca/bin/ci/before_script.sh | |
- name: Script | |
run: ../orca/bin/ci/script.sh | |
- name: After script | |
run: | | |
../orca/bin/ci/after_success.sh | |
../orca/bin/ci/after_failure.sh | |
../orca/bin/ci/after_script.sh | |
VERIFY_ACMS_INSTALL_CURRENT_PROJECT: | |
name: "Verify commands on current project (Non Drupal)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: xdebug | |
- name: Set up MySQL | |
run: | | |
sudo /etc/init.d/mysql start | |
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -uroot -proot | |
mysql -e 'SHOW DATABASES;' -uroot -proot | |
mysql -e 'CREATE USER "drupal"@"localhost" IDENTIFIED BY "drupal";' -uroot -proot | |
mysql -e 'GRANT ALL PRIVILEGES ON *.* TO "drupal"@"localhost" WITH GRANT OPTION;' -uroot -proot | |
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot | |
mysql -e 'SHOW GRANTS FOR "drupal"@"localhost";' -uroot -proot | |
- name: Download Composer Dependencies | |
run: composer install | |
- name: Install | |
shell: 'script -q -e -c "bash {0}"' | |
run: ./bin/acms acms:install --no-interaction | |
- name: Execute all PHPUnit tests | |
run: ./vendor/bin/phpunit |