Skip to content

Commit 0cc327e

Browse files
committed
workflow
1 parent 3689e90 commit 0cc327e

File tree

10 files changed

+522
-0
lines changed

10 files changed

+522
-0
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: daily

.github/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- dependabot
5+
categories:
6+
- title: Breaking Changes
7+
labels:
8+
- 'breaking change'
9+
- title: Fixed Bugs
10+
labels:
11+
- bug
12+
- title: New Features
13+
labels:
14+
- 'new feature'
15+
- title: Enhancements
16+
labels:
17+
- enhancement
18+
- title: Refactoring
19+
labels:
20+
- refactor
21+
- title: Others (Only for checking. Remove this category)
22+
labels:
23+
- "*"

.github/workflows/deptrac.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Deptrac
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- 'composer.*'
10+
- 'depfile.yaml'
11+
- '.github/workflows/deptrac.yml'
12+
push:
13+
branches:
14+
- develop
15+
paths:
16+
- '**.php'
17+
- 'composer.*'
18+
- 'depfile.yaml'
19+
- '.github/workflows/deptrac.yml'
20+
21+
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+
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
73+
env:
74+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/docs.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
paths:
8+
- 'docs/*'
9+
- 'mkdocs.yml'
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v4
20+
with:
21+
python-version: 3.x
22+
- run: pip install mkdocs-material
23+
- run: mkdocs gh-deploy --force

.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@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 src/ tests/

.github/workflows/phpcsfixer.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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: 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+
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

.github/workflows/phpstan.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: PHPStan
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- 'composer.*'
10+
- 'phpstan*'
11+
- '.github/workflows/phpstan.yml'
12+
push:
13+
branches:
14+
- develop
15+
paths:
16+
- '**.php'
17+
- 'composer.*'
18+
- 'phpstan*'
19+
- '.github/workflows/phpstan.yml'
20+
21+
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: ['8.1', '8.2']
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+
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

.github/workflows/phpunit.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: PHPUnit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- 'composer.*'
10+
- 'phpunit*'
11+
- '.github/workflows/phpunit.yml'
12+
push:
13+
branches:
14+
- develop
15+
paths:
16+
- '**.php'
17+
- 'composer.*'
18+
- 'phpunit*'
19+
- '.github/workflows/phpunit.yml'
20+
21+
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: ['8.1', '8.2']
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+
GITHUB_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+
68+
- if: matrix.php-versions == '8.1'
69+
name: Run Coveralls
70+
continue-on-error: true
71+
run: |
72+
sudo phive --no-progress install --global --trust-gpg-keys E82B2FB314E9906E php-coveralls
73+
php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
74+
env:
75+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
COVERALLS_PARALLEL: true
77+
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }}
78+
79+
coveralls:
80+
needs: [main]
81+
name: Coveralls Finished
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Upload Coveralls results
85+
uses: coverallsapp/github-action@master
86+
continue-on-error: true
87+
with:
88+
github-token: ${{ secrets.GITHUB_TOKEN }}
89+
parallel-finished: true

0 commit comments

Comments
 (0)