Speedup psalm

This commit is contained in:
Nicolas Grekas 2021-02-25 20:32:02 +01:00
parent 87aeb8da13
commit 3fb74abe62
5 changed files with 187 additions and 231 deletions

View File

@ -1,47 +1,50 @@
name: Intl data tests
on:
push:
paths:
- 'src/Symfony/Component/Intl/Resources/data/**'
pull_request:
paths:
- 'src/Symfony/Component/Intl/Resources/data/**'
push:
paths:
- 'src/Symfony/Component/Intl/Resources/data/**'
pull_request:
paths:
- 'src/Symfony/Component/Intl/Resources/data/**'
defaults:
run:
shell: bash
jobs:
tests:
name: Tests (intl-data)
runs-on: ubuntu-latest
tests:
name: Tests (intl-data)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Define the ICU version
run: |
SYMFONY_ICU_VERSION=$(php -r 'require "src/Symfony/Component/Intl/Intl.php"; echo Symfony\Component\Intl\Intl::getIcuStubVersion();')
echo "SYMFONY_ICU_VERSION=$SYMFONY_ICU_VERSION" >> $GITHUB_ENV
- name: Define the ICU version
run: |
SYMFONY_ICU_VERSION=$(php -r 'require "src/Symfony/Component/Intl/Intl.php"; echo Symfony\Component\Intl\Intl::getIcuStubVersion();')
echo "SYMFONY_ICU_VERSION=$SYMFONY_ICU_VERSION" >> $GITHUB_ENV
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
extensions: "zip,intl-${{env.SYMFONY_ICU_VERSION}}"
ini-values: "memory_limit=-1"
php-version: "7.4"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
extensions: "zip,intl-${{env.SYMFONY_ICU_VERSION}}"
ini-values: "memory_limit=-1"
php-version: "7.4"
- name: Install dependencies
run: |
echo "::group::composer update"
composer update --no-progress --no-suggest --ansi
echo "::endgroup::"
echo "::group::install phpunit"
./phpunit install
echo "::endgroup::"
- name: Install dependencies
run: |
echo "::group::composer update"
composer update --no-progress --no-suggest --ansi
echo "::endgroup::"
echo "::group::install phpunit"
./phpunit install
echo "::endgroup::"
- name: Report the ICU version
run: icu-config --version && php -i | grep 'ICU version'
- name: Report the ICU version
run: icu-config --version && php -i | grep 'ICU version'
- name: Run intl-data tests
run: ./phpunit --group intl-data -v
- name: Run intl-data tests
run: ./phpunit --group intl-data -v

View File

@ -1,28 +1,31 @@
name: PhpUnitBridge
on:
push:
paths:
- 'src/Symfony/Bridge/PhpUnit/**'
pull_request:
paths:
- 'src/Symfony/Bridge/PhpUnit/**'
push:
paths:
- 'src/Symfony/Bridge/PhpUnit/**'
pull_request:
paths:
- 'src/Symfony/Bridge/PhpUnit/**'
defaults:
run:
shell: bash
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "5.5"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "5.5"
- name: Lint
run: find ./src/Symfony/Bridge/PhpUnit -name '*.php' | grep -v -e /Tests/ -e ForV6 -e ForV7 -e ForV8 -e ForV9 -e ConstraintLogicTrait | parallel -j 4 php -l {}
- name: Lint
run: find ./src/Symfony/Bridge/PhpUnit -name '*.php' | grep -v -e /Tests/ -e ForV6 -e ForV7 -e ForV8 -e ForV9 -e ConstraintLogicTrait | parallel -j 4 php -l {}

View File

@ -3,6 +3,10 @@ name: Static analysis
on:
pull_request: ~
defaults:
run:
shell: bash
jobs:
psalm:
name: Psalm
@ -17,81 +21,38 @@ jobs:
ini-values: "memory_limit=-1"
coverage: none
- name: Checkout PR
uses: actions/checkout@v2
with:
path: pr
- name: Checkout base
- name: Checkout target branch
uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
path: base
- name: Checkout PR
uses: actions/checkout@v2
- name: Configure composer
run: |
cd base
COMPOSER_HOME="$(composer config home)"
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
- name: Determine composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ github.base_ref }}
restore-keys: composer-
COMPOSER_HOME="$(composer config home)"
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
- name: Install Psalm
run: |
composer require psalm/phar
cp ./vendor/bin/psalm.phar base/psalm.phar
cp ./vendor/bin/psalm.phar pr/psalm.phar
- name: Install dependencies for base
run: |
cd base
echo "::group::modify composer.json"
composer remove symfony/phpunit-bridge --no-interaction --no-update
composer require --no-update phpunit/phpunit php-http/discovery psr/event-dispatcher
echo "::endgroup::"
echo "::group::composer update"
composer update --no-progress --ansi
echo "::endgroup::"
echo "::group::modify composer.json"
composer remove --no-update --no-interaction symfony/phpunit-bridge
composer require --no-update psalm/phar phpunit/phpunit php-http/discovery psr/event-dispatcher
echo "::endgroup::"
echo "::group::composer update"
composer update --no-progress --ansi
git checkout composer.json
echo "::endgroup::"
./vendor/bin/psalm.phar --version
- name: Generate Psalm baseline
run: |
cd base
./psalm.phar --set-baseline=.github/psalm/psalm.baseline.xml --no-progress
- name: Copy baseline
run: |
cp base/.github/psalm/psalm.baseline.xml pr/.github/psalm/psalm.baseline.xml
- name: Install dependencies for PR
run: |
cd pr
echo "::group::modify composer.json"
composer remove symfony/phpunit-bridge --no-interaction --no-update
composer require --no-update phpunit/phpunit php-http/discovery psr/event-dispatcher
echo "::endgroup::"
echo "::group::composer update"
composer update --no-progress --ansi
echo "::endgroup::"
- name: Cache Psalm
uses: actions/cache@v2
with:
path: pr/.github/psalm/cache/
key: psalm-${{ github.base_ref }}
restore-keys: psalm-
git checkout -m ${{ github.base_ref }}
./vendor/bin/psalm.phar --set-baseline=.github/psalm/psalm.baseline.xml --no-progress
git checkout -m FETCH_HEAD
- name: Psalm
run: |
cd pr
./psalm.phar --version
./psalm.phar --output-format=github --no-progress
./vendor/bin/psalm.phar --output-format=github --no-progress

View File

