Skip to content

Configure phpstan to not complain about safety checks (#1461) #5141

Configure phpstan to not complain about safety checks (#1461)

Configure phpstan to not complain about safety checks (#1461) #5141

Workflow file for this run

name: CI
on:
pull_request: ~
push:
branches:
- master
jobs:
build:
name: Components tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
strategy: ["default"]
include:
# Minimum supported dependencies with the oldest PHP version
- php: "7.2"
strategy: "lowest"
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: flex
- name: Checkout code
uses: actions/checkout@v3
- name: Initialize tests
run: make initialize -j 4
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer
uses: actions/cache@v3
if: steps.composer-cache.outputs.dir
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ github.sha }}
restore-keys: composer-
- name: Download phpunit
run: |
rm composer.*
composer init --no-interaction --name "async-aws/aws"
echo ::group::Download
composer require symfony/phpunit-bridge
echo ::endgroup::
echo ::group::Install
./vendor/bin/simple-phpunit install
echo ::endgroup::
- name: Modify composer.json - default
if: matrix.strategy != 'lowest'
run: |
CURRENT_DIR=$(pwd)
for COMPONENT in $(find src/Service -maxdepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
sed -i -re 's/"async-aws\/core": "[^"]+"/"async-aws\/core": "*@dev"/' composer.json
sed -i -re 's/"require": \{/"repositories": [{"type": "path","url": "..\/..\/Core"}],"require": \{/' composer.json
sed -i -re 's/"require": \{/"minimum-stability": "dev","prefer-stable": true,"require": \{/' composer.json
cat composer.json
echo ::endgroup::
done
cd "$CURRENT_DIR"
for COMPONENT in $(find src/Integration -maxdepth 3 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
sed -i -re 's/"require": \{/"minimum-stability": "dev","prefer-stable": true,"require": \{/' composer.json
cat composer.json
echo ::endgroup::
done
- name: Modify composer.json - lowest
if: matrix.strategy == 'lowest'
run: |
CURRENT_DIR=$(pwd)
for COMPONENT in $(find src/Service -maxdepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
sed -i -re 's/"require": \{/"minimum-stability": "dev","prefer-stable": true,"require": \{/' composer.json
cat composer.json
echo ::endgroup::
done
cd "$CURRENT_DIR"
for COMPONENT in $(find src/Integration/Symfony -maxdepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
sed -i -re 's/"require": \{/"minimum-stability": "dev","prefer-stable": true,"require": \{/' composer.json
cat composer.json
echo ::endgroup::
done
- name: Download dependencies
env:
PHP_VERSION: ${{ matrix.php }}
# Make sure we dont download awfully old Symfony versions.
SYMFONY_REQUIRE: ">=4.4"
run: |
CURRENT_DIR=$(pwd)
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
echo "$CURRENT_DIR/$COMPONENT"
cd "$CURRENT_DIR/$COMPONENT"
localExit=0
composer update --no-interaction --no-scripts --prefer-dist --optimize-autoloader ${{ matrix.strategy == 'lowest' && '--prefer-lowest' || '' }} $COMPOSER_OPTIONS || localExit=1
echo ::endgroup::
if [ $localExit -ne 0 ]; then
echo "::error::$COMPONENT error"
exit $localExit
fi
done
- name: Run tests
env:
OVERRIDE_SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.strategy == 'lowest' && 'max[self]=9999' || '' }}
run: |
ok=0
if [ -n "$OVERRIDE_SYMFONY_DEPRECATIONS_HELPER" ]; then
export SYMFONY_DEPRECATIONS_HELPER=$OVERRIDE_SYMFONY_DEPRECATIONS_HELPER
fi
for COMPONENT in $(find src -maxdepth 4 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
do
echo ::group::$COMPONENT
localExit=0
./vendor/bin/simple-phpunit -c ./$COMPONENT 2>&1 || localExit=1
ok=$(( $localExit || $ok ))
echo ::endgroup::
if [ $localExit -ne 0 ]; then
echo "::error::$COMPONENT failed"
fi
done
exit $ok
root:
name: Root tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
minimum_stability: [dev, stable]
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
- name: Checkout code
uses: actions/checkout@v3
- name: Initialize tests
run: make initialize -j 4
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ github.sha }}
restore-keys: composer-
- name: Download dependencies
run: |
composer config minimum-stability ${{ matrix.minimum_stability }}
composer update --no-interaction --prefer-dist --optimize-autoloader
- name: Run tests
run: |
echo ::group::Install
./vendor/bin/simple-phpunit install
echo ::endgroup::
./vendor/bin/simple-phpunit