Skip to content

Commit 6b26e99

Browse files
authored
refactor: Rework the composer root version checker into a proper sub-project (#789)
This 3 files script have been quite annoying to write and they are now failing again. I think it's high time this is restructured a bit with some tests.
1 parent 2c7d608 commit 6b26e99

27 files changed

+3848
-238
lines changed

.gitattributes

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
*.php text eol=lf
44

55
# Ignore all test and documentation with "export-ignore".
6-
/.gitattributes export-ignore
7-
/.gitignore export-ignore
8-
/.styleci.yml export-ignore
9-
/.travis.yml export-ignore
10-
/.appveyor.yml export-ignore
11-
/phpunit.xml.dist export-ignore
12-
/tests export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/.styleci.yml export-ignore
9+
/.travis.yml export-ignore
10+
/.appveyor.yml export-ignore
11+
/phpunit.xml.dist export-ignore
12+
/composer-root-version-checker export-ignore
13+
/tests export-ignore
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: RootVersionChecker
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
cs-lint:
10+
runs-on: ubuntu-latest
11+
name: CS lint
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: [ '8.1' ] # Should be the latest PHP version supported
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: "${{ matrix.php }}"
25+
tools: composer
26+
27+
- name: Install PHP-CS-Fixer
28+
uses: ramsey/composer-install@v2
29+
with:
30+
working-directory: 'vendor-bin/php-cs-fixer'
31+
tools: composer
32+
33+
- name: Ensures the makefile does not remake the PHP-CS-Fixer target
34+
run: touch -c vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
35+
36+
- name: Install the Composer dependencies
37+
uses: ramsey/composer-install@v2
38+
with:
39+
working-directory: 'composer-root-version-checker'
40+
41+
- name: Lints CS
42+
run: cd composer-root-version-checker; make cs_lint
43+
44+
tests:
45+
runs-on: ubuntu-latest
46+
name: Tests
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
php: [ '8.1' ] # Should be the latest PHP version supported
51+
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v3
55+
56+
- name: Setup PHP
57+
uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: "${{ matrix.php }}"
60+
tools: composer
61+
62+
- name: Install the Composer dependencies
63+
uses: ramsey/composer-install@v2
64+
with:
65+
working-directory: 'composer-root-version-checker'
66+
67+
- name: Runs the tests
68+
run: cd composer-root-version-checker; make test

.github/workflows/tests.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
php: [ '8.1' ]
18+
php: [ '8.1' ] # Should be the latest PHP version supported
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v3
@@ -29,6 +29,11 @@ jobs:
2929
tools: composer
3030
coverage: none
3131

32+
- name: Install Composer dependencies
33+
uses: ramsey/composer-install@v2
34+
with:
35+
working-directory: 'composer-root-version-checker'
36+
3237
- name: Check COMPOSER_ROOT_VERSION
3338
run: make check_composer_root_version
3439

.php-cs-fixer.dist.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
$finder = Finder::create()
1919
->in([
20+
'composer-root-version-checker/bin',
21+
'composer-root-version-checker/src',
22+
'composer-root-version-checker/tests',
2023
'src',
2124
'tests',
2225
])

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ build:
22
image: default-bionic
33
environment:
44
variables:
5-
COMPOSER_ROOT_VERSION: '0.17.99'
5+
COMPOSER_ROOT_VERSION: '0.18.0-rc.0'
66

77
nodes:
88
analysis:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ validate_package:
118118
.PHONY: check_composer_root_version
119119
check_composer_root_version: ## Checks that the COMPOSER_ROOT_VERSION is up to date
120120
check_composer_root_version: .composer-root-version
121-
php bin/check-composer-root-version.php
121+
cd composer-root-version-checker; $(MAKE) --makefile Makefile check_root_version
122122

123123
.PHONY: covers_validator
124124
covers_validator: ## Checks PHPUnit @coves tag

bin/check-composer-root-version.php

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

bin/dump-composer-root-version.php

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

bin/root-version.php

Lines changed: 0 additions & 115 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor/

0 commit comments

Comments
 (0)