Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Speedup psalm #40311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
87 changes: 45 additions & 42 deletions .github/workflows/intl-data-tests.yml
Original file line number Diff line number Diff line change
@@ -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/**'

jobs:
defaults:
run:
shell: bash

tests:
name: Tests (intl-data)
runs-on: ubuntu-latest

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: 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: Report the ICU version
run: icu-config --version && php -i | grep 'ICU version'

- name: Run intl-data tests
run: ./phpunit --group intl-data -v
jobs:
tests:
name: Tests (intl-data)
runs-on: ubuntu-latest

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: 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: Report the ICU version
run: icu-config --version && php -i | grep 'ICU version'

- name: Run intl-data tests
run: ./phpunit --group intl-data -v
43 changes: 23 additions & 20 deletions .github/workflows/phpunit-bridge.yml
Original file line number Diff line number Diff line change
@@ -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/**'

jobs:
defaults:
run:
shell: bash

lint:
name: Lint
runs-on: ubuntu-latest
jobs:
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 {}
85 changes: 23 additions & 62 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Static analysis
on:
pull_request: ~

defaults:
run:
shell: bash

jobs:
psalm:
name: Psalm
Expand All @@ -17,81 +21,38 @@ jobs:
ini-values: "memory_limit=-1"
coverage: none

- name: Checkout PR
- name: Checkout target branch
uses: actions/checkout@v2
with:
path: pr
ref: ${{ github.base_ref }}

- name: Checkout base
- name: Checkout PR
uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
path: base

- 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 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a simpler solution might be to move the checkout PR step after the generation of the baseline based on base

Copy link
Member Author

@nicolas-grekas nicolas-grekas Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really: that would miss installing the deps added to the PR, if any

./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
Loading