Skip to content

[CI] (Re-)use ramsey/composer-install action when possible #2885

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
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
14 changes: 9 additions & 5 deletions .github/workflows/app-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ jobs:
- uses: shivammathur/setup-php@v2

- name: Install root dependencies
run: composer install
uses: ramsey/composer-install@v3
with:
working-directory: ${{ github.workspace }}

- name: Build root packages
run: php .github/build-packages.php

# We always install PHP deps because we of the UX Translator, which requires `var/translations` to exists
- name: Install App dependenies
run: composer update
working-directory: test_apps/encore-app
# We always install PHP deps because of the UX Translator, which requires `var/translations` to exists
- name: Install App dependencies
uses: ramsey/composer-install@v3
with:
working-directory: test_apps/encore-app
dependency-versions: highest

- if: matrix.ux-packages-source == 'php-vendor'
name: Refresh dependencies from vendor/
Expand Down
25 changes: 23 additions & 2 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- run: composer install

- name: Install root dependencies
uses: ramsey/composer-install@v3
with:
working-directory: ${{ github.workspace }}

- name: php-cs-fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff

Expand Down Expand Up @@ -83,8 +89,23 @@ jobs:
php-version: 8.1
tools: flex

- name: Get composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache packages dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-packages-${{ matrix.php-version }}-${{ matrix.dependency-version }}-${{ matrix.symfony-version }}-${{ matrix.minimum-stability }}-${{ hashFiles('src/**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-packages-${{ matrix.php-version }}-${{ matrix.dependency-version }}-${{ matrix.symfony-version }}-${{ matrix.minimum-stability }}

- name: Install root dependencies
run: composer install
uses: ramsey/composer-install@v3
with:
working-directory: ${{ github.workspace }}
Comment on lines +92 to +108
Copy link
Member Author

Choose a reason for hiding this comment

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

Manually caching Composer dependencies is still necessary because dependencies are parallelly installed through composer, which AFAIK is not possible with ramsey/composer-install


- name: Build root packages
run: php .github/build-packages.php
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,22 @@ jobs:
tools: flex

- name: Install root dependencies
run: composer install
uses: ramsey/composer-install@v3
with:
working-directory: ${{ github.workspace }}

- name: Build root packages
run: php .github/build-packages.php

- name: Install dependencies with composer
- name: Configure composer dependencies stability
run: composer config minimum-stability ${{ matrix.minimum-stability || 'stable' }}
working-directory: src/Turbo
run: |
composer config minimum-stability ${{ matrix.minimum-stability || 'stable' }}
composer update ${{ matrix.dependency-version == 'lowest' && '--prefer-lowest' || '' }} --no-progress --no-interaction

- name: Install dependencies with composer
uses: ramsey/composer-install@v3
with:
working-directory: src/Turbo
dependency-versions: ${{ matrix.dependency-version }}

- name: Install JavaScript dependencies
working-directory: src/Turbo/tests/app
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,23 @@ jobs:
php-version: ${{ matrix.php-version }}
tools: flex

- name: Get composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache packages dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-packages-${{ matrix.php-version }}-${{ matrix.dependency-version }}-${{ matrix.symfony-version }}-${{ matrix.minimum-stability }}-${{ hashFiles('src/**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-packages-${{ matrix.php-version }}-${{ matrix.dependency-version }}-${{ matrix.symfony-version }}-${{ matrix.minimum-stability }}

- name: Install root dependencies
run: composer install
uses: ramsey/composer-install@v3
with:
working-directory: ${{ github.workspace }}
Comment on lines +71 to +87
Copy link
Member Author

Choose a reason for hiding this comment

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

Manually caching Composer dependencies is still necessary because dependencies are parallelly installed through composer, which AFAIK is not possible with ramsey/composer-install

Copy link
Member

Choose a reason for hiding this comment

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

Genuine questiin, do we still need ramsey then here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's for root dependencies, the one defined here: https://github.com/symfony/ux/blob/2.x/composer.json

Using ramsey/composer-install here makes sense, as we install root dependencies across 6 CI workflows/jobs, which share the same cache keys.


- name: Build root packages
run: php .github/build-packages.php
Expand Down
Loading