1+ on : [ push, pull_request ]
2+ name : " CI"
3+
4+ jobs :
5+ qa :
6+ name : " QA (lint + static analysis)"
7+ if : " !startsWith(github.event.head_commit.message, 'chore(release)')"
8+ runs-on : " ubuntu-latest"
9+ env :
10+ PHP_CS_FIXER_IGNORE_ENV : true
11+ steps :
12+ - name : " Checkout"
13+ uses : " actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
14+
15+ - name : " Install PHP"
16+ uses : " shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # 2.36.0
17+ with :
18+ coverage : " none"
19+ php-version : " 8.3"
20+
21+ - name : " Validate composer.json and composer.lock"
22+ run : " composer validate --ansi --strict"
23+
24+ - name : " Determine composer cache directory"
25+ uses : " ergebnis/.github/actions/composer/determine-cache-directory@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
26+
27+ - name : " Cache dependencies installed with composer"
28+ uses : " actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306" # v5.0.3
29+ with :
30+ path : " ${{ env.COMPOSER_CACHE_DIR }}"
31+ key : " php-8.3-composer-locked-${{ hashFiles('composer.lock') }}"
32+ restore-keys : |
33+ php-8.3-composer-locked-${{ github.ref_name }}
34+ php-8.3-composer-locked-
35+ php-8.3-composer-main
36+
37+ - name : " Install locked dependencies with composer"
38+ uses : " ergebnis/.github/actions/composer/install@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
39+ with :
40+ dependencies : " locked"
41+
42+ - name : " Check coding style"
43+ run : " vendor/bin/codecept build"
44+
45+ - name : " Check coding style"
46+ run : " composer cs:check"
47+
48+ - name : " Run static analysis"
49+ run : " composer stan"
50+
51+ tests :
52+ name : " Run codeception tests"
53+ needs : [ qa ]
54+ runs-on : " ubuntu-latest"
55+ strategy :
56+ matrix :
57+ include :
58+ - { php-version: 8.3, dependencies: locked, coverage: pcov, with_coverage: true, allow-fail: false }
59+
60+ - { php-version: 8.4, dependencies: highest, coverage: pcov, with_coverage: false, allow-fail: true }
61+ - { php-version: 8.5, dependencies: highest, coverage: pcov, with_coverage: false, allow-fail: true }
62+ steps :
63+ - name : " Checkout"
64+ uses : " actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
65+
66+ - name : " Install PHP"
67+ uses : " shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # 2.36.0
68+ with :
69+ coverage : " ${{ matrix.coverage }}"
70+ ini-values : display_errors=On, display_startup_errors=On, error_reporting=32767
71+ php-version : " ${{ matrix.php-version }}"
72+
73+ - name : " Set up problem matchers for PHP"
74+ run : " echo \" ::add-matcher::${{ runner.tool_cache }}/php.json\" "
75+
76+ - name : " Set up problem matchers for phpunit/phpunit"
77+ run : " echo \" ::add-matcher::${{ runner.tool_cache }}/phpunit.json\" "
78+
79+ - name : " Validate composer.json and composer.lock"
80+ run : " composer validate --ansi --strict"
81+
82+ - name : " Determine composer cache directory"
83+ uses : " ergebnis/.github/actions/composer/determine-cache-directory@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
84+
85+ - name : " Cache dependencies installed with composer"
86+ uses : " actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306" # v5.0.3
87+ with :
88+ path : " ${{ env.COMPOSER_CACHE_DIR }}"
89+ key : " php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
90+ restore-keys : |
91+ php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ github.ref_name }}
92+ php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
93+ php-${{ matrix.php-version }}-composer-main
94+
95+ - name : " Install ${{ matrix.dependencies }} dependencies with composer"
96+ uses : " ergebnis/.github/actions/composer/install@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
97+ with :
98+ dependencies : " ${{ matrix.dependencies }}"
99+
100+ - name : " Run Tests (coverage)"
101+ if : matrix.with_coverage == true
102+ run : |
103+ vendor/bin/codecept build
104+ vendor/bin/codecept run --coverage --coverage-xml=coverage.xml --xml --report
105+
106+ - name : " Run Tests"
107+ if : matrix.with_coverage != true
108+ run : |
109+ vendor/bin/codecept build
110+ vendor/bin/codecept run --xml --report
111+
112+ - name : " Upload coverage artifact"
113+ if : matrix.with_coverage == true
114+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
115+ with :
116+ name : code-coverage-results
117+ path : tests/_output/
118+ retention-days : 5
0 commit comments