@ -1,127 +1,116 @@
name: Tests
on:
push:
pull_request:
push:
pull_request:
jobs:
integration:
name: Integration
runs-on: ubuntu-latest
integration:
name: Integration
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.4']
strategy:
matrix:
php: ['7.1', '7.4']
services:
ldap:
image: bitnami/openldap
ports:
- 3389:3389
env:
LDAP_ADMIN_USERNAME: admin
LDAP_ADMIN_PASSWORD: symfony
LDAP_ROOT: dc=symfony,dc=com
LDAP_PORT_NUMBER: 3389
LDAP_USERS: a
LDAP_PASSWORDS: a
redis:
image: redis:6.0.0
ports:
- 6379:6379
redis-cluster:
image: grokzen/redis-cluster:5.0.4
ports:
- 7000:7000
- 7001:7001
- 7002:7002
- 7003:7003
- 7004:7004
- 7005:7005
- 7006:7006
env:
STANDALONE: 1
redis-sentinel:
image: bitnami/redis-sentinel:6.0
ports:
- 26379:26379
env:
REDIS_MASTER_HOST: redis
REDIS_MASTER_SET: redis_sentinel
REDIS_SENTINEL_QUORUM: 1
memcached:
image: memcached:1.6.5
ports:
- 11211:11211
rabbitmq:
image: rabbitmq:3.8.3
ports:
- 5672:5672
services:
ldap:
image: bitnami/openldap
ports:
- 3389:3389
env:
LDAP_ADMIN_USERNAME: admin
LDAP_ADMIN_PASSWORD: symfony
LDAP_ROOT: dc=symfony,dc=com
LDAP_PORT_NUMBER: 3389
LDAP_USERS: a
LDAP_PASSWORDS: a
redis:
image: redis:6.0.0
ports:
- 6379:6379
redis-cluster:
image: grokzen/redis-cluster:5.0.4
ports:
- 7000:7000
- 7001:7001
- 7002:7002
- 7003:7003
- 7004:7004
- 7005:7005
- 7006:7006
env:
STANDALONE: 1
redis-sentinel:
image: bitnami/redis-sentinel:6.0
ports:
- 26379:26379
env:
REDIS_MASTER_HOST: redis
REDIS_MASTER_SET: redis_sentinel
REDIS_SENTINEL_QUORUM: 1
memcached:
image: memcached:1.6.5
ports:
- 11211:11211
rabbitmq:
image: rabbitmq:3.8.3
ports:
- 5672:5672
steps:
- name: Checkout
uses: actions/checkout@v2
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
extensions: "memcached,redis,xsl,ldap"
ini-values: "memory_limit=-1"
php-version: "${{ matrix.php }}"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
extensions: "memcached,redis,xsl,ldap"
ini-values: "memory_limit=-1"
php-version: "${{ matrix.php }}"
- name: Load fixtures
uses: docker://bitnami/openldap
with:
entrypoint: /bin/bash
args: -c "(/opt/bitnami/openldap/bin/ldapwhoami -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony||sleep 5) && /opt/bitnami/openldap/bin/ldapadd -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif && /opt/bitnami/openldap/bin/ldapdelete -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony cn=a,ou=users,dc=symfony,dc=com"
- name: Load fixtures
uses: docker://bitnami/openldap
with:
entrypoint: /bin/bash
args: -c "(/opt/bitnami/openldap/bin/ldapwhoami -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony||sleep 5) && /opt/bitnami/openldap/bin/ldapadd -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif && /opt/bitnami/openldap/bin/ldapdelete -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony cn=a,ou=users,dc=symfony,dc=com"
- name: Configure composer
run: |
COMPOSER_HOME="$(composer config home)"
composer self-update
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
- name: Configure composer
run: |
COMPOSER_HOME="$(composer config home)"
composer self-update
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
- name: Determine composer cache directory
id: composer-cache
run: echo "::set-output name=directory::$(composer config cache-dir)"
- name: Install dependencies
run: |
echo "::group::composer update"
composer update --no-progress --ansi
echo "::endgroup::"
echo "::group::install phpunit"
./phpunit install
echo "::endgroup::"
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-
- name: Run tests
run: ./phpunit --group integration -v
env:
REDIS_HOST: localhost
REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005'
REDIS_SENTINEL_HOSTS: 'localhost:26379'
REDIS_SENTINEL_SERVICE: redis_sentinel
MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages
MESSENGER_AMQP_DSN: amqp://localhost/%2f/messages
MEMCACHED_HOST: localhost
LDAP_HOST: localhost
LDAP_PORT: 3389
- name: Install dependencies
run: |
echo "::group::composer update"
composer update --no-progress --ansi
echo "::endgroup::"
echo "::group::install phpunit"
./phpunit install
echo "::endgroup::"
- name: Run tests
run: ./phpunit --group integration -v
env:
REDIS_HOST: localhost
REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005'
REDIS_SENTINEL_HOSTS: 'localhost:26379'
REDIS_SENTINEL_SERVICE: redis_sentinel
MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages
MESSENGER_AMQP_DSN: amqp://localhost/%2f/messages
MEMCACHED_HOST: localhost
LDAP_HOST: localhost
LDAP_PORT: 3389
- name: Run HTTP push tests
if: matrix.php == '7.4'
run: |
[ -d .phpunit ] && mv .phpunit .phpunit.bak
wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/vulcain_0.1.3_Linux_x86_64.tar.gz -O - | tar xz && mv vulcain /usr/local/bin
docker run --rm -e COMPOSER_ROOT_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
sudo rm -rf .phpunit
[ -d .phpunit.bak ] && mv .phpunit.bak .phpunit
- name: Run HTTP push tests
if: matrix.php == '7.4'
run: |
[ -d .phpunit ] && mv .phpunit .phpunit.bak
wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/vulcain_0.1.3_Linux_x86_64.tar.gz -O - | tar xz && mv vulcain /usr/local/bin
docker run --rm -e COMPOSER_ROOT_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
sudo rm -rf .phpunit
[ -d .phpunit.bak ] && mv .phpunit.bak .phpunit