Merge pull request #288 from gauravaxl/CT-278 #599
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@v1 | |
id: drupalqa | |
with: | |
checks: | | |
phplint: {} | |
phpcs: | |
standard: phpcs.xml.dist | |
ignore: /node_modules/ | |
phpmd: | |
ruleset: phpmd.xml | |
suffixes: php | |
frontend_codequality: | |
runs-on: ubuntu-latest | |
container: node:lts | |
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 | |
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@v3 | |
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: Test | |
run: | | |
ddev phpunit --testsuite unit | |
ddev phpunit --bootstrap=./vendor/weitzman/drupal-test-traits/src/bootstrap-fast.php --configuration ./phpunit.xml --testsuite existing-site | |
frontend_vr: | |
permissions: | |
packages: read | |
contents: read | |
needs: [frontend_codequality] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
container: skippednote/drupal-cypress:1.0.6 | |
env: | |
# For Cypress. | |
CYPRESS_ADMIN_USERNAME: ct-admin | |
CYPRESS_ADMIN_PASSWORD: ct-admin | |
services: | |
mariadb: | |
image: ghcr.io/contrib-tracker/backend-db:main | |
env: | |
ALLOW_EMPTY_PASSWORD: "yes" | |
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@v3 | |
with: | |
path: ${{ steps.cache-dir.outputs.composer-dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.cache-dir.outputs.npm-dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('web/themes/custom/contribtracker/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Test | |
run: | | |
./.github/ci.sh | |
composer install -o --no-progress | |
./vendor/bin/drush deploy -y | |
./vendor/bin/drush upwd ct-admin "ct-admin" | |
cd web/themes/custom/contribtracker | |
npm ci --cache $CI_PROJECT_DIR/.npm --prefer-offline | |
npm run build | |
npm run vr | |
- name: Archive Cypress recordings | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-recordings | |
path: | | |
web/themes/custom/contribtracker/cypress/screenshots | |
web/themes/custom/contribtracker/cypress/videos | |
retention-days: 3 | |
deploy: | |
needs: | |
- drupal_codequality | |
- drupal_test | |
- frontend_vr | |
runs-on: ubuntu-latest | |
# Dependabot PR's can't access secrets, so we can't deploy. | |
if: github.actor != 'dependabot[bot]' | |
steps: | |
- uses: axelerant/platformsh-deploy-action@main | |
with: | |
project-id: 'brbqplxd7ycq6' | |
cli-token: ${{ secrets.PLATFORMSH_CLI_TOKEN }} |