Skip to content

Search API Pantheon #2679

Search API Pantheon

Search API Pantheon #2679

Workflow file for this run

name: Search API Pantheon
permissions:
contents: read
concurrency:
group: 'ci-${{ github.head_ref || github.ref }}'
cancel-in-progress: true
on:
push:
repository_dispatch:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
tmate_enabled:
description: Enable tmate debugging
required: true
default: "0"
jobs:
linting:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ["8.1", "8.5"]
name: Code linting (PHP ${{ matrix.php-version }})
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
with:
php-version: ${{ matrix.php-version }}
- name: Composer install
run: composer install --ignore-platform-reqs
- name: Code sniff
run: composer run-script code:lint
phpcompatibility:
runs-on: ubuntu-latest
name: PHP Compatibility
steps:
- name: PHPCompatibility
uses: pantheon-systems/phpcompatibility-action@44be5a8381691b9a209404a3f45df8254f1ce08f # v1
with:
test-versions: 8.1-
deploy_multidev:
# Test combinations (floor + ceiling per Drupal version, both Solr versions):
# Drupal 10: PHP 8.1, 8.4
# Drupal 11: PHP 8.3, 8.5
# Each tested with Solr 8 and 9
strategy:
matrix:
drupal-version: [ 10, 11 ]
php-version: [ "8.1", "8.3", "8.4", "8.5" ]
solr-version: [ 8, 9 ]
exclude:
- drupal-version: 10
php-version: "8.3"
- drupal-version: 10
php-version: "8.5"
- drupal-version: 11
php-version: "8.1"
- drupal-version: 11
php-version: "8.4"
fail-fast: false
runs-on: ubuntu-latest
name: Multidev test (Drupal ${{ matrix.drupal-version }}, PHP ${{ matrix.php-version }}, Solr ${{ matrix.solr-version }})
needs: [linting, phpcompatibility]
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ github.token }}"}}'
DRUPAL_VERSION: ${{ matrix.drupal-version }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
GITHUB_RUN_NUMBER: ${{ github.run_number }}
PANTHEON_CI_SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
PHP_VERSION: ${{ matrix.php-version }}
SOLR_VERSION: ${{ matrix.solr-version }}
TERMINUS_SITE: ${{ matrix.drupal-version == 10 && vars.PANTHEON_SITE_D10 || vars.PANTHEON_SITE_D11 }}
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
TERMINUS_VERSION: ${{ matrix.php-version >= '8.2' && '4.1.4' || '3.5.1' }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set multidev name and composer constraint
run: .github/scripts/set-multidev-and-constraint.sh
env:
GIT_REF: ${{ github.head_ref || github.ref_name }}
GIT_REF_TYPE: ${{ github.ref_type }}
- name: Setup PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
with:
php-version: ${{ env.PHP_VERSION }}
- name: Install Terminus
uses: pantheon-systems/terminus-github-actions@409451ede17f75acac08f42edc823fee6c435057 # v1.2.8
with:
pantheon-machine-token: ${{env.TERMINUS_TOKEN}}
terminus-version: ${{env.TERMINUS_VERSION}}
- name: Verify Terminus auth
run: terminus auth:whoami
- name: Setup Git
run: |
git config --global user.email "$GIT_EMAIL"
git config --global user.name "Github Actions"
git config --global --add safe.directory '*'
- name: Setup SSH Keys
uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
with:
ssh-private-key: ${{ env.PANTHEON_CI_SSH_KEY }}
- name: Create multidev environment
run: .github/scripts/create-multidev.sh "$MULTIDEV_NAME" "$TERMINUS_SITE" "$GITHUB_ENV" "$GIT_CONSTRAINT" "$PHP_VERSION"
- name: Show PHP versions
run: |
echo "Runner PHP: $(php -v | head -1)"
echo "Multidev PHP: $(terminus drush $TERMINUS_SITE.$MULTIDEV_ENV -- ev "echo 'PHP ' . PHP_VERSION;")"
- name: Run tests
run: bash .github/scripts/run-tests.sh
- name: Run field mapping tests
run: bash .github/scripts/test-field-mapping.sh
- name: Run parity tests
run: bash .github/scripts/test-multidev-parity.sh "$TERMINUS_SITE" "$MULTIDEV_ENV" "$PARITY_ENV"
- name: Delete current multidevs
if: success()
run: |
terminus multidev:delete "$TERMINUS_SITE.${MULTIDEV_ENV}" --delete-branch --yes || true
terminus multidev:delete "$TERMINUS_SITE.${PARITY_ENV}" --delete-branch --yes || true
- name: Show multidev URL for investigation
if: ${{ failure() && env.MULTIDEV_ENV != '' }}
run: |
echo "Multidev URL: https://${MULTIDEV_ENV}-${TERMINUS_SITE}.pantheonsite.io"
echo "Parity URL: https://${PARITY_ENV}-${TERMINUS_SITE}.pantheonsite.io"
- name: Cleanup stale CI multidevs
if: always()
run: bash .github/scripts/cleanup-multidevs.sh "$MULTIDEV_PREFIX" "${MULTIDEV_ENV:-}"
mirror_do:
runs-on: ubuntu-latest
name: Checkout & push to remote
if: ${{ github.repository == 'pantheon-systems/search_api_pantheon' }}
needs: [ deploy_multidev ]
env:
BRANCH: ${{ github.ref_name }}
WORKSPACE: ${{ github.workspace }}
DRUPAL_ORG_REMOTE: ${{ secrets.DRUPAL_ORG_REMOTE }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Install SSH key
uses: shimataro/ssh-key-action@87a8f067114a8ce263df83e9ed5c849953548bc3 # v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
if_key_exists: ignore
- name: Pushes to drupal.org repository
run: |
cd $WORKSPACE
git remote add drupalorg $DRUPAL_ORG_REMOTE
git push drupalorg $BRANCH