Skip to content

Commit 43c48f1

Browse files
committed
Add basic configuration for Behat
Allowing us to more easily describe the behaviour of the features offered by this library. Signed-off-by: Luís Cobucci <[email protected]>
1 parent 30a01f7 commit 43c48f1

File tree

5 files changed

+923
-30
lines changed

5 files changed

+923
-30
lines changed

.github/workflows/behat.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Behat tests"
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
phpunit:
9+
name: "Behat tests"
10+
11+
runs-on: ${{ matrix.operating-system }}
12+
13+
strategy:
14+
matrix:
15+
dependencies:
16+
- "locked"
17+
php-version:
18+
- "8.1"
19+
operating-system:
20+
- "ubuntu-latest"
21+
22+
steps:
23+
- name: "Checkout"
24+
uses: "actions/checkout@v3"
25+
26+
- name: "Install PHP"
27+
uses: "shivammathur/[email protected]"
28+
with:
29+
php-version: "${{ matrix.php-version }}"
30+
ini-values: memory_limit=-1
31+
tools: composer:v2, cs2pr
32+
33+
- name: Get composer cache directory
34+
id: composer-cache
35+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
36+
37+
- name: "Cache dependencies"
38+
uses: "actions/[email protected]"
39+
with:
40+
path: ${{ steps.composer-cache.outputs.dir }}
41+
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
42+
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
43+
44+
- name: "Install lowest dependencies"
45+
if: ${{ matrix.dependencies == 'lowest' }}
46+
run: "composer update --prefer-lowest --no-interaction --no-progress"
47+
48+
- name: "Install highest dependencies"
49+
if: ${{ matrix.dependencies == 'highest' }}
50+
run: "composer update --no-interaction --no-progress"
51+
52+
- name: "Install locked dependencies"
53+
if: ${{ matrix.dependencies == 'locked' }}
54+
run: "composer install --no-interaction --no-progress"
55+
56+
- name: "Install development dependencies"
57+
if: ${{ matrix.dependencies == 'development' }}
58+
run: "composer config minimum-stability dev && composer update --no-interaction --no-progress"
59+
60+
- name: "Tests"
61+
run: "make behat"

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PARALLELISM := $(shell nproc)
22

33
.PHONY: all
4-
all: install phpcbf phpcs phpstan phpunit infection
4+
all: install phpcbf phpcs phpstan phpunit behat infection
55

66
.PHONY: install
77
install: vendor/composer/installed.json
@@ -14,14 +14,18 @@ vendor/composer/installed.json: composer.json composer.lock
1414
phpunit:
1515
@php -d zend.assertions=1 vendor/bin/phpunit --testsuite=unit
1616

17+
.PHONY: behat
18+
behat:
19+
@php -d zend.assertions=1 vendor/bin/behat
20+
1721
.PHONY: infection
1822
infection:
1923
@php -d zend.assertions=1 -d xdebug.mode=coverage vendor/bin/phpunit --testsuite=unit --coverage-xml=build/coverage-xml --log-junit=build/junit.xml $(PHPUNIT_FLAGS)
2024
@php -d zend.assertions=1 vendor/bin/infection -s --threads=$(PARALLELISM) --coverage=build $(INFECTION_FLAGS)
2125

2226
.PHONY: phpcbf
2327
phpcbf:
24-
@vendor/bin/phpcbf --parallel=$(PARALLELISM)
28+
@vendor/bin/phpcbf --parallel=$(PARALLELISM) || true
2529

2630
.PHONY: phpcs
2731
phpcs:

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"react/socket": "^1.6"
2626
},
2727
"require-dev": {
28+
"behat/behat": "^3.11",
2829
"infection/infection": "^0.26",
2930
"lcobucci/coding-standard": "^8.0",
3031
"monolog/monolog": "^3.2",

0 commit comments

Comments
 (0)