Skip to content

Workflow file for this run

name: PHPUnit and Acceptance Tests
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
phpunit:
name: PHPUnit Coverage Tests
runs-on: ubuntu-latest
container:
image: pookmish/drupal8ci:php8.3
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
MYSQL_ROOT_PASSWORD: drupal
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
with:
path: project
- name: Build project
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
run: |
mysql -h 127.0.0.1 -u drupal -pdrupal -e 'CREATE DATABASE IF NOT EXISTS drupal'
composer global require su-sws/stanford-caravan:10.x-dev
~/.config/composer/vendor/bin/sws-caravan phpunit /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --with-coverage
- name: Save Test Results
uses: actions/upload-artifact@v3
if: failure()
with:
name: unit-tests-results
path: /var/www/html/artifacts
phpunit_d11:
name: Drupal 11 PHPUnit Coverage Tests
runs-on: ubuntu-latest
container:
image: pookmish/drupal8ci:php8.3
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
MYSQL_ROOT_PASSWORD: drupal
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
with:
path: project
- name: Build project
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
run: |
mysql -h mysql -P 3306 -u drupal -pdrupal -e 'CREATE DATABASE IF NOT EXISTS drupal'
composer global require su-sws/stanford-caravan:11.x-dev
~/.config/composer/vendor/bin/sws-caravan phpunit /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --with-coverage
- name: Save Test Results
uses: actions/upload-artifact@v3
if: failure()
with:
name: unit-tests-results
path: /var/www/html/artifacts
# acceptance:
# name: Codeception Acceptance Tests
# runs-on: ubuntu-latest
# env:
# DRUPAL_DATABASE_NAME: drupal
# DRUPAL_DATABASE_USERNAME: drupal
# DRUPAL_DATABASE_PASSWORD: drupal
# DRUPAL_DATABASE_HOST: mysql
# container:
# image: pookmish/drupal8ci:php8.3
# options: '--network-alias drupal8ci'
# services:
# mysql:
# image: mysql:5.7
# env:
# MYSQL_DATABASE: drupal
# MYSQL_USER: drupal
# MYSQL_PASSWORD: drupal
# MYSQL_ROOT_PASSWORD: drupal
# ports:
# - 33306:3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# steps:
# - uses: actions/checkout@v3
# with:
# path: project
# - name: Run tests
# run: |
# composer global require su-sws/stanford-caravan:dev-8.x-2.x
# ~/.composer/vendor/bin/sws-caravan codeception /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --suites=acceptance
# - name: Save Test Results
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: acceptance-tests-results
# path: /var/www/html/artifacts
# functional:
# name: Codeception Functional Tests
# runs-on: ubuntu-latest
# env:
# DRUPAL_DATABASE_NAME: drupal
# DRUPAL_DATABASE_USERNAME: drupal
# DRUPAL_DATABASE_PASSWORD: drupal
# DRUPAL_DATABASE_HOST: mysql
# container:
# image: pookmish/drupal8ci:php8.3
# options: '--network-alias=drupal8ci'
# services:
# selenium:
# image: selenium/standalone-chrome
# options: '--shm-size="2g"'
# mysql:
# image: mysql:5.7
# env:
# MYSQL_DATABASE: drupal
# MYSQL_USER: drupal
# MYSQL_PASSWORD: drupal
# MYSQL_ROOT_PASSWORD: drupal
# ports:
# - 33306:3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# steps:
# - uses: actions/checkout@v3
# with:
# path: project
# - name: Run tests
# run: |
# composer global require su-sws/stanford-caravan:dev-8.x-2.x
# ~/.composer/vendor/bin/sws-caravan codeception /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --suites=functional
# - name: Save Test Results
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: functional-tests-results
# path: /var/www/html/artifacts