Skip to content

Commit 7c3afc9

Browse files
committed
minor #2885 [CI] (Re-)use ramsey/composer-install action when possible (Kocal)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [CI] (Re-)use ramsey/composer-install action when possible | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Docs? | no <!-- required for new features --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - For new features, provide some code snippets to help understand usage. - Features and deprecations must be submitted against branch main. - Update/add documentation as required (we can help!) - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Replace #2882 Commits ------- 71f9723 [CI] (Re-)use ramsey/composer-install action when possible
2 parents 32daca7 + 71f9723 commit 7c3afc9

File tree

4 files changed

+59
-13
lines changed

4 files changed

+59
-13
lines changed

.github/workflows/app-tests.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,19 @@ jobs:
4646
- uses: shivammathur/setup-php@v2
4747

4848
- name: Install root dependencies
49-
run: composer install
49+
uses: ramsey/composer-install@v3
50+
with:
51+
working-directory: ${{ github.workspace }}
5052

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

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

5963
- if: matrix.ux-packages-source == 'php-vendor'
6064
name: Refresh dependencies from vendor/

.github/workflows/code-quality.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ jobs:
3434
runs-on: ubuntu-latest
3535
steps:
3636
- uses: actions/checkout@v4
37+
3738
- uses: shivammathur/setup-php@v2
3839
with:
3940
php-version: '8.1'
40-
- run: composer install
41+
42+
- name: Install root dependencies
43+
uses: ramsey/composer-install@v3
44+
with:
45+
working-directory: ${{ github.workspace }}
46+
4147
- name: php-cs-fixer
4248
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff
4349

@@ -83,8 +89,23 @@ jobs:
8389
php-version: 8.1
8490
tools: flex
8591

92+
- name: Get composer cache directory
93+
id: composer-cache
94+
run: |
95+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
96+
97+
- name: Cache packages dependencies
98+
uses: actions/cache@v4
99+
with:
100+
path: ${{ steps.composer-cache.outputs.dir }}
101+
key: ${{ runner.os }}-composer-packages-${{ matrix.php-version }}-${{ matrix.dependency-version }}-${{ matrix.symfony-version }}-${{ matrix.minimum-stability }}-${{ hashFiles('src/**/composer.json') }}
102+
restore-keys: |
103+
${{ runner.os }}-composer-packages-${{ matrix.php-version }}-${{ matrix.dependency-version }}-${{ matrix.symfony-version }}-${{ matrix.minimum-stability }}
104+
86105
- name: Install root dependencies
87-
run: composer install
106+
uses: ramsey/composer-install@v3
107+
with:
108+
working-directory: ${{ github.workspace }}
88109

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

.github/workflows/functional-tests.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,22 @@ jobs:
5757
tools: flex
5858

5959
- name: Install root dependencies
60-
run: composer install
60+
uses: ramsey/composer-install@v3
61+
with:
62+
working-directory: ${{ github.workspace }}
6163

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

65-
- name: Install dependencies with composer
67+
- name: Configure composer dependencies stability
68+
run: composer config minimum-stability ${{ matrix.minimum-stability || 'stable' }}
6669
working-directory: src/Turbo
67-
run: |
68-
composer config minimum-stability ${{ matrix.minimum-stability || 'stable' }}
69-
composer update ${{ matrix.dependency-version == 'lowest' && '--prefer-lowest' || '' }} --no-progress --no-interaction
70+
71+
- name: Install dependencies with composer
72+
uses: ramsey/composer-install@v3
73+
with:
74+
working-directory: src/Turbo
75+
dependency-versions: ${{ matrix.dependency-version }}
7076

7177
- name: Install JavaScript dependencies
7278
working-directory: src/Turbo/tests/app

.github/workflows/unit-tests.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,23 @@ jobs:
6868
php-version: ${{ matrix.php-version }}
6969
tools: flex
7070

71+
- name: Get composer cache directory
72+
id: composer-cache
73+
run: |
74+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
75+
76+
- name: Cache packages dependencies
77+
uses: actions/cache@v4
78+
with:
79+
path: ${{ steps.composer-cache.outputs.dir }}
80+
key: ${{ runner.os }}-composer-packages-${{ matrix.php-version }}-${{ matrix.dependency-version }}-${{ matrix.symfony-version }}-${{ matrix.minimum-stability }}-${{ hashFiles('src/**/composer.json') }}
81+
restore-keys: |
82+
${{ runner.os }}-composer-packages-${{ matrix.php-version }}-${{ matrix.dependency-version }}-${{ matrix.symfony-version }}-${{ matrix.minimum-stability }}
83+
7184
- name: Install root dependencies
72-
run: composer install
85+
uses: ramsey/composer-install@v3
86+
with:
87+
working-directory: ${{ github.workspace }}
7388

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

0 commit comments

Comments
 (0)