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

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Jun 29, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues Fix #...
License MIT

Replace #2882

Comment on lines +92 to +108
- 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 }}
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

Comment on lines +71 to +87
- 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 }}
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.

@Kocal Kocal marked this pull request as ready for review June 29, 2025 17:07
@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Jun 29, 2025
@Kocal Kocal requested review from kbond and smnandre June 29, 2025 17:07
@smnandre
Copy link
Member

I'm a bit lost and do not understand why we have soo many test jobs... but i trust you here so: 👍

@Kocal
Copy link
Member Author

Kocal commented Jun 29, 2025

I'm a bit lost and do not understand why we have soo many test jobs... but i trust you here so: 👍

The CI has been modified during the last few months, we have:

  • unit tests (for PHP and JavaScript) which require only basic setup
  • functional tests (only Turbo) which require more advanced setup (Mercure)
  • and "app tests" that ensures UX packages (PHP and JS) can be correctly installed/used in real Symfony apps

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jun 30, 2025
@Kocal Kocal force-pushed the revert-2780-ramsey-install+cache-all-composer-deps branch from cf42993 to 71f9723 Compare June 30, 2025 20:23
@Kocal Kocal merged commit 7c3afc9 into symfony:2.x Jun 30, 2025
30 of 31 checks passed
@Kocal Kocal deleted the revert-2780-ramsey-install+cache-all-composer-deps branch July 2, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants