1+ name : CI
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ workflow_dispatch :
9+
10+ env :
11+ COMPOSER_HOME : ${{ github.workspace }}/.cache/composer
12+ DEFAULT_PHP_VERSION : ' 8.1'
13+
14+ jobs :
15+ php-checks :
16+ name : PHP checks
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
21+
22+ - uses : shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
23+ with :
24+ php-version : ${{ env.DEFAULT_PHP_VERSION }}
25+ tools : composer:72a8f8e653710e18d83e5dd531eb5a71fc3223e6 # v2.9.5
26+
27+ - uses : actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
28+ with :
29+ path : .cache/composer
30+ key : composer-${{ hashFiles('composer.lock') }}
31+
32+ - run : composer install
33+
34+ - name : codeStyle
35+ run : make test-php-style
36+
37+ - name : phpStan
38+ run : make test-php-phpstan
39+
40+ - name : phpPhan
41+ run : make test-php-phan
42+
43+ php-unit-tests :
44+ name : php unit tests ${{ matrix.php-version }} with coverage
45+ runs-on : ubuntu-latest
46+ needs : php-checks
47+ strategy :
48+ fail-fast : false
49+ matrix :
50+ php-version : ['8.1', '8.2', '8.3']
51+
52+ steps :
53+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
54+
55+ - uses : shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
56+ with :
57+ php-version : ${{ matrix.php-version }}
58+ tools : composer:72a8f8e653710e18d83e5dd531eb5a71fc3223e6 # v2.9.5
59+ coverage : xdebug
60+
61+ - uses : actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
62+ with :
63+ path : .cache/composer
64+ key : composer-${{ hashFiles('composer.lock') }}
65+
66+ - run : composer install
67+
68+ - name : unitTests-${{ matrix.php-version }}
69+ run : make test-php-unit
70+
71+ - name : coverage rename
72+ run : mv tests/output/clover.xml tests/output/clover-unitTests-${{ matrix.php-version }}.xml
73+
74+ - uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
75+ with :
76+ name : coverage-unitTests-${{ matrix.php-version }}
77+ path : tests/output/clover-unitTests-${{ matrix.php-version }}.xml
78+
79+ docs :
80+ name : docs
81+ runs-on : ubuntu-latest
82+ needs : php-unit-tests
83+
84+ steps :
85+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
86+
87+ - name : docs generate
88+ run : docker run --rm -v ${{ github.workspace }}:/data phpdoc/phpdoc@sha256:2b36e4f74937e40246d54ed12dfa4f988f21ed8d19e46f426ac3dc32eac2ff1d # v3.9.1
89+
90+ - name : publish api docs
91+ uses : peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
92+ if : github.event_name != 'pull_request'
93+ with :
94+ github_token : ${{ secrets.GITHUB_TOKEN }}
95+ publish_dir : docs
96+ publish_branch : docs
97+ force_orphan : true
98+
99+ - name : compile docs hugo
100+ run : |
101+ mkdir docs-hugo
102+ cat docs-hugo-header.md README.md > docs-hugo/_index.md
103+
104+ - name : publish docs hugo
105+ uses : peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
106+ if : github.event_name != 'pull_request'
107+ with :
108+ github_token : ${{ secrets.GITHUB_TOKEN }}
109+ publish_dir : docs-hugo
110+ publish_branch : docs-hugo
111+ force_orphan : true
0 commit comments