@@ -2,30 +2,38 @@ name: Build
22
33on :
44 push :
5- branches : [master]
5+ branches : [ master ]
66 pull_request :
77 release :
8- types : [created]
8+ types : [ created ]
99
1010jobs :
1111 tests :
1212 runs-on : ubuntu-latest
1313 name : Build and test
1414 strategy :
1515 matrix :
16- php : ["7.2", "7.4"]
17- composer-version : ["1"]
18- coverage : ["none"]
19- publish-phar : [false]
16+ php : [ "7.2", "7.4" ]
17+ composer-version : [ "1" ]
18+ coverage : [ "none" ]
19+ publish-phar : [ false ]
20+ git-fetch-depth : [ 1 ]
2021 include :
2122 - php : " 7.3"
23+ composer-version : " 1"
2224 coverage : " pcov"
2325 publish-phar : true
26+ git-fetch-depth : 0 # box/composer needs history to determine a recent git version
2427 - php : " 7.4"
2528 composer-version : " 2"
29+ coverage : " none"
30+ publish-phar : false
31+ git-fetch-depth : 1
2632
2733 steps :
2834 - uses : actions/checkout@v2
35+ with :
36+ fetch-depth : " ${{ matrix.git-fetch-depth }}"
2937
3038 - name : Setup PHP
3139 uses : shivammathur/setup-php@v2
3543 tools : " composer:v${{ matrix.composer-version }}"
3644 coverage : " ${{ matrix.coverage }}"
3745
46+ - name : Get composer cache directory
47+ id : composercache
48+ run : echo "::set-output name=dir::$(composer config cache-files-dir)"
49+
50+ - name : Cache composer dependencies
51+ uses : actions/cache@v2
52+ with :
53+ path : ${{ steps.composercache.outputs.dir }}
54+ key : ${{ runner.os }}-composer-cache-${{ hashFiles('**/composer.lock') }}
55+ restore-keys : ${{ runner.os }}-composer-cache-
56+
3857 - name : Set composer root version
39- run : source .composer-root-version
58+ run : |
59+ source .composer-root-version
60+ echo "COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION}" >> $GITHUB_ENV
4061
4162 - name : Install dependencies
4263 run : composer install --no-interaction --no-progress --no-suggest --prefer-dist
@@ -45,24 +66,28 @@ jobs:
4566 run : make check-composer-root-version
4667
4768 - name : Run tests (coverage)
48- if : matrix.publish-phar
69+ if : matrix.coverage == 'pcov'
4970 run : make tc
5071
72+ - name : install tree
73+ if : matrix.publish-phar == true
74+ run : sudo apt-get install -y tree
75+
5176 - name : Run tests (e2e)
52- if : matrix.publish-phar
77+ if : matrix.publish-phar == true
5378 run : make e2e
5479
5580 - name : Run tests
56- if : ! matrix.publish-phar
81+ if : matrix.publish-phar == false
5782 run : make tu
5883
5984 - name : Run phpstan
60- if : ! matrix.publish-phar
85+ if : matrix.publish-phar == false
6186 run : make phpstan
6287
6388 - uses : actions/upload-artifact@v1
6489 name : Publish the PHAR
65- if : matrix.publish-phar
90+ if : matrix.publish-phar == true
6691 with :
6792 name : php-scoper.phar
6893 path : bin/php-scoper.phar
77102 with :
78103 name : php-scoper.phar
79104 path : .
105+
80106 - name : Upload php-scoper.phar
81107 uses : actions/upload-release-asset@v1
82108 env :
0 commit comments