Skip to content

Commit 8944782

Browse files
authored
Merge pull request #7 from infection/move-to-github-actions
Move to GitHub actions
2 parents 14640af + a416b8b commit 8944782

11 files changed

Lines changed: 695 additions & 316 deletions

File tree

.gitattributes

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*.php text eol=lf
2+
3+
# Denote all files that are truly binary and should not be modified.
4+
*.png binary
5+
*.jpg binary
6+
7+
# Directories and files we do not want to distribute
8+
/.* export-ignore
9+
/build/ export-ignore
10+
/docs/ export-ignore
11+
/infection.json.dist export-ignore
12+
/tests/ export-ignore
13+
/phpstan-baseline.neon export-ignore
14+
/phpunit.xml.dist export-ignore
15+
/psalm.xml export-ignore
16+
/psalm-baseline.xml export-ignore

.github/workflows/ci.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# yamllint disable rule:line-length
2+
# yamllint disable rule:braces
3+
4+
name: Tests
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
11+
- master
12+
13+
jobs:
14+
tests:
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
operating-system: [ubuntu-latest]
20+
php-version: ['7.4', '8.0']
21+
coverage-driver: [pcov]
22+
23+
name: CI with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }}
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php-version }}
33+
coverage: ${{ matrix.coverage-driver }}
34+
tools: composer:v2
35+
36+
- name: Get composer cache directory
37+
id: composer-cache
38+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
39+
40+
- name: Cache dependencies
41+
uses: actions/cache@v2
42+
with:
43+
path: ${{ steps.composer-cache.outputs.dir }}
44+
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
45+
restore-keys: |
46+
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
47+
composer-${{ runner.os }}-${{ matrix.php-version }}-
48+
composer-${{ runner.os }}-
49+
composer-
50+
51+
- name: Install dependencies
52+
run: composer install --no-interaction --no-progress --prefer-dist
53+
54+
- name: Run tests and generate coverage
55+
run: make test-unit
56+
57+
- name: Upload coverage results to Coveralls
58+
env:
59+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
run: vendor/bin/php-coveralls

.github/workflows/cs.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# yamllint disable rule:line-length
2+
# yamllint disable rule:braces
3+
4+
name: Coding Standards
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
11+
- master
12+
13+
jobs:
14+
coding-standards:
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
operating-system: [ubuntu-latest]
20+
php-version: ['7.4']
21+
check: ['cs', 'static-analyze']
22+
23+
name: Coding Standards on PHP ${{ matrix.php-version }}
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php-version }}
33+
tools: composer:v2
34+
35+
- name: Get composer cache directory
36+
id: composer-cache
37+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
38+
39+
- name: Cache dependencies
40+
uses: actions/cache@v2
41+
with:
42+
path: ${{ steps.composer-cache.outputs.dir }}
43+
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
44+
restore-keys: |
45+
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
46+
composer-${{ runner.os }}-${{ matrix.php-version }}-
47+
composer-${{ runner.os }}-
48+
composer-
49+
50+
- name: Install dependencies
51+
run: |
52+
composer install --no-interaction --no-progress --prefer-dist
53+
54+
- name: Run ${{ matrix.check }}
55+
run: make ${{ matrix.check }}

.github/workflows/mt.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# yamllint disable rule:line-length
2+
# yamllint disable rule:braces
3+
4+
name: Mutation Testing
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
11+
- master
12+
13+
jobs:
14+
mutation-testing:
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
operating-system: [ubuntu-latest]
20+
php-version: ['7.4']
21+
coverage-driver: [pcov]
22+
23+
name: Mutation testing with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }}
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v2
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php-version }}
33+
coverage: ${{ matrix.coverage-driver }}
34+
tools: composer:v2
35+
36+
- name: Get composer cache directory
37+
id: composer-cache
38+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
39+
40+
- name: Cache dependencies
41+
uses: actions/cache@v2
42+
with:
43+
path: ${{ steps.composer-cache.outputs.dir }}
44+
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-${{ matrix.dependencies }}
45+
restore-keys: |
46+
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
47+
composer-${{ runner.os }}-${{ matrix.php-version }}-
48+
composer-${{ runner.os }}-
49+
composer-
50+
51+
- name: Install dependencies
52+
run: composer install --no-interaction --no-progress --prefer-dist
53+
54+
- name: Run Infection
55+
run: make infection

