Skip to content

Commit

Permalink
Merge 677604f into b2507dc
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed May 23, 2021
2 parents b2507dc + 677604f commit 1fb766a
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 67 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI

on:
pull_request:
push:
branches:
- master
- main

jobs:

tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0']

name: Test with PHP ${{ matrix.php-version }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
tools: composer:v2

- name: Validate composer.json
run: |
composer validate --strict
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/composer
key: composer-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ matrix.php-version }}-
composer-
- name: Set package version for Composer
uses: ergebnis/composer-root-version-action@0.2.1
with:
branch: "main"

- name: Install dependencies
run: |
composer remove --no-update --dev --no-interaction --no-progress \
phan/phan phpstan/phpstan vimeo/psalm \
infection/infection friendsofphp/php-cs-fixer
composer update --prefer-dist --no-interaction --no-progress ${{ matrix.dependencies }}
- name: Execute tests
run: |
php vendor/bin/phpunit
- name: Upload coverage report
continue-on-error: false
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
php vendor/bin/php-coveralls -v
validate:
name: Static Analysis and Validation
runs-on: ubuntu-latest

env:
PHP_VERSION: 7.4

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: ast
coverage: pcov
tools: composer:v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/composer
key: composer-${{ env.PHP_VERSION }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ env.PHP_VERSION }}-
composer-
- name: Set package version for Composer
uses: ergebnis/composer-root-version-action@0.2.1
with:
branch: "main"

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-progress
- name: Validate composer.json
run: |
make composer-validate
- name: Static Analysis
run: |
make ci-analyze --keep-going
45 changes: 0 additions & 45 deletions .github/workflows/main.yml

This file was deleted.

24 changes: 2 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# Use any most recent PHP version
PHP=$(shell which php)
PHPDBG=phpdbg -qrr

# Default parallelism
JOBS=$(shell nproc)
Expand Down Expand Up @@ -52,14 +51,13 @@ all: test

ci-test: SILENT=
ci-test: prerequisites
$(SILENT) $(PHPDBG) $(PHPUNIT) $(PHPUNIT_COVERAGE_CLOVER) --group=$(PHPUNIT_GROUP)
$(SILENT) $(PHP) $(PHPUNIT) $(PHPUNIT_COVERAGE_CLOVER) --group=$(PHPUNIT_GROUP)

ci-analyze: SILENT=
ci-analyze: prerequisites ci-phpunit ci-infection ci-phan ci-phpstan ci-psalm

ci-phpunit: ci-cs
$(SILENT) $(PHPDBG) $(PHPUNIT) $(PHPUNIT_ARGS)
cp build/logs/junit.xml build/logs/phpunit.junit.xml
$(SILENT) $(PHP) $(PHPUNIT) $(PHPUNIT_ARGS)

ci-infection: ci-phpunit
$(SILENT) $(PHP) $(INFECTION) $(INFECTION_ARGS)
Expand Down Expand Up @@ -90,7 +88,6 @@ test-prerequisites: prerequisites composer.lock

phpunit: cs
$(SILENT) $(PHP) $(PHPUNIT) $(PHPUNIT_ARGS) --verbose
cp build/logs/junit.xml build/logs/phpunit.junit.xml
$(SILENT) $(PHP) $(INFECTION) $(INFECTION_ARGS)

analyze: cs .phpstan.neon psalm.xml
Expand Down Expand Up @@ -127,20 +124,3 @@ build/cache:
.PHONY: report-php-version
report-php-version:
# Using $(PHP)

##############################################################
# Quick development testing procedure #
##############################################################

PHP_VERSIONS=php7.0 php7.2

.PHONY: quick
quick:
make --no-print-directory -j test-all

.PHONY: test-all
test-all: $(PHP_VERSIONS)

.PHONY: $(PHP_VERSIONS)
$(PHP_VERSIONS): cs
@make --no-print-directory PHP=$@ PHP_CS_FIXER=/bin/true

0 comments on commit 1fb766a

Please sign in to comment.