Skip to content

Commit f03e435

Browse files
committed
Update CI
1 parent 3acb28f commit f03e435

File tree

7 files changed

+95
-47
lines changed

7 files changed

+95
-47
lines changed

.github/workflows/php.yml

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ name: CI
33
on:
44
push:
55
branches: [ '**' ]
6+
paths-ignore:
7+
- '**.md'
68
pull_request:
7-
branches: [ master, development, release-* ]
9+
branches: [ master, release-* ]
10+
paths-ignore:
11+
- '**.md'
812

913
jobs:
1014
basic-tests:
@@ -45,10 +49,11 @@ jobs:
4549
- name: Setup PHP, with composer and extensions
4650
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
4751
with:
52+
coverage: pcov
53+
extensions: intl, mbstring, xml
54+
ini-values: error_reporting=E_ALL
4855
php-version: ${{ matrix.php-versions }}
49-
extensions: ldap, mbstring, xml
5056
tools: composer:v2
51-
coverage: pcov
5257

5358
- name: Setup problem matchers for PHP
5459
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
@@ -61,14 +66,14 @@ jobs:
6166
git config --global core.autocrlf false
6267
git config --global core.eol lf
6368
64-
- uses: actions/checkout@v2
69+
- uses: actions/checkout@v3
6570

6671
- name: Get composer cache directory
6772
id: composer-cache
6873
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
6974

7075
- name: Cache composer dependencies
71-
uses: actions/cache@v1
76+
uses: actions/cache@v3
7277
with:
7378
path: ${{ steps.composer-cache.outputs.dir }}
7479
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -95,7 +100,7 @@ jobs:
95100
96101
- name: Save coverage data
97102
if: ${{ matrix.php-versions == '7.4' && matrix.operating-system == 'ubuntu-latest' }}
98-
uses: actions/upload-artifact@v1
103+
uses: actions/upload-artifact@v3
99104
with:
100105
name: build-data
101106
path: ${{ github.workspace }}/build
@@ -108,21 +113,21 @@ jobs:
108113
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
109114
with:
110115
php-version: '7.4'
116+
extensions: mbstring, xml
111117
tools: composer:v2
112-
extensions: ldap, mbstring, xml
113118
coverage: none
114119

115120
- name: Setup problem matchers for PHP
116121
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
117122

118-
- uses: actions/checkout@v2
123+
- uses: actions/checkout@v3
119124

120125
- name: Get composer cache directory
121126
id: composer-cache
122127
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
123128

124129
- name: Cache composer dependencies
125-
uses: actions/cache@v1
130+
uses: actions/cache@v3
126131
with:
127132
path: ${{ steps.composer-cache.outputs.dir }}
128133
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -132,13 +137,13 @@ jobs:
132137
run: composer install --no-progress --prefer-dist --optimize-autoloader
133138

134139
- name: Security check for locked dependencies
135-
uses: symfonycorp/security-checker-action@v2
140+
uses: symfonycorp/security-checker-action@v3
136141

137142
- name: Update Composer dependencies
138143
run: composer update --no-progress --prefer-dist --optimize-autoloader
139144

140145
- name: Security check for updated dependencies
141-
uses: symfonycorp/security-checker-action@v2
146+
uses: symfonycorp/security-checker-action@v3
142147

143148
sanity-check:
144149
name: Sanity checks
@@ -149,21 +154,21 @@ jobs:
149154
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
150155
with:
151156
php-version: '7.4'
157+
extensions: mbstring, xml
152158
tools: composer:v2
153-
extensions: ldap, mbstring, xml
154159
coverage: none
155160

156161
- name: Setup problem matchers for PHP
157162
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
158163

159-
- uses: actions/checkout@v2
164+
- uses: actions/checkout@v3
160165

161166
- name: Get composer cache directory
162167
id: composer-cache
163168
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
164169

165170
- name: Cache composer dependencies
166-
uses: actions/cache@v1
171+
uses: actions/cache@v3
167172
with:
168173
path: ${{ steps.composer-cache.outputs.dir }}
169174
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -185,23 +190,24 @@ jobs:
185190

186191
steps:
187192
- name: Setup PHP, with composer and extensions
193+
id: setup-php
188194
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
189195
with:
190196
php-version: '7.4'
191197
tools: composer:v2
192-
extensions: ldap, mbstring, xml
198+
extensions: mbstring, xml
193199

194200
- name: Setup problem matchers for PHP
195201
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
196202

197-
- uses: actions/checkout@v2
203+
- uses: actions/checkout@v3
198204

199205
- name: Get composer cache directory
200206
id: composer-cache
201207
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
202208

203209
- name: Cache composer dependencies
204-
uses: actions/cache@v1
210+
uses: actions/cache@v3
205211
with:
206212
path: ${{ steps.composer-cache.outputs.dir }}
207213
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -210,22 +216,22 @@ jobs:
210216
- name: Install Composer dependencies
211217
run: composer install --no-progress --prefer-dist --optimize-autoloader
212218

213-
- uses: actions/download-artifact@v1
219+
- uses: actions/download-artifact@v3
214220
with:
215221
name: build-data
216222
path: ${{ github.workspace }}/build
217223

218224
- name: Codecov
219-
uses: codecov/codecov-action@v1
225+
uses: codecov/codecov-action@v3
220226

221227
- name: PHP Code Sniffer
222228
continue-on-error: true
223229
run: php vendor/bin/phpcs
224230

225231
- name: Psalm
226232
continue-on-error: true
227-
run: php vendor/bin/psalm --show-info=true
233+
run: php vendor/bin/psalm --show-info=true --shepherd --php-version=${{ steps.setup-php.outputs.php-version }}
228234

