npm: bump @percy/cli from 1.29.0 to 1.30.1 in /web/themes/custom/contribtracker in the percy group across 1 directory #1435
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
drupal_codequality: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Drupal Code Quality | |
uses: hussainweb/drupalqa-action@v2 | |
id: drupalqa | |
with: | |
php-version: 8.2 | |
checks: | | |
grumphp: | |
tasks: | |
- phplint | |
- yamllint | |
- jsonlint | |
- phpcs | |
- phpmd | |
- twigcs | |
frontend_codequality: | |
runs-on: ubuntu-latest | |
container: node:lts | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Get Cache Directories | |
id: cache-dir | |
run: echo "npm-dir=$(npm config get cache)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
${{ steps.cache-dir.outputs.npm-dir }} | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: Frontend Code Quality | |
run: | | |
cd web/themes/custom/contribtracker | |
npm ci --prefer-offline --no-audit | |
npm run lint | |
drupal_test: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: read | |
env: | |
# For Cypress. | |
CYPRESS_ADMIN_USERNAME: ct-admin | |
CYPRESS_ADMIN_PASSWORD: ct-admin | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Get Cache Directories | |
id: cache-dir | |
run: | | |
echo "composer-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
echo "npm-dir=$(npm config get cache)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
vendor | |
web/core | |
web/modules/contrib | |
web/themes/contrib | |
web/profiles/contrib | |
${{ steps.cache-dir.outputs.composer-dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
${{ steps.cache-dir.outputs.npm-dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Setup DDEV | |
uses: ddev/github-action-setup-ddev@v1 | |
with: | |
# We will start DDEV after setting the environment | |
autostart: false | |
- name: Get DDEV version | |
id: ddev_version | |
run: echo "ddev_version=$(ddev --version | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT | |
- name: Cache Docker images | |
uses: ScribeMD/[email protected] | |
with: | |
key: ddev-images-${{ runner.os }}-${{ steps.ddev_version.outputs.ddev_version }}-${{ hashFiles('.ddev/config.yaml', '.ddev/docker-compose.cypress.yaml', '.ddev/docker-compose.redis.yaml') }} | |
# This disables the cache for PRs and tag events. | |
read-only: ${{ github.event_name == 'pull_request' || github.ref_type == 'tag' }} | |
- name: Set the platform.sh token | |
run: | | |
ddev config global --web-environment-add="PLATFORMSH_CLI_TOKEN=${{ secrets.PLATFORMSH_CLI_TOKEN }}" | |
ddev start | |
- name: Install the site | |
run: | | |
ddev composer install | |
ddev pull platform -y | |
- name: Run updates and Validate Config | |
id: validate_config | |
run: | | |
# Rebuild cache so that config cache is not obsolete | |
ddev drush cache:rebuild -y | |
# Identify set of configuration changes before running updatedb and store it in a text file. | |
# awk NF is used to filter blank lines. | |
ddev drush config:status --fields name --format list | awk NF > ${{ runner.temp }}/initial_config.txt | |
# Run updates and rebuild cache | |
ddev drush updatedb --yes | |
ddev drush cache:rebuild --yes | |
# Identify set of configuration changes after running updatedb and store it in a text file. | |
ddev drush config:status --fields name --format list | awk NF > ${{ runner.temp }}/updated_config.txt | |
# Compare the sorted files and write unique lines from the second list that are not present in the first list. | |
comm -13 ${{ runner.temp }}/initial_config.txt ${{ runner.temp }}/updated_config.txt > ${{ runner.temp }}/mismatched_config.txt | |
# If mismatched_config is not empty, it means we have missing config export. We store it in GITHUB_OUTPUT for the next steps. | |
if [ -s ${{ runner.temp }}/mismatched_config.txt ]; then | |
echo "Config export has differences" | |
cat ${{ runner.temp }}/mismatched_config.txt | |
# We are using EOF-based output as mismatched_config.txt may contain multiple lines | |
status_output=$(cat ${{ runner.temp }}/mismatched_config.txt) | |
echo "status_output<<EOF" >> $GITHUB_OUTPUT | |
echo "$status_output" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
else | |
echo "Config has no differences" | |
echo "status_output=No differences between DB and sync directory" >> $GITHUB_OUTPUT | |
fi | |
- name: Add/Update PR Comment | |
uses: mshick/add-pr-comment@v2 | |
with: | |
# This will add or update the comment if there are config differences, but will only update the comment on success. | |
# We do not want to add the comment when there are no config differences on the initial push. | |
update-only: ${{ contains(steps.validate_config.outputs.status_output, 'No differences') }} | |
message: | | |
${{ !contains(steps.validate_config.outputs.status_output, 'No differences') && '**Config export has differences**' || ' ' }} | |
``` | |
${{ steps.validate_config.outputs.status_output }} | |
``` | |
- name: Warn if Config Export is not clean | |
if: ${{ !contains(steps.validate_config.outputs.status_output, 'No differences') }} | |
run: | | |
echo "::warning::Config export has differences" | |
echo ${{ steps.validate_config.outputs.status_output }} | |
- name: Deploy the site | |
run: | | |
ddev drush deploy -y | |
- name: Build front-end | |
run: | | |
cd web/themes/custom/contribtracker | |
npm ci --prefer-offline --no-audit | |
gulp | |
- name: Run phpstan | |
run: ddev php ./vendor/bin/grumphp run --tasks=phpstan --no-interaction | |
- name: Test | |
run: | | |
ddev phpunit --testsuite unit | |
ddev phpunit --bootstrap=./vendor/weitzman/drupal-test-traits/src/bootstrap-fast.php --configuration ./phpunit.xml --testsuite existing-site | |
- name: Change admin password to make it easier for Cypress tests | |
run: ddev drush upwd "$CYPRESS_ADMIN_USERNAME" "$CYPRESS_ADMIN_PASSWORD" | |
- name: Cypress Test | |
run: ddev cypress-run | |
- name: Save Cypress recordings | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cypress-recordings | |
path: | | |
web/themes/custom/contribtracker/cypress/screenshots | |
web/themes/custom/contribtracker/cypress/videos | |
retention-days: 3 | |
deploy: | |
environment: | |
name: ${{ github.ref_name == 'main' && 'production' || 'feature' }} | |
needs: | |
- drupal_codequality | |
- drupal_test | |
runs-on: ubuntu-latest | |
# Dependabot PR's can't access secrets, so we can't deploy. | |
if: github.actor != 'dependabot[bot]' | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Deploy to platform.sh | |
uses: axelerant/platformsh-action@v1 | |
with: | |
action: 'deploy' | |
project-id: "brbqplxd7ycq6" | |
cli-token: ${{ secrets.PLATFORMSH_CLI_TOKEN }} | |
force-push: true |