name: CI on: pull_request: env: php_version: '7.4' jobs: install: runs-on: ubuntu-latest name: Test Drupal site installation if: "!contains(github.event.head_commit.message, '[ci skip]')" steps: - name: Checkout code uses: actions/checkout@a81bbbf - name: Cache dependencies uses: actions/cache@d974700 with: path: | ~/.composer/cache/files web/core web/modules/contrib web/themes/contrib vendor key: dependencies-composer-${{ hashFiles('composer.lock') }} - name: Setup PHP uses: shivammathur/setup-php@5d27b8f with: php-version: ${{ env.php_version }} extensions: mbstring coverage: none - name: Ensure that composer.json and composer.lock are in sync run: composer validate - name: Install dependencies run: composer install --prefer-dist --no-interaction --no-suggest - name: Install Drupal run: > vendor/bin/drush --root=$(pwd)/web 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" theme: name: Build the theme assets runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, '[ci skip]')" 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 key: dependencies-npm-${{ hashFiles('package-lock.json') }} - name: Build the production theme assets run: | cd ${{ matrix.theme-path }} npm clean-install npm run production phpunit: runs-on: ubuntu-latest name: "Run ${{ matrix.test-types }} tests" if: "!contains(github.event.head_commit.message, '[ci skip]')" strategy: matrix: test-types: - functional - kernel - unit steps: - name: Checkout code uses: actions/checkout@a81bbbf - name: Cache dependencies uses: actions/cache@d974700 with: path: | ~/.composer/cache/files web/core web/modules/constrib web/themes/contrib vendor key: dependencies-composer-${{ hashFiles('composer.lock') }} - name: Setup PHP uses: shivammathur/setup-php@5d27b8f with: php-version: ${{ env.php_version }} 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 run: vendor/bin/phpunit --testdox --colors=always --testsuite=${{ matrix.test-types }} env: SIMPLETEST_BASE_URL: http://localhost:8000 phpcs: runs-on: ubuntu-latest name: "Run coding standards checks" if: "!contains(github.event.head_commit.message, '[ci skip]')" steps: - name: Checkout code uses: actions/checkout@a81bbbf - name: Cache dependencies uses: actions/cache@d974700 with: path: | ~/.composer/cache/files web/core web/modules/constrib web/themes/contrib vendor key: dependencies-composer-${{ hashFiles('composer.lock') }} - name: Setup PHP uses: shivammathur/setup-php@5d27b8f with: php-version: ${{ env.php_version }} - name: Install dependencies run: composer install --prefer-dist --no-interaction --no-suggest - name: Run checks run: vendor/bin/phpcs -s --warning-severity=6 phpstan: runs-on: ubuntu-latest name: Static analysis with PHPStan if: "!contains(github.event.head_commit.message, '[ci skip]')" steps: - name: Checkout code uses: actions/checkout@a81bbbf - name: Cache dependencies uses: actions/cache@d974700 with: path: | ~/.composer/cache/files web/core web/modules/constrib web/themes/contrib vendor key: dependencies-composer-${{ hashFiles('composer.lock') }} - name: Setup PHP uses: shivammathur/setup-php@5d27b8f with: php-version: ${{ env.php_version }} - name: Install dependencies run: composer install --prefer-dist --no-interaction --no-suggest - name: Run checks run: vendor/bin/phpstan analyze