1- name : CI
1+ name : " CI "
22
33on :
44 pull_request :
55 push :
66 branches :
77 - " master"
88 schedule :
9- - cron : " 0 17 * * *"
9+ - cron : " 42 3 * * *"
1010
1111env :
12- COMPOSER_AUTH : ' {"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
1312 LIBRDKAFKA_VERSION : v1.4.2
1413
1514jobs :
16- coding-standard :
17- runs-on : ubuntu-18.04
18- name : Coding Standard
15+ phpunit :
16+ name : " PHPUnit "
17+ runs-on : " ubuntu-20.04 "
1918
20- steps :
21- - uses : actions/checkout@v2
22-
23- - name : Install librdkafka
24- run : |
25- chmod +x .ci/install_rdkafka.sh
26- .ci/install_rdkafka.sh
27-
28- - name : Install PHP
29- uses : shivammathur/setup-php@2.2.0
30- with :
31- php-version : 7.3
32- coverage : none
33- tools : pecl
34- extensions : json, mbstring, rdkafka
35-
36- - name : Get Composer Cache Directory
37- id : composer-cache
38- run : echo "::set-output name=dir::$(composer config cache-files-dir)"
39-
40- - name : Cache dependencies
41- uses : actions/cache@v1
42- with :
43- path : ${{ steps.composer-cache.outputs.dir }}
44- key : ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
45- restore-keys : ${{ runner.os }}-composer-
46-
47- - name : Install Dependencies
48- run : composer install ${DEPENDENCIES}
49-
50- - name : Coding Standard
51- run : vendor/bin/phpcs
52-
53- phpstan :
54- runs-on : ubuntu-18.04
55- name : PHPStan
56-
57- steps :
58- - uses : actions/checkout@v2
59-
60- - name : Install librdkafka
61- run : |
62- chmod +x .ci/install_rdkafka.sh
63- .ci/install_rdkafka.sh
64-
65- - name : Install PHP
66- uses : shivammathur/setup-php@2.2.0
67- with :
68- php-version : 7.3
69- coverage : none
70- tools : pecl
71- extensions : json, mbstring, rdkafka
72-
73- - name : Get Composer Cache Directory
74- id : composer-cache
75- run : echo "::set-output name=dir::$(composer config cache-files-dir)"
76-
77- - name : Cache dependencies
78- uses : actions/cache@v1
79- with :
80- path : ${{ steps.composer-cache.outputs.dir }}
81- key : ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
82- restore-keys : ${{ runner.os }}-composer-
83-
84- - name : Install Dependencies
85- run : composer install ${DEPENDENCIES}
86-
87- - name : PHPStan
88- run : vendor/bin/phpstan analyse
89-
90- coverage :
91- runs-on : ubuntu-18.04
92- name : Code Coverage
19+ strategy :
20+ matrix :
21+ php-version :
22+ - " 7.4"
23+ - " 8.0"
24+ dependencies :
25+ - " highest"
26+ include :
27+ - dependencies : " lowest"
28+ php-version : " 7.4"
9329
9430 steps :
95- - uses : actions/checkout@v2
31+ - name : " Checkout"
32+ uses : " actions/checkout@v2"
9633 with :
97- ref : ${{ github.ref }}
34+ fetch-depth : 2
9835
9936 - name : Build the docker-compose stack
10037 run : docker-compose -f tests/docker-compose.yaml up -d
@@ -104,85 +41,47 @@ jobs:
10441 chmod +x .ci/install_rdkafka.sh
10542 .ci/install_rdkafka.sh
10643
107- - name : Install PHP
108- uses : shivammathur/setup-php@2.2.0
109- with :
110- php-version : 7.3
111- coverage : pcov
112- tools : pecl
113- extensions : json, mbstring, rdkafka
114-
115- - name : Get Composer Cache Directory
116- id : composer-cache
117- run : echo "::set-output name=dir::$(composer config cache-files-dir)"
11844
119- - name : Cache dependencies
120- uses : actions/cache@v1
45+ - name : " Install PHP "
46+ uses : " shivammathur/setup-php@v2 "
12147 with :
122- path : ${{ steps.composer-cache.outputs.dir }}
123- key : ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
124- restore-keys : ${{ runner.os }}-composer-
48+ php-version : " ${{ matrix.php-version }}"
49+ coverage : " pcov"
50+ extensions : " rdkafka"
51+ ini-values : " zend.assertions=1"
12552
126- - name : Install Dependencies
127- run : composer install ${DEPENDENCIES}
53+ - name : " Install dependencies with Composer"
54+ uses : " ramsey/composer-install@v1"
55+ with :
56+ dependency-versions : " ${{ matrix.dependencies }}"
12857
129- - name : Code coverage
130- run : |
131- ./vendor/bin/phpunit --coverage-clover /tmp/coverage/clover.xml
58+ - name : " Run PHPUnit"
59+ run : " vendor/bin/phpunit --coverage-clover=coverage.xml"
13260
133- - name : Report to Coveralls
134- env :
135- COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
136- COVERALLS_RUN_LOCALLY : 1
137- run : vendor/bin/php-coveralls --coverage_clover /tmp/ coverage/clover .xml --json_path /tmp/coverage/coveralls.json
61+ - name : " Upload coverage file "
62+ uses : " actions/upload-artifact@v2 "
63+ with :
64+ name : " phpunit-${{ matrix.deps }}-${{ matrix.php-version }}.coverage "
65+ path : " coverage.xml"
13866
139- test_with-php-versions :
140- runs-on : ubuntu-18.04
141- strategy :
142- matrix :
143- php : [7.3, 7.4]
144- env : [
145- ' DEPENDENCIES=--prefer-lowest' ,
146- ' ' ,
147- ]
148- name : PHP ${{ matrix.php }} Test ${{ matrix.env }}
67+ upload_coverage :
68+ name : " Upload coverage to Codecov"
69+ runs-on : " ubuntu-20.04"
70+ needs :
71+ - " phpunit"
14972
15073 steps :
151- - uses : actions/checkout@v2
152-
153- - name : Build the docker-compose stack
154- run : docker-compose -f tests/docker-compose.yaml up -d
155-
156- - name : Install librdkafka
157- run : |
158- chmod +x .ci/install_rdkafka.sh
159- .ci/install_rdkafka.sh
160-
161- - name : Install PHP
162- uses : shivammathur/setup-php@2.2.0
74+ - name : " Checkout"
75+ uses : " actions/checkout@v2"
16376 with :
164- php-version : ${{ matrix.php }}
165- coverage : none
166- tools : pecl
167- extensions : json, mbstring, rdkafka
168-
169- - name : Get Composer Cache Directory
170- id : composer-cache
171- run : echo "::set-output name=dir::$(composer config cache-files-dir)"
77+ fetch-depth : 2
17278
173- - name : Cache dependencies
174- uses : actions/cache@v1
79+ - name : " Download coverage files "
80+ uses : " actions/download-artifact@v2 "
17581 with :
176- path : ${{ steps.composer-cache.outputs.dir }}
177- key : ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
178- restore-keys : ${{ runner.os }}-composer-
82+ path : " reports"
17983
180- - name : Install Dependencies
181- run : composer install ${DEPENDENCIES}
182-
183- - name : Run tests
184- run : |
185- export $ENV
186- ./vendor/bin/phpunit
187- env :
188- ENV : ${{ matrix.env}}
84+ - name : " Upload to Codecov"
85+ uses : " codecov/codecov-action@v1"
86+ with :
87+ directory : reports
0 commit comments