Skip to content

Commit ed5b7dd

Browse files
authored
minor #7 Workflow improvements (sstok)
This PR was merged into the 2.1-dev branch. Discussion ---------- | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Fixed tickets | | License | MIT - Split workflow files and use Rollerscapes Inspector for CS - Don't cache vcs in workflow - Update License year range Commits ------- f00df4a Workflow improvements
2 parents 099201c + f00df4a commit ed5b7dd

10 files changed

Lines changed: 208 additions & 169 deletions

.github/composer-config.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"config": {
3+
"cache-vcs-dir": "/dev/null",
4+
"platform-check": false,
5+
"preferred-install": {
6+
"*": "dist"
7+
},
8+
"allow-plugins": {
9+
"ergebnis/composer-normalize": true,
10+
"symfony/flex": true
11+
}
12+
}
13+
}

.github/workflows/ci.yaml

Lines changed: 0 additions & 157 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Composer Validate
2+
3+
on:
4+
push:
5+
paths:
6+
- 'composer.json'
7+
pull_request:
8+
paths:
9+
- 'composer.json'
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
composer-sync:
20+
name: 'Composer validation'
21+
runs-on: ubuntu-24.04
22+
env:
23+
php-version: '8.4'
24+
25+
steps:
26+
-
27+
name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ env.php-version }}
31+
ini-values: "memory_limit=-1"
32+
coverage: none
33+
34+
-
35+
name: Checkout target branch
36+
uses: actions/checkout@v6
37+
38+
-
39+
name: 'Install dependencies'
40+
run: |
41+
COMPOSER_HOME="$(composer config home)"
42+
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
43+
composer global require -q "ergebnis/composer-normalize"
44+
composer install --no-progress
45+
46+
-
47+
name: 'Normalized composer.json'
48+
run: |
49+
echo "composer.json"
50+
composer validate
51+
composer normalize
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CS
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
call-inspector-bot:
11+
name: InspectorBot
12+
uses: rollerscapes/inspector-bot/.github/workflows/inspector-bot.yml@main
13+
with:
14+
package: RollerworksUriEncoder
15+
check_license: true
16+

.github/workflows/phpstan.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: PHPStan
2+
3+
on:
4+
pull_request:
5+
6+
defaults:
7+
run:
8+
shell: bash
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
phpstan:
19+
name: PHPStan
20+
runs-on: ubuntu-24.04
21+
22+
env:
23+
php-version: '8.2'
24+
steps:
25+
-
26+
name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ env.php-version }}
30+
ini-values: "memory_limit=-1"
31+
coverage: none
32+
33+
-
34+
name: Checkout target branch
35+
uses: actions/checkout@v6
36+
with:
37+
ref: ${{ github.base_ref }}
38+
39+
-
40+
name: Checkout PR
41+
uses: actions/checkout@v6
42+
43+
-
44+
name: Install dependencies
45+
run: |
46+
COMPOSER_HOME="$(composer config home)"
47+
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
48+
composer install --no-progress --ansi --no-plugins
49+
50+
-
51+
name: Generate PHPStan baseline
52+
run: |
53+
git checkout composer.json
54+
git checkout -m ${{ github.base_ref }}
55+
vendor/bin/phpstan analyze --generate-baseline --allow-empty-baseline --no-progress
56+
git checkout -m FETCH_HEAD
57+
58+
-
59+
name: PHPStan
60+
run: |
61+
vendor/bin/phpstan analyze --no-progress --error-format=github
62+

.github/workflows/unit-tests.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
12+
test:
13+
14+
name: 'PHPUnit with PHP ${{ matrix.php-version }} / Symfony ${{ matrix.symfony-version }}'
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- php-version: '8.1'
22+
- php-version: '8.2'
23+
- php-version: '8.3'
24+
- php-version: '8.4'
25+
- php-version: '8.5'
26+
steps:
27+
-
28+
name: Checkout
29+
uses: actions/checkout@v6
30+
31+
-
32+
name: 'Set up PHP'
33+
uses: 'shivammathur/setup-php@v2'
34+
with:
35+
php-version: '${{ matrix.php-version }}'
36+
coverage: none
37+
env:
38+
update: true
39+
40+
-
41+
name: 'Install dependencies'
42+
env:
43+
COMPOSER_OPTIONS: '${{ matrix.composer-options }}'
44+
SYMFONY_REQUIRE: '${{ matrix.symfony-version }}'
45+
run: |
46+
composer global config --no-plugins allow-plugins.symfony/flex true
47+
composer global require --no-progress --no-scripts --no-plugins symfony/flex
48+
composer update --no-progress --no-interaction --optimize-autoloader $COMPOSER_OPTIONS
49+
50+
-
51+
name: Run Tests
52+
run: make phpunit

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014 Sebastiaan Stok
1+
Copyright (c) 2014-present Sebastiaan Stok
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)