Skip to content

Commit 5452603

Browse files
committed
Added workflows
1 parent fb577e8 commit 5452603

18 files changed

+355
-183
lines changed

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
COMPOSE_PROJECT_NAME=azure-ad-delta-sync-drupal
2+
COMPOSE_DOMAIN=azure-ad-delta-sync-drupal.local.itkdev.dk
3+
ITKDEV_TEMPLATE=drupal-module

.github/workflows/changelog.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/changelog.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Changelog
6+
###
7+
### Checks that changelog has been updated
8+
9+
name: Changelog
10+
11+
on:
12+
pull_request:
13+
14+
jobs:
15+
changelog:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 2
24+
25+
- name: Git fetch
26+
run: git fetch
27+
28+
- name: Check that changelog has been updated.
29+
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0

.github/workflows/composer.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/composer.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Composer
6+
###
7+
### Validates composer.json and checks that it's normalized.
8+
###
9+
### #### Assumptions
10+
###
11+
### 1. A docker compose service named `phpfpm` can be run and `composer` can be
12+
### run inside the `phpfpm` service.
13+
### 2. [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize)
14+
### is a dev requirement in `composer.json`:
15+
###
16+
### ``` shell
17+
### docker compose run --rm phpfpm composer require --dev ergebnis/composer-normalize
18+
### ```
19+
###
20+
### Normalize `composer.json` by running
21+
###
22+
### ``` shell
23+
### docker compose run --rm phpfpm composer normalize
24+
### ```
25+
26+
name: Composer
27+
28+
env:
29+
COMPOSE_USER: root
30+
31+
on:
32+
pull_request:
33+
push:
34+
branches:
35+
- main
36+
- develop
37+
38+
jobs:
39+
composer-validate:
40+
runs-on: ubuntu-latest
41+
strategy:
42+
fail-fast: false
43+
steps:
44+
- uses: actions/checkout@v4
45+
- run: |
46+
docker network create frontend
47+
docker compose run --rm phpfpm composer validate --strict
48+
49+
composer-normalized:
50+
runs-on: ubuntu-latest
51+
strategy:
52+
fail-fast: false
53+
steps:
54+
- uses: actions/checkout@v4
55+
- run: |
56+
docker network create frontend
57+
docker compose run --rm phpfpm composer install
58+
docker compose run --rm phpfpm composer normalize --dry-run
59+
60+
composer-audit:
61+
runs-on: ubuntu-latest
62+
strategy:
63+
fail-fast: false
64+
steps:
65+
- uses: actions/checkout@v4
66+
- run: |
67+
docker network create frontend
68+
docker compose run --rm phpfpm composer audit

.github/workflows/markdown.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/markdown.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Markdown
6+
###
7+
### Lints Markdown files (`**/*.md`) in the project.
8+
###
9+
### [markdownlint-cli configuration
10+
### files](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration),
11+
### `.markdownlint.jsonc` and `.markdownlintignore`, control what is actually
12+
### linted and how.
13+
###
14+
### #### Assumptions
15+
###
16+
### 1. A docker compose service named `markdownlint` for running `markdownlint`
17+
### (from
18+
### [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli))
19+
### exists.
20+
21+
name: Markdown
22+
23+
on:
24+
pull_request:
25+
push:
26+
branches:
27+
- main
28+
- develop
29+
30+
jobs:
31+
markdown-lint:
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- run: |
40+
docker network create frontend
41+
42+
- run: |
43+
docker compose run --rm markdownlint markdownlint '**/*.md'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: PHP code analysis
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- develop
9+
10+
jobs:
11+
php-code-analysis:
12+
name: PHP code analysis
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
drupal-version:
17+
- 10
18+
# Installing with sqlite does not yet work with Drupal 11 (cf. https://github.com/docker-library/drupal/issues/264)
19+
# - 11
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Code analysis
23+
run: |
24+
DRUPAL_VERSION=${{ matrix.drupal-version }} ./scripts/code-analysis

.github/workflows/php.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/drupal-module/php.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Drupal module PHP
6+
###
7+
### Checks that PHP code adheres to the [Drupal coding
8+
### standards](https://www.drupal.org/docs/develop/standards).
9+
###
10+
### #### Assumptions
11+
###
12+
### 1. A docker compose service named `phpfpm` can be run and `composer` can be
13+
### run inside the `phpfpm` service.
14+
### 2. [drupal/coder](https://www.drupal.org/project/coder) is a dev requirement
15+
### in `composer.json`:
16+
###
17+
### ``` shell
18+
### docker compose run --rm phpfpm composer require --dev drupal/coder
19+
### ```
20+
###
21+
### Clean up and check code by running
22+
###
23+
### ``` shell
24+
### docker compose run --rm phpfpm vendor/bin/phpcbf
25+
### docker compose run --rm phpfpm vendor/bin/phpcs
26+
### ```
27+
###
28+
### > [!NOTE]
29+
### > The template adds `.phpcs.xml.dist` as [a configuration file for
30+
### > PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file)
31+
### > and this makes it possible to override the actual configuration used in a
32+
### > project by adding a more important configuration file, e.g. `.phpcs.xml`.
33+
34+
name: PHP
35+
36+
env:
37+
COMPOSE_USER: root
38+
39+
on:
40+
pull_request:
41+
push:
42+
branches:
43+
- main
44+
- develop
45+
46+
jobs:
47+
coding-standards:
48+
name: PHP - Check Coding Standards
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
- run: |
53+
docker network create frontend
54+
55+
- run: |
56+
docker compose run --rm phpfpm composer install
57+
docker compose run --rm phpfpm vendor/bin/phpcs

