Skip to content

Commit 96bff57

Browse files
author
Sine Jespersen
committed
Merge branch 'develop'
2 parents 5c3f653 + fab9077 commit 96bff57

15 files changed

+132
-442
lines changed

.github/workflows/pr.yaml

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,53 @@
11
on: pull_request
22
name: PR Review
33
jobs:
4-
test-composer-files:
5-
name: Validate composer
4+
test-composer-install:
5+
name: Validate composer (${{ matrix.php }}) / (${{ matrix.dependency-version }})
66
runs-on: ubuntu-latest
77
strategy:
8+
fail-fast: false
89
matrix:
9-
php-versions: [ '7.4', '8.0' ]
10+
php: [ '8.3', '8.4' ]
1011
dependency-version: [ prefer-lowest, prefer-stable ]
1112
steps:
12-
- uses: actions/checkout@master
13+
- uses: actions/checkout@v4
1314
- name: Setup PHP, with composer and extensions
1415
uses: shivammathur/setup-php@v2
1516
with:
16-
php-version: ${{ matrix.php-versions }}
17-
extensions: json
17+
php-version: ${{ matrix.php }}
1818
coverage: none
19-
tools: composer:v2
20-
# https://github.com/shivammathur/setup-php#cache-composer-dependencies
2119
- name: Get composer cache directory
2220
id: composer-cache
23-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
21+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
22+
2423
- name: Cache dependencies
25-
uses: actions/cache@v2
24+
uses: actions/cache@v4
2625
with:
2726
path: ${{ steps.composer-cache.outputs.dir }}
2827
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
2928
restore-keys: ${{ runner.os }}-composer-
29+
3030
- name: Validate composer files
31-
run: |
32-
composer validate composer.json --strict
33-
- name: Ensure dependencies resolve
31+
run: composer validate composer.json --strict
32+
33+
- name: Install dependencies
3434
run: |
3535
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
3636
3737
php-check-coding-standards:
3838
name: PHP - Check Coding Standards
3939
runs-on: ubuntu-latest
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
php: [ '8.3', '8.4' ]
44+
dependency-version: [ prefer-lowest, prefer-stable ]
4045
steps:
41-
- uses: actions/checkout@master
46+
- uses: actions/checkout@v4
4247
- name: Setup PHP, with composer and extensions
4348
uses: shivammathur/setup-php@v2
4449
with:
45-
php-version: 7.4
50+
php-version: ${{ matrix.php }}
4651
extensions: json
4752
coverage: none
4853
tools: composer:v2
@@ -51,7 +56,7 @@ jobs:
5156
id: composer-cache
5257
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
5358
- name: Cache dependencies
54-
uses: actions/cache@v2
59+
uses: actions/cache@v4
5560
with:
5661
path: ${{ steps.composer-cache.outputs.dir }}
5762
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -61,16 +66,22 @@ jobs:
6166
composer install --no-interaction --no-progress
6267
- name: PHPCS
6368
run: |
64-
composer check-coding-standards
69+
composer coding-standards-check
70+
6571
unit_tests:
6672
name: Unit tests
6773
runs-on: ubuntu-latest
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
php: [ '8.3', '8.4' ]
78+
dependency-version: [ prefer-lowest, prefer-stable ]
6879
steps:
69-
- uses: actions/checkout@master
80+
- uses: actions/checkout@v4
7081
- name: Setup PHP, with composer and extensions
7182
uses: shivammathur/setup-php@v2
7283
with:
73-
php-version: 7.4
84+
php-version: ${{ matrix.php }}
7485
extensions: json
7586
coverage: none
7687
tools: composer:v2
@@ -79,7 +90,7 @@ jobs:
7990
id: composer-cache
8091
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
8192
- name: Cache dependencies
82-
uses: actions/cache@v2
93+
uses: actions/cache@v4
8394
with:
8495
path: ${{ steps.composer-cache.outputs.dir }}
8596
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -90,27 +101,12 @@ jobs:
90101
- name: Unit tests
91102
run: php vendor/bin/phpunit tests --coverage-clover=coverage/unit.xml
92103

