Skip to content

Commit 3280a93

Browse files
committed
[TASK] Migrate CI to shared reusable workflows
1 parent 7b33231 commit 3280a93

File tree

1 file changed

+44
-119
lines changed

1 file changed

+44
-119
lines changed

.github/workflows/main.yaml

Lines changed: 44 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,56 @@
11
name: "Main"
22

3-
on: # yamllint disable-line rule:truthy
3+
on:
44
pull_request: null
55
push:
66
branches:
77
- "main"
88

9-
env:
10-
DEFAULT_PHP_VERSION: "8.2"
11-
RUN_ENVIRONMENT: "local"
9+
permissions: {}
1210

1311
jobs:
1412
tests:
15-
name : Tests
16-
runs-on: ubuntu-latest
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
php:
21-
- '8.2'
22-
- '8.3'
23-
- '8.4'
24-
- '8.5'
25-
steps:
26-
- name: Checkout
27-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
28-
29-
- name: "Install PHP"
30-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
31-
with:
32-
coverage: "none"
33-
php-version: "${{ matrix.php }}"
34-
extensions: 'inotify, pcntl'
35-
36-
- name: "Get Composer cache directory"
37-
id: composer-cache
38-
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
39-
40-
- name: "Cache Composer dependencies"
41-
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
42-
with:
43-
path: ${{ steps.composer-cache.outputs.dir }}
44-
key: php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
45-
restore-keys: php-${{ matrix.php }}-composer-
46-
47-
- name: "Install dependencies with Composer"
48-
run: composer install --no-interaction --no-progress --prefer-dist
49-
50-
- name: "Run unit tests"
51-
run: "make test-unit ENV=${{ env.RUN_ENVIRONMENT }}"
52-
53-
- name: "Run integration tests"
54-
run: "make test-integration ENV=${{ env.RUN_ENVIRONMENT }}"
13+
uses: TYPO3-Documentation/.github/.github/workflows/reusable-php-tests.yml@main
14+
with:
15+
php-versions: '["8.2", "8.3", "8.4", "8.5"]'
16+
test-unit-command: "make test-unit ENV=local"
17+
test-integration-command: "make test-integration ENV=local"
18+
php-extensions: "inotify, pcntl"
5519

5620
quality:
57-
name: Quality
58-
runs-on: ubuntu-latest
59-
steps:
60-
- name: Checkout
61-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
62-
63-
- name: "Install PHP"
64-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
65-
with:
66-
coverage: "none"
67-
php-version: "${{ env.DEFAULT_PHP_VERSION }}"
68-
extensions: 'inotify, pcntl'
69-
70-
- name: "Get Composer cache directory"
71-
id: composer-cache
72-
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
73-
74-
- name: "Cache Composer dependencies"
75-
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
76-
with:
77-
path: ${{ steps.composer-cache.outputs.dir }}
78-
key: php-${{ env.DEFAULT_PHP_VERSION }}-composer-${{ hashFiles('**/composer.lock') }}
79-
restore-keys: php-${{ env.DEFAULT_PHP_VERSION }}-composer-
80-
81-
- name: "Install dependencies with Composer"
82-
run: composer install --no-interaction --no-progress --prefer-dist
83-
84-
- name: "Check for normalized composer.json"
85-
run: "composer normalize --dry-run"
86-
87-
- name: "CGL"
88-
run: "make code-style ENV=${{ env.RUN_ENVIRONMENT }}"
89-
90-
- name: "PHPSTAN"
91-
run: "make phpstan ENV=${{ env.RUN_ENVIRONMENT }}"
92-
93-
- name: "Lint guides.xml configurations"
94-
run: "make test-xml ENV=${{ env.RUN_ENVIRONMENT }}"
95-
96-
- name: "'Documentation' renders without warning'"
97-
run: "make test-docs ENV=${{ env.RUN_ENVIRONMENT }}"
98-
99-
- name: "'Documentation-rendertest' renders without warning'"
100-
run: "make test-rendertest ENV=${{ env.RUN_ENVIRONMENT }}"
101-
102-
monorepo-validate:
103-
name: "Validate monorepo structure"
104-
runs-on: "ubuntu-latest"
105-
steps:
106-
- name: "Checkout"
107-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
108-
109-
- name: "Install PHP"
110-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
111-
with:
112-
coverage: "none"
113-
php-version: "${{ env.DEFAULT_PHP_VERSION }}"
114-
extensions: 'inotify, pcntl'
115-
116-
- name: "Get Composer cache directory"
117-
id: composer-cache
118-
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
119-
120-
- name: "Cache Composer dependencies"
121-
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
122-
with:
123-
path: ${{ steps.composer-cache.outputs.dir }}
124-
key: php-${{ env.DEFAULT_PHP_VERSION }}-composer-${{ hashFiles('**/composer.lock') }}
125-
restore-keys: php-${{ env.DEFAULT_PHP_VERSION }}-composer-
126-
127-
- name: "Install dependencies with Composer"
128-
run: composer install --no-interaction --no-progress --prefer-dist
129-
130-
- name: "Validate monorepo"
131-
run: "make test-monorepo ENV=${{ env.RUN_ENVIRONMENT }}"
21+
uses: TYPO3-Documentation/.github/.github/workflows/reusable-php-quality.yml@main
22+
with:
23+
php-version: "8.2"
24+
cs-fixer-command: "make code-style ENV=local"
25+
phpstan-command: "make phpstan ENV=local"
26+
run-xml-lint: true
27+
xml-lint-command: "make test-xml ENV=local"
28+
php-extensions: "inotify, pcntl"
29+
30+
composer-normalize:
31+
uses: TYPO3-Documentation/.github/.github/workflows/reusable-php-command.yml@main
32+
with:
33+
php-version: "8.2"
34+
command: "composer normalize --dry-run"
35+
php-extensions: "inotify, pcntl"
36+
37+
test-docs:
38+
uses: TYPO3-Documentation/.github/.github/workflows/reusable-php-command.yml@main
39+
with:
40+
php-version: "8.2"
41+
command: "make test-docs ENV=local"
42+
php-extensions: "inotify, pcntl"
43+
44+
test-rendertest:
45+
uses: TYPO3-Documentation/.github/.github/workflows/reusable-php-command.yml@main
46+
with:
47+
php-version: "8.2"
48+
command: "make test-rendertest ENV=local"
49+
php-extensions: "inotify, pcntl"
50+
51+
validate-monorepo:
52+
uses: TYPO3-Documentation/.github/.github/workflows/reusable-php-command.yml@main
53+
with:
54+
php-version: "8.2"
55+
command: "make test-monorepo ENV=local"
56+
php-extensions: "inotify, pcntl"

0 commit comments

Comments
 (0)