2020-10-30 00:13:35 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
|
2020-10-31 09:56:27 +00:00
|
|
|
env:
|
2020-12-16 19:03:53 +00:00
|
|
|
php_version: '7.4'
|
2020-10-31 09:56:27 +00:00
|
|
|
|
2020-10-30 00:13:35 +00:00
|
|
|
jobs:
|
|
|
|
install:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
name: Test Drupal site installation
|
|
|
|
|
2020-11-27 21:37:41 +00:00
|
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
|
|
|
2020-10-30 00:13:35 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: actions/checkout@a81bbbf
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Cache dependencies
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: actions/cache@d974700
|
2020-10-30 00:13:35 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.composer/cache/files
|
|
|
|
web/core
|
|
|
|
web/modules/contrib
|
|
|
|
web/themes/contrib
|
|
|
|
vendor
|
2020-12-19 14:52:48 +00:00
|
|
|
key: dependencies-composer-${{ hashFiles('composer.lock') }}
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Setup PHP
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: shivammathur/setup-php@5d27b8f
|
2020-10-30 00:13:35 +00:00
|
|
|
with:
|
2020-12-16 19:03:53 +00:00
|
|
|
php-version: ${{ env.php_version }}
|
2020-10-30 00:13:35 +00:00
|
|
|
extensions: mbstring
|
|
|
|
coverage: none
|
|
|
|
|
2020-10-31 09:11:40 +00:00
|
|
|
- name: Ensure that composer.json and composer.lock are in sync
|
|
|
|
run: composer validate
|
|
|
|
|
2020-10-30 00:13:35 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: composer install --prefer-dist --no-interaction --no-suggest
|
|
|
|
|
|
|
|
- name: Install Drupal
|
|
|
|
run: >
|
2020-12-24 11:00:51 +00:00
|
|
|
bin/drush --root=$(pwd)/web
|
2020-10-30 00:13:35 +00:00
|
|
|
site:install -y
|
|
|
|
--existing-config
|
|
|
|
--db-url=sqlite://sites/default/files/.ht.sqlite
|
|
|
|
|
|
|
|
- name: Start a web server
|
|
|
|
run: php -S localhost:8000 -t web 2>&1 &
|
|
|
|
|
|
|
|
- name: Test loading the home page
|
|
|
|
run: curl http://localhost:8000
|
|
|
|
|
|
|
|
- name: Verify the home page has the site name in it
|
|
|
|
run: curl -s http://localhost:8000 | grep "Oliver Davies"
|
|
|
|
|
2020-11-02 14:25:26 +00:00
|
|
|
theme:
|
|
|
|
name: Build the theme assets
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2020-11-27 21:37:41 +00:00
|
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
|
|
|
2020-11-02 14:25:26 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
theme-path:
|
|
|
|
- web/themes/custom/opdavies
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout the code
|
|
|
|
uses: actions/checkout@a81bbbf
|
|
|
|
|
|
|
|
- name: Setup node and npm
|
|
|
|
uses: actions/setup-node@56899e0
|
|
|
|
with:
|
|
|
|
node-version: 12
|
|
|
|
|
|
|
|
- name: Cache npm dependencies
|
|
|
|
uses: actions/cache@d974700
|
|
|
|
with:
|
|
|
|
path: node_modules
|
2020-12-19 14:52:48 +00:00
|
|
|
key: dependencies-npm-${{ hashFiles('package-lock.json') }}
|
2020-11-02 14:25:26 +00:00
|
|
|
|
|
|
|
- name: Build the production theme assets
|
|
|
|
run: |
|
|
|
|
cd ${{ matrix.theme-path }}
|
|
|
|
npm clean-install
|
|
|
|
npm run production
|
|
|
|
|
2020-10-30 00:13:35 +00:00
|
|
|
phpunit:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
name: "Run ${{ matrix.test-types }} tests"
|
|
|
|
|
2020-11-27 21:37:41 +00:00
|
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
|
|
|
2020-10-30 00:13:35 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
test-types:
|
|
|
|
- functional
|
|
|
|
- kernel
|
|
|
|
- unit
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: actions/checkout@a81bbbf
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Cache dependencies
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: actions/cache@d974700
|
2020-10-30 00:13:35 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.composer/cache/files
|
|
|
|
web/core
|
|
|
|
web/modules/constrib
|
|
|
|
web/themes/contrib
|
|
|
|
vendor
|
2020-12-19 14:52:48 +00:00
|
|
|
key: dependencies-composer-${{ hashFiles('composer.lock') }}
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Setup PHP
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: shivammathur/setup-php@5d27b8f
|
2020-10-30 00:13:35 +00:00
|
|
|
with:
|
2020-12-16 19:03:53 +00:00
|
|
|
php-version: ${{ env.php_version }}
|
2020-10-30 00:13:35 +00:00
|
|
|
extensions: mbstring
|
|
|
|
coverage: none
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: composer install --prefer-dist --no-interaction --no-suggest
|
|
|
|
|
|
|
|
- name: Start the local web server
|
|
|
|
run: php -S localhost:8000 -t web 2>&1 &
|
|
|
|
if: matrix.test-types == 'functional'
|
|
|
|
|
|
|
|
- name: Execute tests
|
2020-12-24 11:00:51 +00:00
|
|
|
run: bin/phpunit --testdox --colors=always --testsuite=${{ matrix.test-types }}
|
2020-10-30 00:13:35 +00:00
|
|
|
env:
|
|
|
|
SIMPLETEST_BASE_URL: http://localhost:8000
|
|
|
|
|
|
|
|
phpcs:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
name: "Run coding standards checks"
|
|
|
|
|
2020-11-27 21:37:41 +00:00
|
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
|
|
|
2020-10-30 00:13:35 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: actions/checkout@a81bbbf
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Cache dependencies
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: actions/cache@d974700
|
2020-10-30 00:13:35 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.composer/cache/files
|
|
|
|
web/core
|
|
|
|
web/modules/constrib
|
|
|
|
web/themes/contrib
|
|
|
|
vendor
|
2020-12-19 14:52:48 +00:00
|
|
|
key: dependencies-composer-${{ hashFiles('composer.lock') }}
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Setup PHP
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: shivammathur/setup-php@5d27b8f
|
2020-10-30 00:13:35 +00:00
|
|
|
with:
|
2020-12-16 19:03:53 +00:00
|
|
|
php-version: ${{ env.php_version }}
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: composer install --prefer-dist --no-interaction --no-suggest
|
|
|
|
|
|
|
|
- name: Run checks
|
2020-12-24 11:00:51 +00:00
|
|
|
run: bin/phpcs -s --warning-severity=6
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
phpstan:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
name: Static analysis with PHPStan
|
|
|
|
|
2020-11-27 21:37:41 +00:00
|
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
|
|
|
2020-10-30 00:13:35 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: actions/checkout@a81bbbf
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Cache dependencies
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: actions/cache@d974700
|
2020-10-30 00:13:35 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.composer/cache/files
|
|
|
|
web/core
|
|
|
|
web/modules/constrib
|
|
|
|
web/themes/contrib
|
|
|
|
vendor
|
2020-12-19 14:52:48 +00:00
|
|
|
key: dependencies-composer-${{ hashFiles('composer.lock') }}
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Setup PHP
|
2020-10-30 01:26:52 +00:00
|
|
|
uses: shivammathur/setup-php@5d27b8f
|
2020-10-30 00:13:35 +00:00
|
|
|
with:
|
2020-12-16 19:03:53 +00:00
|
|
|
php-version: ${{ env.php_version }}
|
2020-10-30 00:13:35 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: composer install --prefer-dist --no-interaction --no-suggest
|
|
|
|
|
|
|
|
- name: Run checks
|
2020-12-24 11:00:51 +00:00
|
|
|
run: bin/phpstan analyze
|