Skip to content

Commit e9abd4d

Browse files
authored
Merge pull request #38 from tattersoftware/devkit
Switch to DevKit
2 parents fe4abf0 + 31d4fbe commit e9abd4d

35 files changed

+541
-319
lines changed

.github/workflows/compare.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/deduplicate.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,52 @@
1-
# When a PR is opened or a push is made, perform an
2-
# architectural inspection on the code using Deptrac.
31
name: Deptrac
42

53
on:
64
pull_request:
75
branches:
8-
- 'develop'
6+
- develop
97
paths:
10-
- 'src/**'
11-
- 'tests/**'
8+
- '**.php'
129
- 'composer.**'
1310
- 'depfile.yaml'
14-
- '.github/workflows/inspect.yml'
11+
- '.github/workflows/deptrac.yml'
1512
push:
1613
branches:
17-
- 'develop'
14+
- develop
1815
paths:
19-
- 'src/**'
20-
- 'tests/**'
16+
- '**.php'
2117
- 'composer.**'
2218
- 'depfile.yaml'
23-
- '.github/workflows/inspect.yml'
19+
- '.github/workflows/deptrac.yml'
2420

2521
jobs:
2622
build:
27-
name: Architectural Inspection
23+
name: Dependency Tracing
2824
runs-on: ubuntu-latest
25+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26+
2927
steps:
3028
- name: Checkout
3129
uses: actions/checkout@v2
3230

33-
- name: Setup PHP
31+
- name: Set up PHP
3432
uses: shivammathur/setup-php@v2
3533
with:
3634
php-version: '8.0'
37-
tools: composer, pecl, phive
35+
tools: phive
3836
extensions: intl, json, mbstring, xml
37+
coverage: none
3938
env:
4039
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4140

4241
- name: Get composer cache directory
4342
id: composer-cache
4443
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
4544

46-
- name: Create composer cache directory
47-
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
48-
4945
- name: Cache composer dependencies
5046
uses: actions/cache@v2
5147
with:
5248
path: ${{ steps.composer-cache.outputs.dir }}
53-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
49+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
5450
restore-keys: ${{ runner.os }}-composer-
5551

5652
- name: Create Deptrac cache directory
@@ -63,17 +59,16 @@ jobs:
6359
key: ${{ runner.os }}-deptrac-${{ github.sha }}
6460
restore-keys: ${{ runner.os }}-deptrac-
6561

66-
- name: Install dependencies (limited)
67-
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
68-
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
69-
70-
- name: Install dependencies (authenticated)
71-
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
72-
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
73-
env:
74-
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
62+
- name: Install dependencies
63+
run: |
64+
composer -q config -g github-oauth.github.com "${{ secrets.GITHUB_TOKEN }}"
65+
if [ -f composer.lock ]; then
66+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
67+
else
68+
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
69+
fi
7570
76-
- name: Run architectural inspection
71+
- name: Trace dependencies
7772
run: |
7873
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
7974
deptrac analyze --cache-file=build/deptrac.cache

.github/workflows/infection.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Infection
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- 'composer.**'
10+
- 'phpunit*'
11+
- '.github/workflows/infection.yml'
12+
push:
13+
branches:
14+
- develop
15+
paths:
16+
- '**.php'
17+
- 'composer.**'
18+
- 'phpunit*'
19+
- '.github/workflows/infection.yml'
20+
21+
jobs:
22+
main:
23+
name: Mutation Testing
24+
runs-on: ubuntu-latest
25+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
31+
- name: Set up PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: '8.0'
35+
tools: infection, phpunit
36+
extensions: intl, json, mbstring, gd, xml, sqlite3
37+
coverage: xdebug
38+
env:
39+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Set up problem matchers for PHPUnit
42+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
43+
44+
- name: Configure matchers
45+
uses: mheap/phpunit-matcher-action@v1
46+
47+
- name: Get composer cache directory
48+
id: composer-cache
49+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
50+
51+
- name: Cache composer dependencies
52+
uses: actions/cache@v2
53+
with:
54+
path: ${{ steps.composer-cache.outputs.dir }}
55+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
56+
restore-keys: ${{ runner.os }}-composer-
57+
58+
- name: Install dependencies
59+
run: |
60+
composer -q config -g github-oauth.github.com "${{ secrets.GITHUB_TOKEN }}"
61+
if [ -f composer.lock ]; then
62+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
63+
else
64+
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
65+
fi
66+
67+
- name: Test with PHPUnit
68+
run: vendor/bin/phpunit --teamcity
69+
70+
- name: Mutate with Infection
71+
run: |
72+
git fetch --depth=1 origin $GITHUB_BASE_REF
73+
infection --threads=2 --skip-initial-tests --coverage=build/phpunit --git-diff-base=origin/$GITHUB_BASE_REF --git-diff-filter=AM --logger-github --ignore-msi-with-no-mutations

.github/workflows/phpcpd.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PHPCPD
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- '.github/workflows/phpcpd.yml'
10+
push:
11+
branches:
12+
- develop
13+
paths:
14+
- '**.php'
15+
- '.github/workflows/phpcpd.yml'
16+
17+
jobs:
18+
build:
19+
name: Code Copy-Paste Detection
20+
runs-on: ubuntu-latest
21+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: '8.0'
31+
tools: phpcpd
32+
extensions: dom, mbstring
33+
coverage: none
34+
35+
- name: Detect duplicate code
36+
run: phpcpd src/ tests/

.github/workflows/phpcsfixer.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: PHPCSFixer
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- '.github/workflows/phpcsfixer.yml'
10+
push:
11+
branches:
12+
- develop
13+
paths:
14+
- '**.php'
15+
- '.github/workflows/phpcsfixer.yml'
16+
17+
jobs:
18+
build:
19+
name: PHP ${{ matrix.php-versions }} Coding Standards
20+
runs-on: ubuntu-latest
21+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
php-versions: ['7.4', '8.0', '8.1']
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
31+
- name: Set up PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: ${{ matrix.php-versions }}
35+
extensions: json, tokenizer
36+
coverage: none
37+
env:
38+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Get composer cache directory
41+
id: composer-cache
42+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
43+
44+
- name: Cache composer dependencies
45+
uses: actions/cache@v2
46+
with:
47+
path: ${{ steps.composer-cache.outputs.dir }}
48+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
49+
restore-keys: ${{ runner.os }}-composer-
50+
51+
- name: Install dependencies
52+
run: |
53+
composer -q config -g github-oauth.github.com "${{ secrets.GITHUB_TOKEN }}"
54+
if [ -f composer.lock ]; then
55+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
56+
else
57+
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
58+
fi
59+
60+
- name: Check code for standards compliance
61+
run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff

0 commit comments

Comments
 (0)