Skip to content

Commit ab6dc06

Browse files
committed
chore: reuse github workflows
1 parent 3a2d269 commit ab6dc06

File tree

9 files changed

+22
-518
lines changed

9 files changed

+22
-518
lines changed

.github/workflows/deptrac.yml

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,8 @@ name: Deptrac
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
paths:
8-
- '**.php'
9-
- 'composer.*'
10-
- 'depfile.yaml'
11-
- '.github/workflows/deptrac.yml'
125
push:
13-
branches:
14-
- develop
15-
paths:
16-
- '**.php'
17-
- 'composer.*'
18-
- 'depfile.yaml'
19-
- '.github/workflows/deptrac.yml'
206

217
jobs:
22-
build:
23-
name: Dependency Tracing
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@v3
30-
31-
- name: Set up PHP
32-
uses: shivammathur/setup-php@v2
33-
with:
34-
php-version: '8.1'
35-
tools: phive
36-
extensions: intl, json, mbstring, xml
37-
coverage: none
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
41-
- name: Get composer cache directory
42-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
43-
44-
- name: Cache composer dependencies
45-
uses: actions/cache@v3
46-
with:
47-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
48-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
49-
restore-keys: ${{ runner.os }}-composer-
50-
51-
- name: Create Deptrac cache directory
52-
run: mkdir -p build/
53-
54-
- name: Cache Deptrac results
55-
uses: actions/cache@v3
56-
with:
57-
path: build
58-
key: ${{ runner.os }}-deptrac-${{ github.sha }}
59-
restore-keys: ${{ runner.os }}-deptrac-
60-
61-
- name: Install dependencies
62-
run: |
63-
if [ -f composer.lock ]; then
64-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
65-
else
66-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
67-
fi
68-
69-
- name: Trace dependencies
70-
run: |
71-
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
72-
deptrac analyze --cache-file=build/deptrac.cache
8+
deptrac:
9+
uses: codeigniter4/.github/.github/workflows/deptrac.yml@main

.github/workflows/infection.yml

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,8 @@ name: Infection
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
paths:
8-
- '**.php'
9-
- 'composer.*'
10-
- 'phpunit*'
11-
- '.github/workflows/infection.yml'
5+
push:
126

137
jobs:
14-
main:
15-
name: Mutation Testing
16-
runs-on: ubuntu-latest
17-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
18-
19-
steps:
20-
- name: Checkout
21-
uses: actions/checkout@v3
22-
23-
- name: Set up PHP
24-
uses: shivammathur/setup-php@v2
25-
with:
26-
php-version: '8.1'
27-
tools: infection, phpunit
28-
extensions: intl, json, mbstring, gd, xml, sqlite3
29-
coverage: xdebug
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32-
33-
- name: Set up problem matchers for PHPUnit
34-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
35-
36-
- name: Configure matchers
37-
uses: mheap/phpunit-matcher-action@v1
38-
39-
- name: Get composer cache directory
40-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
41-
42-
- name: Cache composer dependencies
43-
uses: actions/cache@v3
44-
with:
45-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
46-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
47-
restore-keys: ${{ runner.os }}-composer-
48-
49-
- name: Install dependencies
50-
run: |
51-
if [ -f composer.lock ]; then
52-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
53-
else
54-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
55-
fi
56-
57-
- name: Run Infection for added files only
58-
run: |
59-
git fetch --depth=1 origin $GITHUB_BASE_REF
60-
infection --threads=max --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF --ignore-msi-with-no-mutations --only-covered --logger-github
8+
infection:
9+
uses: codeigniter4/.github/.github/workflows/infection.yml@main

.github/workflows/phpcpd.yml

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,10 @@ name: PHPCPD
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
paths:
8-
- '**.php'
9-
- '.github/workflows/phpcpd.yml'
105
push:
11-
branches:
12-
- develop
13-
paths:
14-
- '**.php'
15-
- '.github/workflows/phpcpd.yml'
166

177
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@v3
26-
27-
- name: Setup PHP
28-
uses: shivammathur/setup-php@v2
29-
with:
30-
php-version: '8.1'
31-
tools: phpcpd
32-
extensions: dom, mbstring
33-
coverage: none
34-
35-
- name: Detect duplicate code
36-
run: phpcpd src/ tests/
8+
phpcpd:
9+
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@main
10+
with:
11+
dirs: "src/ tests/"

.github/workflows/phpcsfixer.yml

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,8 @@ name: PHPCSFixer
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
paths:
8-
- '**.php'
9-
- '.github/workflows/phpcsfixer.yml'
105
push:
11-
branches:
12-
- develop
13-
paths:
14-
- '**.php'
15-
- '.github/workflows/phpcsfixer.yml'
166

177
jobs:
18-
build:
19-
name: Coding Standards
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@v3
26-
27-
- name: Set up PHP
28-
uses: shivammathur/setup-php@v2
29-
with:
30-
php-version: '8.1'
31-
extensions: json, tokenizer
32-
coverage: none
33-
env:
34-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
36-
- name: Get composer cache directory
37-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
38-
39-
- name: Cache composer dependencies
40-
uses: actions/cache@v3
41-
with:
42-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
43-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
44-
restore-keys: ${{ runner.os }}-composer-
45-
46-
- name: Install dependencies
47-
run: |
48-
if [ -f composer.lock ]; then
49-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
50-
else
51-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
52-
fi
53-
54-
- name: Check code for standards compliance
55-
run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff
8+
phpcsfixer:
9+
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@main

.github/workflows/phpstan.yml

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,73 +2,8 @@ name: PHPStan
22

33
on:
44
pull_request:
5-
branches:
6-
- develop
7-
paths:
8-
- '**.php'
9-
- 'composer.*'
10-
- 'phpstan*'
11-
- '.github/workflows/phpstan.yml'
125
push:
13-
branches:
14-
- develop
15-
paths:
16-
- '**.php'
17-
- 'composer.*'
18-
- 'phpstan*'
19-
- '.github/workflows/phpstan.yml'
206

217
jobs:
22-
build:
23-
name: PHP ${{ matrix.php-versions }} Static Analysis
24-
runs-on: ubuntu-latest
25-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26-
strategy:
27-
fail-fast: false
28-
matrix:
29-
php-versions: ['7.4', '8.0', '8.1', '8.2']
30-
31-
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v3
34-
35-
- name: Setup PHP
36-
uses: shivammathur/setup-php@v2
37-
with:
38-
php-version: ${{ matrix.php-versions }}
39-
tools: phpstan, phpunit
40-
extensions: intl, json, mbstring, xml
41-
coverage: none
42-
env:
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
45-
- name: Get composer cache directory
46-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
47-
48-
- name: Cache composer dependencies
49-
uses: actions/cache@v3
50-
with:
51-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
52-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
53-
restore-keys: ${{ runner.os }}-composer-
54-
55-
- name: Create PHPStan cache directory
56-
run: mkdir -p build/phpstan
57-
58-
- name: Cache PHPStan results
59-
uses: actions/cache@v3
60-
with:
61-
path: build/phpstan
62-
key: ${{ runner.os }}-phpstan-${{ github.sha }}
63-
restore-keys: ${{ runner.os }}-phpstan-
64-
65-
- name: Install dependencies
66-
run: |
67-
if [ -f composer.lock ]; then
68-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
69-
else
70-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
71-
fi
72-
73-
- name: Run static analysis
74-
run: vendor/bin/phpstan analyze
8+
phpstan:
9+
uses: codeigniter4/.github/.github/workflows/phpstan.yml@main

0 commit comments

Comments
 (0)