Skip to content

Commit efc7e7c

Browse files
Radoslaw Ziemniewiczclaude
andcommitted
Run the tests on GitHub, and analyse the sources
Every package carried a Travis configuration which has not built anything for years, and a badge in its README saying it had. GitHub Actions runs the tests on PHP 8.1 through 8.4, collects coverage under phpdbg, and analyses the sources, on every push and every pull request. The badge now points at something which actually runs. PHPStan reads the sources at level 9. Whatever a package does not pass yet sits in phpstan-baseline.neon, so the analysis is green from the first run, nothing new can be added, and what is left to clean up is written down instead of being turned off. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ARqBYLxrHqevcVmxHkpJcZ
1 parent 24cb8fc commit efc7e7c

6 files changed

Lines changed: 98 additions & 19 deletions

File tree

‎.github/workflows/tests.yml‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
tests:
10+
name: PHP ${{ matrix.php }}
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: ['8.1', '8.2', '8.3', '8.4']
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.php }}
22+
coverage: none
23+
24+
- uses: ramsey/composer-install@v3
25+
26+
- name: Unit tests
27+
run: vendor/bin/unit-tests
28+
29+
coverage:
30+
name: Coverage
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- uses: shivammathur/setup-php@v2
36+
with:
37+
php-version: '8.3'
38+
coverage: none
39+
40+
- uses: ramsey/composer-install@v3
41+
42+
- name: Unit tests with coverage
43+
run: phpdbg -qrr vendor/bin/unit-tests
44+
45+
static-analysis:
46+
name: Static analysis
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: '8.3'
54+
coverage: none
55+
56+
- uses: ramsey/composer-install@v3
57+
58+
- name: PHPStan
59+
run: vendor/bin/phpstan analyse --no-progress

‎.travis.yml‎

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

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Quillstack Parameter Bag
22

3-
[![Build Status](https://app.travis-ci.com/quillstack/parameter-bag.svg?branch=main)](https://app.travis-ci.com/quillstack/parameter-bag)
3+
[![Tests](https://github.com/quillstack/parameter-bag/actions/workflows/tests.yml/badge.svg)](https://github.com/quillstack/parameter-bag/actions/workflows/tests.yml)
44
[![Downloads](https://img.shields.io/packagist/dt/quillstack/parameter-bag.svg)](https://packagist.org/packages/quillstack/parameter-bag)
55
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=quillstack_parameter-bag&metric=coverage)](https://sonarcloud.io/dashboard?id=quillstack_parameter-bag)
66
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=quillstack_parameter-bag&metric=ncloc)](https://sonarcloud.io/dashboard?id=quillstack_parameter-bag)

‎composer.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,17 @@
2626
}
2727
},
2828
"require-dev": {
29+
"phpstan/phpstan": "^2.0",
2930
"quillstack/unit-tests": "^0.5"
3031
},
3132
"extra": {
3233
"branch-alias": {
3334
"dev-main": "0.2.x-dev"
3435
}
36+
},
37+
"scripts": {
38+
"test": "unit-tests",
39+
"test:coverage": "phpdbg -qrr vendor/bin/unit-tests",
40+
"stan": "phpstan analyse"
3541
}
3642
}

‎phpstan-baseline.neon‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Method Quillstack\\ParameterBag\\ParameterBag\:\:__construct\(\) has parameter \$parameters with no value type specified in iterable type array\.$#'
5+
identifier: missingType.iterableValue
6+
count: 1
7+
path: src/ParameterBag.php
8+
9+
-
10+
message: '#^Method Quillstack\\ParameterBag\\ParameterBag\:\:all\(\) return type has no value type specified in iterable type array\.$#'
11+
identifier: missingType.iterableValue
12+
count: 1
13+
path: src/ParameterBag.php
14+
15+
-
16+
message: '#^Method Quillstack\\ParameterBag\\ParameterBag\:\:get\(\) has parameter \$default with no type specified\.$#'
17+
identifier: missingType.parameter
18+
count: 1
19+
path: src/ParameterBag.php
20+
21+
-
22+
message: '#^Method Quillstack\\ParameterBag\\ParameterBag\:\:set\(\) has parameter \$value with no type specified\.$#'
23+
identifier: missingType.parameter
24+
count: 1
25+
path: src/ParameterBag.php

‎phpstan.neon‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: 9
6+
paths:
7+
- src

0 commit comments

Comments
 (0)