File tree Expand file tree Collapse file tree 5 files changed +39
-65
lines changed Expand file tree Collapse file tree 5 files changed +39
-65
lines changed Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- cp composer.json composer.json.origin
6
- rm composer.lock || true
7
- rm -Rf vendor || true
8
- sed -i ' s/\^5.4 || \^6.0 || \^7.0/\^5.4/g' composer.json
9
- composer install
5
+ if [ -z " $1 " ]; then
6
+ echo " Please specify the Symfony version to install"
7
+ exit 1
8
+ fi
9
+
10
+ echo " Installing Symfony version $1 "
11
+
12
+ # This is not required for CI, but it allows to test the script locally
13
+ function cleanup {
14
+ echo " Cleaning up"
15
+ # Restore the original composer.json file
16
+ mv composer.origin.json composer.json
17
+ }
18
+
19
+ function install-specified-symfony-version {
20
+ local symfony_version=$1
21
+ # Save the original composer.json file
22
+ cp composer.json composer.origin.json
23
+ # Delete the lock file and vendor directory for a clean install
24
+ rm composer.lock || true
25
+ rm -Rf vendor || true
26
+ # Replace the Symfony version in composer.json
27
+ sed -i ' s/\^5.4 || \^6.0 || \^7.0/' $symfony_version ' /g' composer.json
28
+ # Install the specified Symfony version
29
+ composer install
30
+ }
31
+
32
+ # Ensure cleanup is called on exit
33
+ trap cleanup EXIT
34
+
35
+ install-specified-symfony-version $1
Original file line number Diff line number Diff line change 34
34
uses : php-actions/composer@v2
35
35
with :
36
36
php_version : ${{ matrix.php }}
37
- env :
38
- SYMFONY_REQUIRE : ${{ matrix.sf_version }}
37
+
38
+ - name : Override Symfony version
39
+ run : composer run ci-symfony-install-version ${{ matrix.sf_version }}
39
40
40
41
- uses : php-actions/phpunit@v3
41
42
with :
Original file line number Diff line number Diff line change 3
3
composer.lock
4
4
.phpunit.result.cache
5
5
.idea
6
- .php-cs-fixer.cache
6
+ .php-cs-fixer.cache
7
+
8
+ composer.origin.json
Original file line number Diff line number Diff line change 51
51
"scripts" : {
52
52
"psalm" : " php bin/console.php cache:warmup && vendor/bin/psalm --show-info=true" ,
53
53
"fix-cs" : " vendor/bin/php-cs-fixer fix" ,
54
- "check-cs" : " vendor/bin/php-cs-fixer fix --dry-run"
54
+ "check-cs" : " vendor/bin/php-cs-fixer fix --dry-run" ,
55
+ "ci-symfony-install-version" : " ./.github/scripts/setup-symfony-env.bash"
55
56
}
56
57
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments