Skip to content

Commit

Permalink
[TASK] Improve CI inspired by TYPO3 EXT:tea
Browse files Browse the repository at this point in the history
  • Loading branch information
simonschaufi committed Jan 26, 2024
1 parent d7f5d0a commit af66a2f
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 248 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ insert_final_newline = true
indent_style = tab

[*.yaml.inc]
indent_size = 2

# YAML-Files
[{*.yml,*.yaml}]
indent_size = 2
22 changes: 10 additions & 12 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
version: 2

updates:
-
package-ecosystem: composer
directory: "/"
open-pull-requests-limit: 5
schedule:
interval: monthly
- package-ecosystem: composer
directory: "/"
open-pull-requests-limit: 5
schedule:
interval: monthly

-
package-ecosystem: github-actions
directory: "/"
open-pull-requests-limit: 5
schedule:
interval: monthly
- package-ecosystem: github-actions
directory: "/"
open-pull-requests-limit: 5
schedule:
interval: monthly
95 changes: 47 additions & 48 deletions .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,55 +1,54 @@
name: Code Analysis

on:
pull_request: null
push:
branches:
- "main"
pull_request: null
push:
branches:
- "main"

env:
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: "dev-main"
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: "dev-main"

jobs:
code_analysis:
strategy:
fail-fast: false
matrix:
php-versions: [ 7.4, 8.0, 8.1 ]
actions:
-
name: "PHP Linter"
run: vendor/bin/parallel-lint src config tests

-
name: 'Composer Validate'
run: composer validate --ansi

-
name: 'Tests'
run: vendor/bin/phpunit

-
name: 'Check TYPO3 Rector configs'
run: composer check-typo3-rector

-
name: 'PHPStan'
run: composer analyze

name: "${{ matrix.php-versions }} ${{ matrix.actions.name }}"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

# see https://github.com/shivammathur/setup-php
-
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none

- uses: "ramsey/composer-install@v2"

- run: ${{ matrix.actions.run }}
code_analysis:
strategy:
fail-fast: false
matrix:
php-versions: [ 7.4, 8.0, 8.1 ]
actions:
- name: "PHP Linter"
run: "composer ci:php:lint"

- name: 'Composer Validate'
run: composer validate --strict --ansi

- name: 'Tests'
run: vendor/bin/phpunit

- name: 'Check TYPO3 Rector configs'
run: "composer ci:check-typo3-rector"

- name: 'PHPStan'
run: "composer ci:php:stan"

name: "${{ matrix.php-versions }} ${{ matrix.actions.name }}"
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v4

# see https://github.com/shivammathur/setup-php
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none

# see https://github.com/ramsey/composer-install
- name: "Install Composer dependencies"
uses: ramsey/composer-install@v2

- name: "Run command"
run: ${{ matrix.actions.run }}
78 changes: 41 additions & 37 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
name: Docs

on:
push:
branches:
- "main"
push:
branches:
- "main"

env:
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: "dev-main"
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: "dev-main"

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# see https://github.com/ramsey/composer-install
- uses: "ramsey/composer-install@v2"

- name: Install rule doc generator
run: composer require symplify/rule-doc-generator:^11.1 --with-all-dependencies

- name: Generate documentation
run: composer docs

- name: Uninstall rule doc generator
run: composer remove symplify/rule-doc-generator

- uses: stefanzweifel/git-auto-commit-action@v5.0.0
with:
commit_message: '[DOCS] Generate documentation'
commit_options: '--no-verify --signoff'
branch: "main"
push_options: '--force'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docs:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# see https://github.com/ramsey/composer-install
- name: "Install Composer dependencies"
uses: ramsey/composer-install@v2

- name: "Install rule doc generator"
run: composer require symplify/rule-doc-generator:^11.1 --with-all-dependencies

- name: "Generate documentation"
run: "composer docs:generate"

- name: "Uninstall rule doc generator"
run: composer remove symplify/rule-doc-generator

- name: "Commit documentation"
uses: stefanzweifel/git-auto-commit-action@v5.0.0
with:
commit_message: '[DOCS] Generate documentation'
commit_options: '--no-verify --signoff'
branch: "main"
push_options: '--force'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/monthly_pull_requests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Monthly Pull Requests

on:
schedule:
# https://crontab.guru/every-month
- cron: "0 0 1 * *"

env:
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: "dev-main"

jobs:
weekly_pull_requests:
# Don't run on forks.
if: github.repository == 'sabbelasichon/typo3-rector'
strategy:
fail-fast: false
matrix:
actions:
- name: 'Apply Coding Standard'
run: "composer fix:style"
branch: 'automated-apply-coding-standards'

name: ${{ matrix.actions.name }}
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}

# see https://github.com/shivammathur/setup-php
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none

- name: "Install Composer dependencies"
uses: ramsey/composer-install@v2

- name: "Run command"
run: ${{ matrix.actions.run }}

# see https://github.com/peter-evans/create-pull-request
- name: "Create pull-request"
uses: peter-evans/create-pull-request@v5.0.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "[AUTOMATED] ${{ matrix.actions.name }}"
base: 'main'
branch: ${{ matrix.actions.branch }}
title: '[AUTOMATED] ${{ matrix.actions.name }}'
delete-branch: true

- name: "Enable Pull Request Automerge"
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ secrets.ACCESS_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash
Loading

0 comments on commit af66a2f

Please sign in to comment.