93-
markdownlint:
94-
name: markdownlint
104+
markdown-lint:
105+
name: Markdown lint
95106
runs-on: ubuntu-latest
96107
steps:
97108
- name: Checkout
98-
uses: actions/checkout@v2
99-
- name: Get yarn cache directory path
100-
id: yarn-cache-dir-path
101-
run: echo "::set-output name=dir::$(yarn cache dir)"
102-
- name: Cache yarn packages
103-
uses: actions/cache@v2
104-
id: yarn-cache
105-
with:
106-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
107-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
108-
restore-keys: |
109-
${{ runner.os }}-yarn-
110-
- name: Yarn install
111-
uses: actions/setup-node@v2
112-
with:
113-
node-version: '12'
114-
- run: yarn install
115-
- name: markdownlint
116-
run: yarn markdownlint README.md
109+
uses: actions/checkout@v4
110+
111+
- name: Markdown lint
112+
run: docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint --ignore vendor '**/*.md'

.markdownlint.jsonc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default": true,
3+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
4+
"line-length": {
5+
"line_length": 120,
6+
"code_blocks": false,
7+
"tables": false
8+
},
9+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
10+
"no-duplicate-heading": {
11+
"siblings_only": true
12+
}
13+
}

.markdownlintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files
2+
vendor/
3+
LICENSE.md
4+
5+
# Local Variables:
6+
# mode: gitignore
7+
# End:

.php-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10-
## Added
10+
## [1.1.0] - 2025-01-17
1111

12-
- Controller
13-
- StartEvent, CommitEvent and UserDataEvent
14-
- README
15-
- LICENSE
16-
- PHP_CodeSniffer
17-
- markdownlint
18-
- This CHANGELOG file to hopefully serve as an evolving example of
19-
a standardized open source project CHANGELOG.
20-
- PHPUnit
21-
- ControllerTest
12+
[Unreleased]: https://github.com/itk-dev/azure-ad-delta-sync/compare/1.1.0...HEAD
13+
[1.1.0]: https://github.com/itk-dev/azure-ad-delta-sync/releases/tag/1.1.0

README.md

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
Composer package for the Azure AD Delta Sync flow.
44

5-
## References
6-
7-
* [Microsoft Graph group members](https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http)
8-
95
## Usage
106

117
If you are looking to use this in a Symfony or Drupal project you should use
128
either:
139

