Skip to content

CI/CD Baseline

CI/CD Baseline #19

Workflow file for this run

name: CIGrumPHP
on:
push:
branches:
- cicdtest
tags:
- "*"
pull_request:
# concurrency:
# group: ${{ github.ref }}
# cancel-in-progress: true
jobs:
drupal_codequality:
runs-on: ubuntu-latest
container: hussainweb/drupalqa
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Enable GrumPHP plugin
run: composer global config --no-plugins allow-plugins.phpro/grumphp-shim true
- name: Install GrumPHP globally
run: composer global require phpro/grumphp-shim
# Run each checks separately
# - name: Run phplint
# run: grumphp run --tasks=phplint
# - name: Run phpcs
# run: grumphp run --tasks=phpcs
# - name: Run phpmd
# run: grumphp run --tasks=phpmd
# Run using testsuites
- name: Run linters
run: grumphp run --testsuite=linters
- name: Run code quality check
run: grumphp run --testsuite=code_quality
frontend_codequality:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Frontend Code Quality
run: |
cd web/themes/custom/contribtracker
npm ci
npm run lint
drupal_test:
runs-on: ubuntu-latest
needs: [drupal_codequality]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Get Cache Directories
id: cache-dir
run: |
echo "::set-output name=composer-dir::$(composer config cache-files-dir)"
echo "::set-output name=npm-dir::$(npm config get cache)"
- uses: actions/cache@v4
with:
path: ${{ steps.cache-dir.outputs.composer-dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup DDEV
uses: ddev/github-action-setup-ddev@v1
with:
# We will start DDEV after setting the environment
autostart: false
- 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
ddev drush deploy -y
- name: Build front-end
run: |
cd web/themes/custom/contribtracker
npm ci
gulp
- name: Run phpstan
run: ddev php ./vendor/bin/grumphp run --tasks=phpstan
- 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