229235
- name: Psalter
230236
continue-on-error: true
231-
run: php vendor/bin/psalter --issues=UnnecessaryVarAnnotation --dry-run
237+
run: php vendor/bin/psalter --issues=UnnecessaryVarAnnotation --dry-run --php-version=${{ steps.setup-php.outputs.php-version }}

.php_cs.dist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
$finder = PhpCsFixer\Finder::create()
3+
->in([
4+
__DIR__ . '/src',
5+
__DIR__ . '/tests',
6+
])
7+
;
8+
return PhpCsFixer\Config::create()
9+
->setRules([
10+
'@PSR2' => true,
11+
'@PSR4' => true,
12+
'@PSR5' => true,
13+
])
14+
->setFinder($finder)
15+
;

codecov.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: 0%
6+
threshold: 2%
7+
patch: off
8+
comment:
9+
layout: "diff"
10+
behavior: once
11+
require_changes: true
12+
require_base: no
13+
require_head: yes
14+
branches: null
15+
16+
github_checks:
17+
annotations: false

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,27 @@
77
"authors": [
88
{
99
"name": "Guy Halse",
10-
"homepage": "http://orcid.org/0000-0002-9388-8592"
10+
"homepage": "http://orcid.org/0000-0002-9388-8592"
1111
}
1212
],
1313
"config": {
1414
"preferred-install": {
15+
"simplesamlphp/simplesamlphp": "source",
1516
"*": "dist"
1617
},
1718
"sort-packages": true,
1819
"allow-plugins": {
20+
"composer/package-versions-deprecated": true,
1921
"simplesamlphp/composer-module-installer": true
2022
}
2123
},
2224
"require": {
2325
"php": ">=7.4",
2426
"simplesamlphp/composer-module-installer": "~1.1"
2527
},
26-
"require-dev": {
28+
"require-dev": {
2729
"simplesamlphp/simplesamlphp": ">=1.19",
28-
"simplesamlphp/simplesamlphp-test-framework": "~0.1.0"
30+
"simplesamlphp/simplesamlphp-test-framework": "~1.1.4"
2931
},
3032
"suggest": {
3133
"ext-pdo": "Needed for database backend",

phpcs.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="SimpleSAMLphp module ruleset">
3+
<config name="ignore_warnings_on_exit" value="1"/>
4+
5+
<description>
6+
By default it is less stringent about long lines than other coding standards
7+
</description>
8+
9+
<file>lib</file>
10+
<file>tests</file>
11+
12+
<!-- Use this to exclude paths. You can have multiple patterns -->
13+
<!--<exclude-pattern>*/tests/*</exclude-pattern>-->
14+
<!--<exclude-pattern>*/other/*</exclude-pattern>-->
15+
16+
<!-- This is the rule we inherit from. If you want to exlude some specific rules, see the docs on how to do that -->
17+
<rule ref="PSR12"/>
18+
</ruleset>

psalm.xml

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,34 @@
11
<?xml version="1.0"?>
22
<psalm
3-
name="simplesaml-module-safire"
3+
name="SimpleSAMLphp module"
44
useDocblockTypes="true"
55
totallyTyped="false"
6-
hideExternalErrors="true"
7-
allowStringToStandInForClass="true"
86
>
97
<projectFiles>
8+
<!-- <directory name="config-templates" /> -->
9+
<directory name="hooks" />
1010
<directory name="lib" />
11-
<ignoreFiles>
12-
<directory name="vendor" />
13-
</ignoreFiles>
11+
<directory name="templates" />
12+
<directory name="www" />
1413
</projectFiles>
1514

1615
<issueHandlers>
1716
<LessSpecificReturnType errorLevel="info" />
1817

19-
<!-- level 3 issues - slightly lazy code writing, but provably low false-negatives -->
20-
18+
<!-- level 3 issues - slightly lazy code writing, but probably low false-negatives -->
2119
<DeprecatedMethod errorLevel="info" />
22-
<DeprecatedProperty errorLevel="info" />
23-
<DeprecatedClass errorLevel="info" />
24-
<DeprecatedConstant errorLevel="info" />
25-
<DeprecatedInterface errorLevel="info" />
26-
<DeprecatedTrait errorLevel="info" />
2720

2821
<MissingClosureReturnType errorLevel="info" />
2922
<MissingReturnType errorLevel="info" />
3023
<MissingPropertyType errorLevel="info" />
3124
<InvalidDocblock errorLevel="info" />
25+
<MisplacedRequiredParam errorLevel="info" />
3226

3327
<PropertyNotSetInConstructor errorLevel="info" />
3428
<MissingConstructor errorLevel="info" />
3529
<MissingClosureParamType errorLevel="info" />
3630
<MissingParamType errorLevel="info" />
37-
38-
<RedundantCondition errorLevel="info" />
39-
40-
<DocblockTypeContradiction errorLevel="info" />
41-
<RedundantConditionGivenDocblockType errorLevel="info" />
42-
43-
<UnresolvableInclude errorLevel="info" />
44-
45-
<RawObjectIteration errorLevel="info" />
31+
<UnusedClass errorLevel="info" />
32+
<PossiblyUnusedMethod errorLevel="info" />
4633
</issueHandlers>
4734
</psalm>

tests/bootstrap.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
$projectRoot = dirname(__DIR__);
36
require_once($projectRoot . '/vendor/autoload.php');
47

58
// Symlink module into ssp vendor lib so that templates and urls can resolve correctly
6-
$linkPath = $projectRoot . '/vendor/simplesamlphp/simplesamlphp/modules/consent';
9+
$linkPath = $projectRoot . '/vendor/simplesamlphp/simplesamlphp/modules/sqlattribs';
710
if (file_exists($linkPath) === false) {
811
echo "Linking '$linkPath' to '$projectRoot'\n";
912
symlink($projectRoot, $linkPath);

0 commit comments

Comments
 (0)