@@ -2,30 +2,38 @@ name: Build
2
2
3
3
on :
4
4
push :
5
- branches : [master]
5
+ branches : [ master ]
6
6
pull_request :
7
7
release :
8
- types : [created]
8
+ types : [ created ]
9
9
10
10
jobs :
11
11
tests :
12
12
runs-on : ubuntu-latest
13
13
name : Build and test
14
14
strategy :
15
15
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 ]
20
21
include :
21
22
- php : " 7.3"
23
+ composer-version : " 1"
22
24
coverage : " pcov"
23
25
publish-phar : true
26
+ git-fetch-depth : 0 # box/composer needs history to determine a recent git version
24
27
- php : " 7.4"
25
28
composer-version : " 2"
29
+ coverage : " none"
30
+ publish-phar : false
31
+ git-fetch-depth : 1
26
32
27
33
steps :
28
34
- uses : actions/checkout@v2
35
+ with :
36
+ fetch-depth : " ${{ matrix.git-fetch-depth }}"
29
37
30
38
- name : Setup PHP
31
39
uses : shivammathur/setup-php@v2
35
43
tools : " composer:v${{ matrix.composer-version }}"
36
44
coverage : " ${{ matrix.coverage }}"
37
45
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
+
38
57
- 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
40
61
41
62
- name : Install dependencies
42
63
run : composer install --no-interaction --no-progress --no-suggest --prefer-dist
@@ -45,24 +66,28 @@ jobs:
45
66
run : make check-composer-root-version
46
67
47
68
- name : Run tests (coverage)
48
- if : matrix.publish-phar
69
+ if : matrix.coverage == 'pcov'
49
70
run : make tc
50
71
72
+ - name : install tree
73
+ if : matrix.publish-phar == true
74
+ run : sudo apt-get install -y tree
75
+
51
76
- name : Run tests (e2e)
52
- if : matrix.publish-phar
77
+ if : matrix.publish-phar == true
53
78
run : make e2e
54
79
55
80
- name : Run tests
56
- if : ! matrix.publish-phar
81
+ if : matrix.publish-phar == false
57
82
run : make tu
58
83
59
84
- name : Run phpstan
60
- if : ! matrix.publish-phar
85
+ if : matrix.publish-phar == false
61
86
run : make phpstan
62
87
63
88
- uses : actions/upload-artifact@v1
64
89
name : Publish the PHAR
65
- if : matrix.publish-phar
90
+ if : matrix.publish-phar == true
66
91
with :
67
92
name : php-scoper.phar
68
93
path : bin/php-scoper.phar
77
102
with :
78
103
name : php-scoper.phar
79
104
path : .
105
+
80
106
- name : Upload php-scoper.phar
81
107
uses : actions/upload-release-asset@v1
82
108
env :
0 commit comments