14-
* Symfony: [itk-dev/adgangsstyring-bundle](https://github.com/itk-dev/adgangsstyring-bundle)
15-
* Drupal: [itk-dev/adgangsstyring_drupal](https://github.com/itk-dev/adgangsstyring_drupal)
10+
- Symfony: [itk-dev/azure-ad-delta-sync-symfony](https://github.com/itk-dev/azure-ad-delta-sync-symfony)
11+
- Drupal: [itk-dev/azure-ad-delta-sync-drupal](https://github.com/itk-dev/azure-ad-delta-sync-drupal)
1612

1713
### Direct installation
1814

@@ -28,7 +24,7 @@ To start the flow one needs to call the
2824
`Controller` `run(HandlerInterface $handler)` command.
2925

3026
Therefore, you must create your own handler that implements
31-
`HandlerInterface`.
27+
`HandlerInterface`.
3228

3329
#### Example Usage
3430

@@ -56,9 +52,6 @@ class SomeHandler implements HandlerInterface
5652
}
5753
```
5854

59-
Be aware that `removeUsersFromDeletionList()` may be called multiple times,
60-
as we are limited to 100 users per request.
61-
6255
To start the flow provide a HTTP Client that implements
6356
[PSR-18](https://www.php-fig.org/psr/psr-18/) `CLientInterface`,
6457
and the required options seen in the example beneath.
@@ -73,10 +66,9 @@ use ItkDev\AzureAdDeltaSync\Controller;
7366

7467

7568
$options = [
76-
'tenant_id' => 'something.onmicrosoft.com', // Tenant id
77-
'client_id' => 'some_client_id', // Client id assigned by authorizer
78-
'client_secret' => 'some_client_secret', // Client password assigned by authorizer
79-
'group_id' => 'some_group_id', // Group id provided by authorizer
69+
'uri' => 'https://aarhus.../RetrieveProvisioningData/...', // System provisioning uri
70+
'security_key' => 'some_security_key', // Provisioning data security key
71+
'client_secret' => 'some_client_secret', // System provisioning client secret
8072
];
8173

8274
$handler = new SomeHandler();
@@ -91,18 +83,19 @@ $controller->run($handler);
9183

9284
Note that this package does not do the synchronization
9385
of users, instead it provides a list of all users that
94-
currently are assigned to the group in question.
86+
currently has access to the system in question.
9587

96-
Should the specified group contain no users an exception will be
88+
Should the configured system contain no users an exception will be
9789
thrown. This is to avoid using systems to be under the impression
9890
that every single user should be deleted.
9991

10092
## Development Setup
10193

102-
A `docker-compose.yml` file with a PHP 7.4 image is included in this project.
94+
A `docker-compose.yml` file with a PHP 8.2 image is included in this project.
10395
To install the dependencies you can run
10496

10597
```shell
98+
docker compose pull
10699
docker compose up -d
107100
docker compose exec phpfpm composer install
108101
```
@@ -119,20 +112,30 @@ docker compose exec phpfpm ./vendor/bin/phpunit tests
119112
The test suite uses [Mocks](https://phpunit.de/manual/6.5/en/test-doubles.html)
120113
for generation of test doubles.
121114

122-
### Check Coding Standard
115+
### Coding Standard
123116

124-
* PHP files (PHP_CodeSniffer)
117+
#### PHP files (PHP_CodeSniffer)
125118

126-
```shell
127-
docker compose exec phpfpm composer check-coding-standards
128-
```
119+
Check PHP coding standards
120+
121+
```shell
122+
docker compose run --rm phpfpm composer install
123+
docker compose run --rm phpfpm composer coding-standards-check
124+
```
125+
126+
Apply coding standard changes
127+
128+
```shell
129+
docker compose run --rm phpfpm composer coding-standards-apply
130+
```
129131

130-
* Markdown files (markdownlint standard rules)
132+
#### Markdown files
131133

132-
```shell
133-
docker run -v ${PWD}:/app itkdev/yarn:latest install
134-
docker run -v ${PWD}:/app itkdev/yarn:latest check-coding-standards
135-
```
134+
```shell
135+
docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint '**/*.md'
136+
```shell
137+
docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint '**/*.md' --fix
138+
```
136139

137140
### GitHub Actions
138141

@@ -152,21 +155,6 @@ individual workflow jobs that can be run, e.g.
152155
act -P ubuntu-latest=shivammathur/node:focal pull_request --job phpcsfixer
153156
```
154157

155-
### Apply Coding Standards
156-
157-
* PHP files (PHP_CodeSniffer)
158-
159-
```shell
160-
docker compose exec phpfpm composer apply-coding-standards
161-
```
162-
163-
* Markdown files (markdownlint standard rules)
164-
165-
```shell
166-
docker run -v ${PWD}:/app itkdev/yarn:latest install
167-
docker run -v ${PWD}:/app itkdev/yarn:latest apply-coding-standards
168-
```
169-
170158
## Versioning
171159

172160
We use [SemVer](http://semver.org/) for versioning.

composer.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
}
2525
},
2626
"require": {
27-
"php": "^7.4 || ^8.0",
27+
"php": "^8.1",
2828
"ext-json": "*",
29-
"symfony/options-resolver": "^4.4 || ^5.0",
29+
"symfony/options-resolver": "^5.4 || ^6.0",
3030
"psr/http-client": "^1.0",
3131
"nyholm/psr7": "^1.4"
3232
},
@@ -36,10 +36,10 @@
3636
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1"
3737
},
3838
"scripts": {
39-
"check-coding-standards": [
39+
"coding-standards-check": [
4040
"vendor/bin/phpcs --standard=phpcs.xml.dist"
4141
],
42-
"apply-coding-standards": [
42+
"coding-standards-apply": [
4343
"vendor/bin/phpcbf --standard=phpcs.xml.dist"
4444
],
4545
"install-codestandards": [
@@ -48,5 +48,10 @@
4848
"post-install-cmd": [
4949
"@install-codestandards"
5050
]
51+
},
52+
"config": {
53+
"allow-plugins": {
54+
"dealerdirect/phpcodesniffer-composer-installer": true
55+
}
5156
}
5257
}

docker-compose.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
# itk-version: 1.0.0
2-
31
version: "3"
42

53
services:
64
phpfpm:
7-
image: itkdev/php7.4-fpm:latest
5+
image: itkdev/php8.2-fpm:latest
86
environment:
97
- XDEBUG_MODE=${XDEBUG_MODE:-off}
108
- XDEBUG_SESSION=${XDEBUG_SESSION:-0}
119
- COMPOSER_VERSION=2
1210
- DOCKER_HOST_DOMAIN=${COMPOSE_DOMAIN}
1311
- PHP_IDE_CONFIG=serverName=localhost
1412
volumes:
15-
- .:/app:delegated
13+
- .:/app:delegated

0 commit comments

Comments
 (0)