.github/workflows/pr.yaml

Lines changed: 1 addition & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,6 @@
11
on: pull_request
22
name: PR Review
33
jobs:
4-
changelog:
5-
runs-on: ubuntu-latest
6-
name: Changelog should be updated
7-
strategy:
8-
fail-fast: false
9-
steps:
10-
- name: Checkout
11-
uses: actions/checkout@v4
12-
with:
13-
fetch-depth: 2
14-
15-
- name: Git fetch
16-
run: git fetch
17-
18-
- name: Check that changelog has been updated.
19-
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0
20-
21-
test-composer-files:
22-
name: Validate composer
23-
runs-on: ubuntu-latest
24-
strategy:
25-
matrix:
26-
php-versions: [ '8.3' ]
27-
dependency-version: [ prefer-lowest, prefer-stable ]
28-
steps:
29-
- uses: actions/checkout@v4
30-
- name: Setup PHP, with composer and extensions
31-
uses: shivammathur/setup-php@v2
32-
with:
33-
php-version: ${{ matrix.php-versions }}
34-
extensions: json
35-
coverage: none
36-
tools: composer:v2
37-
# https://github.com/shivammathur/setup-php#cache-composer-dependencies
38-
- name: Get composer cache directory
39-
id: composer-cache
40-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
41-
- name: Cache dependencies
42-
uses: actions/cache@v4
43-
with:
44-
path: ${{ steps.composer-cache.outputs.dir }}
45-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
46-
restore-keys: ${{ runner.os }}-composer-
47-
- name: Validate composer files
48-
run: |
49-
composer validate --strict composer.json
50-
# Check that dependencies resolve.
51-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
52-
53-
php-check-coding-standards:
54-
name: PHP - Check Coding Standards
55-
runs-on: ubuntu-latest
56-
strategy:
57-
matrix:
58-
php-versions: [ '8.3' ]
59-
dependency-version: [ prefer-lowest, prefer-stable ]
60-
steps:
61-
- uses: actions/checkout@v4
62-
- name: Setup PHP, with composer and extensions
63-
uses: shivammathur/setup-php@v2
64-
with:
65-
php-version: ${{ matrix.php-versions }}
66-
extensions: json
67-
coverage: none
68-
tools: composer:v2
69-
# https://github.com/shivammathur/setup-php#cache-composer-dependencies
70-
- name: Get composer cache directory
71-
id: composer-cache
72-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
73-
- name: Cache dependencies
74-
uses: actions/cache@v4
75-
with:
76-
path: ${{ steps.composer-cache.outputs.dir }}
77-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
78-
restore-keys: ${{ runner.os }}-composer-
79-
- name: Install Dependencies
80-
run: |
81-
composer install --no-interaction --no-progress
82-
- name: PHPCS
83-
run: |
84-
composer coding-standards-check/phpcs
85-
86-
php-code-analysis:
87-
name: PHP code analysis
88-
runs-on: ubuntu-latest
89-
strategy:
90-
matrix:
91-
php-versions: [ '8.3' ]
92-
steps:
93-
- uses: actions/checkout@master
94-
- name: Setup PHP, with composer and extensions
95-
uses: shivammathur/setup-php@v2
96-
with:
97-
php-version: ${{ matrix.php-versions }}
98-
extensions: json
99-
coverage: none
100-
tools: composer:v2
101-
# https://github.com/shivammathur/setup-php#cache-composer-dependencies
102-
- name: Get composer cache directory
103-
id: composer-cache
104-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
105-
- name: Cache dependencies
106-
uses: actions/cache@v4
107-
with:
108-
path: ${{ steps.composer-cache.outputs.dir }}
109-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
110-
restore-keys: ${{ runner.os }}-composer-
111-
- name: Install Dependencies
112-
run: |
113-
composer install --no-interaction --no-progress
114-
- name: Code analysis
115-
run: |
116-
./scripts/code-analysis
117-
1184
unit_tests:
1195
name: PHP - Unit test
1206
runs-on: ubuntu-latest
@@ -154,15 +40,6 @@ jobs:
15440
docker exec drupal_test /app/vendor/bin/drush --yes pm:enable azure_ad_delta_sync
15541
# Run our module tests
15642
docker exec drupal_test sh -c 'cd /app/web; ../vendor/bin/phpunit modules/contrib/azure-ad-delta-sync-drupal/tests/src/Functional'
157-
markdown-lint:
158-
name: Markdown lint
159-
runs-on: ubuntu-latest
160-
steps:
161-
- name: Checkout
162-
uses: actions/checkout@v4
163-
164-
- name: Markdown lint
165-
run: docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint --ignore vendor '**/*.md'
16643
16744
check-proxy-classes:
16845
runs-on: ubuntu-latest
@@ -181,7 +58,7 @@ jobs:
18158
./scripts/rector
18259
- name: Check nothing has changed
18360
run: git diff --exit-code
184-
61+
18562
test-command-runs:
18663
runs-on: ubuntu-latest
18764
steps:

0 commit comments

Comments
 (0)