Skip to content

Commit 6b77db6

Browse files
authored
Update dev deps and CI workflows (#133)
1 parent 8543208 commit 6b77db6

7 files changed

Lines changed: 74 additions & 25 deletions

File tree

.github/workflows/build.yml

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,41 @@ on:
99
- 'main'
1010
- 'hotfix-*'
1111

12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: ${{ github.ref }}
17+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
18+
1219
jobs:
20+
static-checks:
21+
name: Run static checks
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6
26+
27+
- name: Set up PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: "8.3"
31+
32+
- name: Validate composer.json
33+
run: composer validate
34+
35+
- name: Install dependencies
36+
run: composer update --prefer-dist --no-progress
37+
38+
- name: Run PHP_CodeSniffer
39+
run: vendor/bin/phpcs -sp
40+
41+
- name: Run Psalm
42+
run: vendor/bin/psalm --shepherd
43+
1344
tests:
14-
name: PHP ${{ matrix.php-version }} on ${{ matrix.os }} (${{ matrix.composer-options }})
15-
runs-on: ${{ matrix.os }}
45+
name: Test on ${{ matrix.os }} php${{ matrix.php-version }}
46+
runs-on: ${{ matrix.os }}-latest
1647
strategy:
1748
fail-fast: false
1849
matrix:
@@ -22,15 +53,13 @@ jobs:
2253
- "8.2"
2354
- "8.3"
2455
os:
25-
- ubuntu-latest
26-
- windows-latest
27-
- macOS-latest
28-
composer-options:
29-
- ""
30-
- "--prefer-lowest"
56+
- ubuntu
57+
- windows
58+
- macOS
59+
3160
steps:
3261
- name: Checkout
33-
uses: actions/checkout@v4
62+
uses: actions/checkout@v6
3463

3564
- name: Set up PHP ${{ matrix.php-version }}
3665
uses: shivammathur/setup-php@v2
@@ -40,14 +69,21 @@ jobs:
4069
coverage: xdebug
4170
ini-values: error_reporting=E_ALL
4271

43-
- name: Validate composer.json and composer.lock
44-
run: composer validate
45-
4672
- name: Install dependencies
47-
run: composer update
48-
--prefer-dist
49-
--no-progress
50-
${{ matrix.composer-options }}
73+
run: composer update --prefer-dist --no-progress
74+
75+
- name: Show Codeception version
76+
run: |
77+
echo "Tested against Codeception **v$(
78+
composer show codeception/codeception --format json | jq -r '.versions[0]'
79+
)**" >> "$GITHUB_STEP_SUMMARY"
80+
shell: bash
81+
82+
- name: Run unit tests tests
83+
run: composer test-unit
84+
85+
- name: Run samples
86+
run: composer test-report-generate
5187

52-
- name: Run tests
53-
run: composer test
88+
- name: Assert samples
89+
run: composer test-report-check

.github/workflows/labels-verify.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ on:
44
pull_request:
55
types: [opened, labeled, unlabeled, synchronize]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
triage:
912
runs-on: ubuntu-latest
1013
steps:
1114
- uses: baev/match-label-action@master
1215
with:
13-
allowed: 'type:bug,type:new feature,type:improvement,type:dependencies,type:internal,type:invalid'
16+
allowed: 'type:bug,type:new feature,type:improvement,type:dependencies,type:internal,type:invalid,type:docs'

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
"allure-framework/allure-php-commons": "^2.3.1"
2828
},
2929
"require-dev": {
30-
"psalm/plugin-phpunit": "^0.19.0",
30+
"psalm/plugin-phpunit": "^0.19.0 || ^0.20.1",
3131
"remorhaz/php-json-data": "^0.5.3",
3232
"remorhaz/php-json-path": "^0.7.7",
33-
"squizlabs/php_codesniffer": "^3.7.2",
34-
"vimeo/psalm": "^5.12"
33+
"squizlabs/php_codesniffer": "^4.0.1",
34+
"vimeo/psalm": "^5.26.1 || ^6.16.1"
3535
},
3636
"autoload": {
3737
"psr-4": {

phpcs.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
<file>src</file>
66
<file>test</file>
7+
<exclude-pattern>test/codeception/_support/_generated/*</exclude-pattern>
8+
<exclude-pattern>test/codeception-report/_support/_generated/*</exclude-pattern>
79

810
<arg name="colors"/>
911

src/Internal/GherkinProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public function getLabels(): array
3636
return array_map(
3737
fn (string $value) => Label::feature($value),
3838
[
39-
...array_values($this->test->getFeatureNode()->getTags()),
40-
...array_values($this->test->getScenarioNode()->getTags()),
39+
...$this->test->getFeatureNode()->getTags(),
40+
...$this->test->getScenarioNode()->getTags(),
4141
],
4242
);
4343
}

src/Internal/UnitInfoBuilder.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ public function build(?string $host, ?string $thread): TestInfo
2222
$index = $this->test->getMetadata()->getIndex();
2323
$dataLabel = is_int($index) ? "#$index" : $index;
2424

25+
/**
26+
* @var null|string
27+
*/
28+
$class = $fields['class'];
29+
2530
return new TestInfo(
2631
originalTest: $this->test,
2732
signature: $this->test->getSignature(),
28-
class: $fields['class'] ?? null,
33+
class: $class ?? null,
2934
method: $this->test->getMetadata()->getName(),
3035
dataLabel: $dataLabel,
3136
host: $host,

test/codeception-report/unit/StepsTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ private function createFailingStep(string $name, string $failure): Step
8585
return new class ($failure, $name) extends Meta {
8686
private string $failure;
8787

88+
/**
89+
* @param array<array-key, string> $arguments
90+
*/
8891
public function __construct(string $failure, string $action, array $arguments = [])
8992
{
9093
parent::__construct($action, $arguments);

0 commit comments

Comments
 (0)