.prettyci.composer.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

Makefile

Lines changed: 27 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
# Use any most recent PHP version
44
PHP=$(shell which php)
5-
PHPDBG=php
65

76
# Default parallelism
87
JOBS=$(shell nproc)
98

10-
# Default silencer if installed
11-
SILENT=$(shell which chronic)
12-
139
# PHP CS Fixer
1410
PHP_CS_FIXER=vendor/bin/php-cs-fixer
15-
PHP_CS_FIXER_ARGS=--cache-file=build/cache/.php_cs.cache --verbose
11+
PHP_CS_FIXER_ARGS=--diff --diff-format=udiff --verbose
1612
export PHP_CS_FIXER_IGNORE_ENV=1
1713

1814
# PHPUnit
@@ -35,37 +31,27 @@ COMPOSER=$(PHP) $(shell which composer)
3531
INFECTION=vendor/bin/infection
3632
MIN_MSI=52.212389380531
3733
MIN_COVERED_MSI=95
38-
INFECTION_ARGS=--min-msi=$(MIN_MSI) --min-covered-msi=$(MIN_COVERED_MSI) --threads=$(JOBS) --log-verbosity=default --show-mutations
34+
INFECTION_ARGS=--min-msi=$(MIN_MSI) --min-covered-msi=$(MIN_COVERED_MSI) --threads=$(JOBS) --log-verbosity=none --no-interaction --no-progress
3935

4036
all: test
4137

42-
##############################################################
43-
# Continuous Integration #
44-
##############################################################
38+
cs:
39+
$(PHP_CS_FIXER) fix $(PHP_CS_FIXER_ARGS) --dry-run
40+
LC_ALL=C sort -c -u .gitignore
4541

46-
ci-test: SILENT=
47-
ci-test: prerequisites
48-
$(SILENT) $(PHPDBG) $(PHPUNIT) $(PHPUNIT_COVERAGE_CLOVER)
49-
#tests/e2e_tests
42+
phpstan:
43+
$(PHPSTAN) $(PHPSTAN_ARGS) --no-progress
5044

51-
ci-analyze: SILENT=
52-
ci-analyze: prerequisites ci-cs ci-infection ci-phpstan ci-psalm
45+
psalm:
46+
$(PSALM) $(PSALM_ARGS) --no-cache --shepherd
5347

54-
ci-phpunit: ci-cs
55-
$(SILENT) $(PHPDBG) $(PHPUNIT) $(PHPUNIT_ARGS)
56-
cp build/logs/junit.xml build/logs/phpunit.junit.xml
48+
static-analyze: phpstan psalm
5749

58-
ci-infection:
59-
$(SILENT) $(PHP) $(INFECTION) $(INFECTION_ARGS)
50+
test-unit:
51+
$(PHPUNIT) $(PHPUNIT_ARGS)
6052

61-
ci-phpstan: ci-cs
62-
$(SILENT) $(PHP) $(PHPSTAN) $(PHPSTAN_ARGS) --no-progress
63-
64-
ci-psalm: ci-cs
65-
$(SILENT) $(PHP) $(PSALM) $(PSALM_ARGS) --no-cache --shepherd
66-
67-
ci-cs: prerequisites
68-
$(SILENT) $(PHP) $(PHP_CS_FIXER) $(PHP_CS_FIXER_ARGS) --dry-run --stop-on-violation fix
53+
infection:
54+
$(INFECTION) $(INFECTION_ARGS)
6955

7056
##############################################################
7157
# Development Workflow #
@@ -75,21 +61,21 @@ test: phpunit analyze composer-validate
7561

