Skip to content

Commit 11c87b3

Browse files
authored
Merge pull request #215 from mglaman/gh-actions
Add Github Actions replacing TravisCI
2 parents 2efa837 + eb78536 commit 11c87b3

File tree

5 files changed

+195
-90
lines changed

5 files changed

+195
-90
lines changed

.github/workflows/php.yml

Lines changed: 66 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP Composer
1+
name: Build
22

33
on:
44
push:
@@ -7,30 +7,69 @@ on:
77
branches: [master]
88

99
jobs:
10-
build:
11-
12-
runs-on: ubuntu-latest
13-
10+
tests:
11+
continue-on-error: ${{ matrix.experimental }}
12+
runs-on: "ubuntu-latest"
13+
name: "Tests | PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal }}"
14+
strategy:
15+
matrix:
16+
experimental: [false]
17+
php-version:
18+
- "7.3"
19+
- "7.4"
20+
drupal:
21+
- "^8.9"
22+
- "^9.0"
23+
include:
24+
- php-version: "7.2"
25+
drupal: "~8.9"
26+
experimental: false
27+
# @todo add when upgrading mglaman/phpstan-drupal.
28+
# - php-version: "8.0"
29+
# drupal: "^9.0"
30+
# experimental: true
1431
steps:
15-
- uses: actions/checkout@v2
16-
17-
- name: Validate composer.json and composer.lock
18-
run: composer validate --strict
19-
20-
- name: Cache Composer packages
21-
id: composer-cache
22-
uses: actions/cache@v2
23-
with:
24-
path: vendor
25-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
26-
restore-keys: |
27-
${{ runner.os }}-php-
28-
29-
- name: Install dependencies
30-
run: composer install --prefer-dist --no-progress --no-suggest
31-
32-
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
33-
# Docs: https://getcomposer.org/doc/articles/scripts.md
34-
35-
# - name: Run test suite
36-
# run: composer run-script test
32+
- name: "Checkout"
33+
uses: "actions/checkout@v2"
34+
- name: "Install PHP"
35+
uses: "shivammathur/setup-php@v2"
36+
with:
37+
coverage: "none"
38+
php-version: "${{ matrix.php-version }}"
39+
tools: composer:v2
40+
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv
41+
- name: Validate composer.json and composer.lock
42+
run: composer validate --strict
43+
- name: "Install dependencies"
44+
run: "composer install --no-progress --prefer-dist"
45+
- name: "PHPCS"
46+
run: "php vendor/bin/phpcs src"
47+
# - name: "PHPStan"
48+
# run: "php vendor/bin/phpstan analyze src"
49+
- name: Setup Drupal
50+
run: |
51+
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:${{ matrix.drupal }} ~/drupal --no-interaction
52+
cd ~/drupal
53+
composer config minimum-stability dev
54+
composer config prefer-stable true
55+
composer config preferred-install dist
56+
composer config repositories.0 path $GITHUB_WORKSPACE
57+
composer config repositories.1 composer https://packages.drupal.org/8
58+
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies
59+
- name: "Add phpspec/prophecy-phpunit"
60+
run: |
61+
cd ~/drupal
62+
COMPOSER_MEMORY_LIMIT=-1 composer require --dev phpspec/prophecy-phpunit:^2
63+
if: ${{ matrix.drupal == '^9.0' }}
64+
- name: "require drupal-check"
65+
run: |
66+
cd ~/drupal
67+
COMPOSER_MEMORY_LIMIT=-1 composer require mglaman/drupal-check *@dev
68+
- name: "Analyze core/install.php"
69+
run: |
70+
cd ~/drupal
71+
./vendor/bin/drupal-check web/core/install.php
72+
- name: "Analyze dynamic_page_cache"
73+
run: |
74+
cd ~/drupal
75+
./vendor/bin/drupal-check web/core/modules/dynamic_page_cache || if (($? == 255)); then false; else true; fi

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# drupal-check [![Build Status](https://travis-ci.com/mglaman/drupal-check.svg?branch=master)](https://travis-ci.com/mglaman/drupal-check) [![CircleCI](https://circleci.com/gh/mglaman/drupal-check.svg?style=svg)](https://circleci.com/gh/mglaman/drupal-check) [![Latest release](https://img.shields.io/github/release/mglaman/drupal-check.svg)](https://github.com/mglaman/drupal-check/releases/latest)
1+
# drupal-check [![Build](https://github.com/mglaman/drupal-check/actions/workflows/php.yml/badge.svg)](https://github.com/mglaman/drupal-check/actions/workflows/php.yml) [![CircleCI](https://circleci.com/gh/mglaman/drupal-check.svg?style=svg)](https://circleci.com/gh/mglaman/drupal-check) [![Latest release](https://img.shields.io/github/release/mglaman/drupal-check.svg)](https://github.com/mglaman/drupal-check/releases/latest)
22

33
Built on [PHPStan](https://github.com/phpstan/phpstan), this static analysis tool will check for correctness (e.g. using a class that doesn't exist), deprecation errors, and more.
44

composer.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,26 @@
1010
}
1111
],
1212
"require": {
13-
"php": "~7.2",
13+
"php": "^7.2.5|^8.0",
1414
"composer/xdebug-handler": "^1.3",
1515
"jean85/pretty-package-versions": "~1.5.0",
1616
"mglaman/phpstan-drupal": "^0.12.8",
1717
"nette/neon": "^3.1",
18-
"phpstan/phpstan-deprecation-rules": "^0.12",
1918
"symfony/console": "~3.2 || ~4.0",
2019
"symfony/process": "~3.2 || ~4.0",
2120
"webflo/drupal-finder": "^1.1"
2221
},
2322
"require-dev": {
23+
"phpstan/phpstan": "^0.12.81",
24+
"phpstan/phpstan-deprecation-rules": "^0.12.6",
25+
"phpstan/phpstan-strict-rules": "^0.12.9",
2426
"squizlabs/php_codesniffer": "^3.4"
2527
},
2628
"config": {
27-
"sort-packages": true
29+
"sort-packages": true,
30+
"platform": {
31+
"php": "7.2.5"
32+
}
2833
},
2934
"bin": [
3035
"drupal-check"

composer.lock

Lines changed: 113 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
includes:
2+
- vendor/phpstan/phpstan-strict-rules/rules.neon
3+
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
4+
parameters:
5+
level: 8
6+
checkGenericClassInNonGenericObjectType: false
7+
checkMissingIterableValueType: false

0 commit comments

Comments
 (0)