Skip to content

Commit 1654f39

Browse files
committed
Add Github Actions replacing TravisCI
1 parent 2efa837 commit 1654f39

File tree

5 files changed

+180
-87
lines changed

5 files changed

+180
-87
lines changed

.github/workflows/php.yml

Lines changed: 60 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,63 @@ 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+
- php-version: "8.0"
28+
drupal: "^9.0"
29+
experimental: true
1430
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
31+
- name: "Checkout"
32+
uses: "actions/checkout@v2"
33+
- name: "Install PHP"
34+
uses: "shivammathur/setup-php@v2"
35+
with:
36+
coverage: "none"
37+
php-version: "${{ matrix.php-version }}"
38+
tools: composer:v2
39+
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv
40+
- name: Validate composer.json and composer.lock
41+
run: composer validate --strict
42+
- name: "Install dependencies"
43+
run: "composer install --no-progress --prefer-dist"
44+
- name: "PHPCS"
45+
run: "php vendor/bin/phpcs src"
46+
# - name: "PHPStan"
47+
# run: "php vendor/bin/phpstan analyze src"
48+
- name: Setup Drupal
49+
run: |
50+
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:${{ matrix.drupal }} ~/drupal --no-interaction
51+
cd ~/drupal
52+
composer config minimum-stability dev
53+
composer config prefer-stable true
54+
composer config preferred-install dist
55+
composer config repositories.0 path $GITHUB_WORKSPACE
56+
composer config repositories.1 composer https://packages.drupal.org/8
57+
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies
58+
- name: "require drupal-check"
59+
run: |
60+
cd ~/drupal
61+
COMPOSER_MEMORY_LIMIT=-1 composer require mglaman/drupal-check *@dev
62+
- name: "Analyze core/install.php"
63+
run: |
64+
cd ~/drupal
65+
./vendor/bin/drupal-drupal web/core/install.php
66+
- name: "Analyze core/install.php"
67+
run: |
68+
cd ~/drupal
69+
./vendor/bin/drupal-drupal web/core/modules/dynamic_page_cache

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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
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": {

composer.lock

Lines changed: 109 additions & 58 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)