7662
.PHONY: composer-validate
7763
composer-validate: test-prerequisites
78-
$(SILENT) $(COMPOSER) validate --strict
64+
$(COMPOSER) validate --strict
7965

8066
test-prerequisites: prerequisites composer.lock
8167

82-
phpunit: cs
83-
$(SILENT) $(PHP) $(PHPUNIT) $(PHPUNIT_ARGS) --verbose
68+
phpunit: cs-fix
69+
$(PHPUNIT) $(PHPUNIT_ARGS) --verbose
8470
cp build/logs/junit.xml build/logs/phpunit.junit.xml
85-
$(SILENT) $(PHP) $(INFECTION) $(INFECTION_ARGS)
71+
$(PHP) $(INFECTION) $(INFECTION_ARGS)
8672

87-
analyze: cs
88-
$(SILENT) $(PHP) $(PHPSTAN) $(PHPSTAN_ARGS)
89-
$(SILENT) $(PHP) $(PSALM) $(PSALM_ARGS)
73+
analyze: cs-fix
74+
$(PHPSTAN) $(PHPSTAN_ARGS)
75+
$(PSALM) $(PSALM_ARGS)
9076

91-
cs: test-prerequisites
92-
$(SILENT) $(PHP) $(PHP_CS_FIXER) $(PHP_CS_FIXER_ARGS) --diff fix
77+
cs-fix: test-prerequisites
78+
$(PHP_CS_FIXER) fix $(PHP_CS_FIXER_ARGS)
9379
LC_ALL=C sort -u .gitignore -o .gitignore
9480

9581
##############################################################
@@ -98,21 +84,17 @@ cs: test-prerequisites
9884

9985
# We need both vendor/autoload.php and composer.lock being up to date
10086
.PHONY: prerequisites
101-
prerequisites: report-php-version build/cache vendor/autoload.php composer.lock infection.json.dist .phpstan.neon
87+
prerequisites: build/cache vendor/autoload.php composer.lock infection.json.dist .phpstan.neon
10288

10389
# Do install if there's no 'vendor'
10490
vendor/autoload.php:
105-
$(SILENT) $(COMPOSER) install --prefer-dist
106-
test -d vendor/infection/infection/src/StreamWrapper/ && rm -fr vendor/infection/infection/src/StreamWrapper/ && $(SILENT) $(COMPOSER) dump-autoload || true
91+
$(COMPOSER) install --prefer-dist
92+
test -d vendor/infection/infection/src/StreamWrapper/ && rm -fr vendor/infection/infection/src/StreamWrapper/ && $(COMPOSER) dump-autoload || true
10793

10894
# If composer.lock is older than `composer.json`, do update,
10995
# and touch composer.lock because composer not always does that
11096
composer.lock: composer.json
111-
$(SILENT) $(COMPOSER) update && touch composer.lock
97+
$(COMPOSER) update && touch composer.lock
11298

11399
build/cache:
114100
mkdir -p build/cache
115-
116-
.PHONY: report-php-version
117-
report-php-version:
118-
# Using $(PHP)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/infection/phpspec-adapter.svg?branch=master)](https://travis-ci.org/infection/phpspec-adapter)
1+
[![Continuous Integration](https://github.com/infection/phpspec-adapter/workflows/Continuous%20Integration/badge.svg)](https://github.com/infection/phpspec-adapter)
22
[![Coverage Status](https://coveralls.io/repos/github/infection/phpspec-adapter/badge.svg?branch=master)](https://coveralls.io/github/infection/phpspec-adapter?branch=master)
33

44
# PHPSpec Test Framework Adapter for Infection

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"phpstan/phpstan-phpunit": "^0.12.17",
4848
"phpstan/phpstan-strict-rules": "^0.12.8",
4949
"phpstan/phpstan-webmozart-assert": "^0.12.8",
50-
"phpunit/phpunit": "^8.5",
50+
"phpunit/phpunit": "^9.5",
5151
"thecodingmachine/safe": "^1.3",
5252
"vimeo/psalm": "^4.4"
5353
}

0 commit comments

Comments
 (0)