Skip to content

Commit 34d26d9

Browse files
committed
[TASK] Move commands to composer and use them from ci and nix-shell
1 parent c7abcb2 commit 34d26d9

3 files changed

Lines changed: 50 additions & 44 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 30 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,19 @@ jobs:
6161
run: composer install --prefer-dist --no-progress --no-suggest
6262

6363
- name: Coding Guideline
64-
run: .build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./
64+
run: composer project:cgl
6565

6666
code-quality:
6767
runs-on: ubuntu-latest
6868
needs:
6969
- php-linting
7070
strategy:
7171
matrix:
72-
include:
73-
- php-version: '8.2'
74-
typo3-version: '^14.1'
75-
- php-version: '8.3'
76-
typo3-version: '^14.1'
77-
- php-version: '8.4'
78-
typo3-version: '^14.1'
79-
- php-version: '8.5'
80-
typo3-version: '^14.1'
72+
php-version:
73+
- 8.2
74+
- 8.3
75+
- 8.4
76+
- 8.5
8177
steps:
8278
- uses: actions/checkout@v4
8379

@@ -89,54 +85,50 @@ jobs:
8985

9086
- name: Install dependencies with expected TYPO3 version
9187
run: |-
92-
composer require --no-interaction --prefer-dist --no-progress "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-extbase:${{ matrix.typo3-version }}" "typo3/cms-frontend:${{ matrix.typo3-version }}"
88+
composer remove --dev ssch/typo3-rector \
89+
&& composer require typo3/cms-install "*" \
90+
&& composer install --no-progress --no-ansi --no-interaction
9391
9492
- name: Build codeception tester
9593
run: .build/bin/codecept build
9694

9795
- name: Code Quality (by PHPStan)
98-
run: .build/bin/phpstan analyse -c Build/phpstan.neon
96+
run: composer project:phpstan
9997

100-
test-unit-and-functional:
98+
tests-unit-and-functional:
10199
runs-on: ubuntu-latest
102100
needs:
103101
- coding-guideline
104102
- code-quality
103+
strategy:
104+
matrix:
105+
php-version:
106+
- 8.2
107+
- 8.3
108+
- 8.4
109+
- 8.5
105110
steps:
106-
- uses: actions/checkout@v5
111+
- uses: actions/checkout@v4
107112

108-
- uses: cachix/install-nix-action@v31
113+
- name: Install PHP
114+
uses: shivammathur/setup-php@v2
109115
with:
110-
nix_path: nixpkgs=channel:nixos-unstable
111-
112-
- name: Run Unit Tests PHP8.2
113-
run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-unit
114-
115-
- name: Run Unit Tests PHP8.3
116-
run: nix-shell --arg phpVersion \"php83\" --pure --run project-test-unit
117-
118-
- name: Run Unit Tests PHP8.4
119-
run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-unit
120-
121-
- name: Run Unit Tests PHP8.5
122-
run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-unit
123-
124-
- name: Run Functional Tests PHP8.2
125-
run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-functional
116+
php-version: "${{ matrix.php-version }}"
117+
tools: composer:v2
126118

127-
- name: Run Functional Tests PHP8.3
128-
run: nix-shell --arg phpVersion \"php83\" --pure --run project-test-functional
119+
- name: Install dependencies
120+
run: composer install --prefer-dist --no-progress --no-suggest
129121

130-
- name: Run Functional Tests PHP8.4
131-
run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-functional
122+
- name: Run unit tests
123+
run: composer project:test:unit
132124

133-
- name: Run Functional Tests PHP8.5
134-
run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-functional
125+
- name: Run functional tests
126+
run: export typo3DatabaseDriver=pdo_sqlite && composer project:test:functional
135127

136128
test-acceptance:
137129
runs-on: ubuntu-latest
138130
needs:
139-
- test-unit-and-functional
131+
- tests-unit-and-functional
140132
steps:
141133
- uses: actions/checkout@v5
142134

composer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@
8080
"werkraummedia/watchlist": "^3.0",
8181
"ssch/typo3-rector": "^3.11"
8282
},
83+
"scripts": {
84+
"project:cgl": "php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --diff --using-cache=no",
85+
"project:cgl:fix": "php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php --using-cache=no",
86+
"project:lint:php": "find ./*.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l",
87+
"project:phpstan": "phpstan analyse -c Build/phpstan.neon --memory-limit 256M",
88+
"project:test:unit": "phpunit -c Build/phpunit.xml.dist --testsuite unit --display-warnings --display-deprecations --display-errors --display-notices",
89+
"project:test:functional": "phpunit -c Build/phpunit.xml.dist --testsuite functional --display-warnings --display-deprecations --display-errors"
90+
},
8391
"suggest": {
8492
"werkraummedia/watchlist": "^3.0"
8593
}

shell.nix

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,71 +32,77 @@ let
3232
name = "project-cgl";
3333

3434
runtimeInputs = [
35+
composer
3536
php
3637
];
3738

3839
text = ''
39-
./.build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --diff
40+
composer project:cgl
4041
'';
4142
};
4243

4344
projectCglFix = pkgs.writeShellApplication {
4445
name = "project-cgl-fix";
4546

4647
runtimeInputs = [
48+
composer
4749
php
4850
];
4951

5052
text = ''
51-
./.build/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php
53+
composer project:cgl:fix
5254
'';
5355
};
5456

5557
projectLint = pkgs.writeShellApplication {
5658
name = "project-lint";
5759

5860
runtimeInputs = [
61+
composer
5962
php
6063
];
6164

6265
text = ''
63-
find ./*.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
66+
composer project:lint:php
6467
'';
6568
};
6669

6770
projectPhpstan = pkgs.writeShellApplication {
6871
name = "project-phpstan";
6972

7073
runtimeInputs = [
74+
composer
7175
php
7276
];
7377

7478
text = ''
75-
./.build/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M
79+
composer project:phpstan
7680
'';
7781
};
7882

7983
projectTestUnit = pkgs.writeShellApplication {
8084
name = "project-test-unit";
8185
runtimeInputs = [
86+
composer
8287
php
8388
projectInstall
8489
];
8590
text = ''
8691
project-install
87-
./.build/bin/phpunit -c Build/phpunit.xml.dist --testsuite unit --display-deprecations --display-warnings --display-errors
92+
composer project:test:unit
8893
'';
8994
};
9095

9196
projectTestFunctional = pkgs.writeShellApplication {
9297
name = "project-test-functional";
9398
runtimeInputs = [
99+
composer
94100
php
95101
projectInstall
96102
];
97103
text = ''
98104
project-install
99-
./.build/bin/phpunit -c Build/phpunit.xml.dist --testsuite functional --display-deprecations --display-warnings --display-errors
105+
composer project:test:functional
100106
'';
101107
};
102108

0 commit comments

Comments
 (0)