5.3.0 #2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
branches-ignore: | |
- gh-pages | |
push: | |
branches: | |
- main | |
name: build | |
concurrency: | |
group: build-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
actions: write | |
env: | |
PHP_INI_VALUES: memory_limit=-1,date.timezone=UTC | |
COMPOSER_ROOT_VERSION: 5.0.99 | |
SYMFONY_DEPRECATIONS_HELPER: weak | |
jobs: | |
phpcs: | |
name: Code style & Static Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install PHP & tools | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
ini-values: ${{ env.PHP_INI_VALUES }} | |
tools: phpcs, composer:v2, phpstan | |
- name: Install dependencies | |
run: composer install --no-interaction --no-progress --ansi | |
- name: Check production code style | |
run: composer cs-prod | |
- name: Check test code style | |
run: composer cs-tests | |
- name: PHPStan | |
run: phpstan analyse src | |
linux: | |
name: PHP ${{ matrix.php }}–${{ matrix.os }}–${{ matrix.mode }} | |
runs-on: ${{ matrix.os }} | |
env: | |
extensions: curl, mbstring, openssl, pdo, pdo_sqlite, zip | |
COLUMNS: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
php: ['8.2', '8.3', '8.4'] | |
mode: ['stable', 'experimental'] | |
exclude: | |
- php: '8.3' | |
mode: 'experimental' | |
- php: '8.4' | |
mode: 'experimental' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install PHP & Composer | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: ${{ env.extensions }} | |
ini-values: ${{ env.PHP_INI_VALUES }} | |
coverage: xdebug | |
tools: composer:v2 | |
- name: Determine composer cache directory | |
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV | |
- name: Cache dependencies installed with composer | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.COMPOSER_CACHE_DIR }} | |
key: php${{ matrix.php }}-${{ matrix.mode }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
php${{ matrix.php }}-${{ matrix.mode }}-composer- | |
- name: Update composer | |
run: composer self-update | |
- name: Validate composer.json | |
run: composer validate --strict | |
- name: Install / Update Dependencies | |
run: | | |
if [ "${{ matrix.mode }}" = "stable" ]; then | |
composer update --no-interaction --no-progress --optimize-autoloader --ansi | |
else | |
composer update --prefer-lowest --no-interaction --no-progress --optimize-autoloader --ansi | |
fi | |
- name: Test that failing test really fails | |
run: | | |
if php codecept run -c tests/data/claypit/ scenario FailedCept -vvv; then | |
echo "Test hasn't failed" | |
false | |
fi | |
# - name: Run tests without code coverage on PHP 8.2 | |
# if: matrix.php == '8.2' | |
# run: | | |
# php -S 127.0.0.1:8008 -t tests/data/app >/dev/null 2>&1 & | |
# php codecept build | |
# php codecept run cli,unit | |
- name: Run tests | |
run: | | |
php -S 127.0.0.1:8008 -t tests/data/app -d pcov.directory=$(pwd)/tests/data/app >/dev/null 2>&1 & | |
php codecept build | |
php codecept run cli,unit,coverage --env COVERAGE=1 | |
- name: Run module-asserts tests | |
run: php codecept run -c vendor/codeception/module-asserts/ | |
- name: Run module-filesystem tests | |
run: php codecept run -c vendor/codeception/module-filesystem/ | |
- name: Run module-db sqlite tests | |
run: php codecept run -c vendor/codeception/module-db/ unit :Sqlite | |
- name: Run module-phpbrowser tests | |
run: | | |
cd vendor/codeception/module-phpbrowser/ | |
php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 & | |
php -S 127.0.0.1:8010 -t tests/data/rest >/dev/null 2>&1 & | |
php ../../../codecept run tests/unit/Codeception/Module/PhpBrowserTest.php | |
windows-latest: | |
name: PHP ${{ matrix.php }}–${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
env: | |
extensions: curl, mbstring, openssl, pdo, pdo_sqlite, zip | |
SYMFONY_DEPRECATIONS_HELPER: weak | |
COMPOSER_ROOT_VERSION: 5.0.99 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest] | |
php: ['8.2', '8.3', '8.4'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install PHP & Composer | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: ${{ env.extensions }} | |
ini-values: ${{ env.PHP_INI_VALUES }} | |
tools: composer:v2 | |
- name: Determine composer cache directory | |
run: | | |
echo "COMPOSER_CACHE_DIR=~\\AppData\\Local\\Composer" >> $GITHUB_ENV | |
- name: Cache dependencies installed with composer | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.COMPOSER_CACHE_DIR }} | |
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
php${{ matrix.php }}-composer- | |
- name: Update composer | |
run: composer self-update | |
- name: Validate composer.json | |
run: composer validate --strict | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi | |
- name: Run CLI tests | |
run: php codecept run cli --skip-group coverage | |
- name: Run unit tests | |
run: php codecept run unit -g core -g appveyor |