Skip to content

Commit cd63df8

Browse files
committed
chore: reuse github workflows
1 parent ed010b2 commit cd63df8

File tree

8 files changed

+18
-376
lines changed

8 files changed

+18
-376
lines changed

.github/workflows/deptrac.yml

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,5 @@ on:
1919
- '.github/workflows/deptrac.yml'
2020

2121
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@v4
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-
COMPOSER_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
22+
deptrac:
23+
uses: codeigniter4/.github/.github/workflows/deptrac.yml@main

.github/workflows/infection.yml

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -19,55 +19,5 @@ on:
1919
- '.github/workflows/infection.yml'
2020

2121
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@v4
30-
31-
- name: Set up PHP
32-
uses: shivammathur/setup-php@v2
33-
with:
34-
php-version: '8.1'
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-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
49-
50-
- name: Cache composer dependencies
51-
uses: actions/cache@v3
52-
with:
53-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
54-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
55-
restore-keys: ${{ runner.os }}-composer-
56-
57-
- name: Install dependencies
58-
run: |
59-
if [ -f composer.lock ]; then
60-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
61-
else
62-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
63-
fi
64-
65-
- name: Test with PHPUnit
66-
run: vendor/bin/phpunit --teamcity
67-
env:
68-
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
22+
infection:
23+
uses: codeigniter4/.github/.github/workflows/infection.yml@main

.github/workflows/phpcpd.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,7 @@ on:
1515
- '.github/workflows/phpcpd.yml'
1616

1717
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@v4
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 app/ tests/
18+
phpcpd:
19+
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@main
20+
with:
21+
dirs: "app/ tests/"

.github/workflows/phpcsfixer.yml

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,5 @@ on:
1515
- '.github/workflows/phpcsfixer.yml'
1616

1717
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@v4
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-
COMPOSER_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
18+
phpcsfixer:
19+
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@main

.github/workflows/phpstan.yml

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,56 +19,5 @@ on:
1919
- '.github/workflows/phpstan.yml'
2020

2121
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']
30-
31-
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
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-
COMPOSER_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
22+
phpstan:
23+
uses: codeigniter4/.github/.github/workflows/phpstan.yml@main

.github/workflows/phpunit.yml

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -19,72 +19,5 @@ on:
1919
- '.github/workflows/phpunit.yml'
2020

2121
jobs:
22-
main:
23-
name: PHP ${{ matrix.php-versions }} Unit Tests
24-
runs-on: ubuntu-latest
25-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26-
strategy:
27-
matrix:
28-
php-versions: ['7.4', '8.0', '8.1']
29-
30-
steps:
31-
- name: Checkout
32-
uses: actions/checkout@v4
33-
34-
- name: Set up PHP
35-
uses: shivammathur/setup-php@v2
36-
with:
37-
php-version: ${{ matrix.php-versions }}
38-
tools: composer, phive, phpunit
39-
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3
40-
coverage: xdebug
41-
env:
42-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
44-
- name: Get composer cache directory
45-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
46-
47-
- name: Cache composer dependencies
48-
uses: actions/cache@v3
49-
with:
50-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
51-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
52-
restore-keys: ${{ runner.os }}-composer-
53-
54-
- name: Install dependencies
55-
run: |
56-
if [ -f composer.lock ]; then
57-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
58-
else
59-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
60-
fi
61-
62-
- name: Test with PHPUnit
63-
run: vendor/bin/phpunit --verbose --coverage-text
64-
env:
65-
TERM: xterm-256color
66-
TACHYCARDIA_MONITOR_GA: enabled
67-
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68-
69-
- if: matrix.php-versions == '8.0'
70-
name: Run Coveralls
71-
continue-on-error: true
72-
run: |
73-
sudo phive --no-progress install --global --trust-gpg-keys E82B2FB314E9906E php-coveralls
74-
php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
75-
env:
76-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77-
COVERALLS_PARALLEL: true
78-
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }}
79-
80-
coveralls:
81-
needs: [main]
82-
name: Coveralls Finished
83-
runs-on: ubuntu-latest
84-
steps:
85-
- name: Upload Coveralls results
86-
uses: coverallsapp/github-action@master
87-
continue-on-error: true
88-
with:
89-
github-token: ${{ secrets.GITHUB_TOKEN }}
90-
parallel-finished: true
22+
phpunit:
23+
uses: codeigniter4/.github/.github/workflows/phpunit.yml@main

.github/workflows/psalm.yml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,5 @@ on:
1919
- '.github/workflows/psalm.yml'
2020

2121
jobs:
22-
build:
23-
name: Psalm Analysis
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@v4
30-
31-
- name: Setup PHP
32-
uses: shivammathur/setup-php@v2
33-
with:
34-
php-version: '8.1'
35-
tools: phpstan, phpunit
36-
extensions: intl, json, mbstring, xml
37-
coverage: none
38-
env:
39-
COMPOSER_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 Psalm cache directory
52-
run: mkdir -p build/psalm
53-
54-
- name: Cache Psalm results
55-
uses: actions/cache@v3
56-
with:
57-
path: build/psalm
58-
key: ${{ runner.os }}-psalm-${{ github.sha }}
59-
restore-keys: ${{ runner.os }}-psalm-
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: Run Psalm analysis
70-
run: vendor/bin/psalm
22+
psalm:
23+
uses: codeigniter4/.github/.github/workflows/psalm.yml@main

0 commit comments

Comments
 (0)