-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (68 loc) · 2.67 KB
/
Copy pathphp.yaml
File metadata and controls
76 lines (68 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Do not edit this file! Make a pull request on changing
# github/workflows/drupal-module/php.yaml in
# https://github.com/itk-dev/devops_itkdev-docker if need be.
### ### Drupal module PHP
###
### Checks that PHP code adheres to the [Drupal coding
### standards](https://www.drupal.org/docs/develop/standards).
###
### #### Assumptions
###
### 1. A docker compose service named `phpfpm` can be run and `composer` can be
### run inside the `phpfpm` service.
### 2. [drupal/coder](https://www.drupal.org/project/coder) is a dev requirement
### in `composer.json`:
###
### ``` shell
### docker compose run --rm phpfpm composer require --dev drupal/coder
### ```
###
### Clean up and check code by running
###
### ``` shell
### docker compose run --rm phpfpm vendor/bin/phpcbf
### docker compose run --rm phpfpm vendor/bin/phpcs
### ```
###
### > [!NOTE]
### > The template adds `.phpcs.xml.dist` as [a configuration file for
### > PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file)
### > and this makes it possible to override the actual configuration used in a
### > project by adding a more important configuration file, e.g. `.phpcs.xml`.
name: PHP
env:
COMPOSE_USER: runner
# https://getcomposer.org/doc/03-cli.md#composer-auth
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"} }'
on:
pull_request:
paths: &paths
- "**/*.php"
- "composer.json"
- "compose.yaml"
push:
branches:
- main
- develop
paths: *paths
jobs:
coding-standards:
name: PHP - Check Coding Standards
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Create docker network
run: |
docker network create frontend
- &composer_install
name: Composer install
run: |
# Create a temporary composer file to install https://github.com/mglaman/composer-drupal-lenient before the real install needs it.
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer init --no-interaction
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true
docker compose run --rm --env COMPOSER_AUTH --env COMPOSER=composer.lenient.json phpfpm composer require mglaman/composer-drupal-lenient:^1
docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm rm composer.lenient.*
# The real install.
docker compose run --rm --env COMPOSER_AUTH phpfpm composer install
- run: |
docker compose run --rm phpfpm vendor/bin/phpcs