Skip to content

Commit dafc60a

Browse files
committed
github actions: Now test lowest dependencies too !
Also create a specific workflow to build the coverage reports and send it to scrutinizer.
1 parent e1b6218 commit dafc60a

File tree

3 files changed

+59
-13
lines changed

3 files changed

+59
-13
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ name: "Continuous Integration"
88

99
jobs:
1010
run:
11-
name: "Grumphp"
1211
runs-on: ${{ matrix.operating-system }}
1312
strategy:
14-
fail-fast: false
13+
fail-fast: true
1514
matrix:
1615
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
1716
php-versions: ['7.3', '7.4', '8.0', '8.1']
1817
composer-versions: ['composer:v1', 'composer:v2']
18+
dependencies: ["lowest", "highest"]
1919

2020
steps:
2121
- name: Set git to use LF
@@ -26,14 +26,14 @@ jobs:
2626
- name: Checkout
2727
uses: actions/checkout@v2.3.1
2828
with:
29-
fetch-depth: 1
29+
fetch-depth: 10
3030

3131
- name: Install PHP
3232
uses: shivammathur/setup-php@v2
3333
with:
3434
php-version: ${{ matrix.php-versions }}
3535
tools: ${{ matrix.composer-versions }}
36-
extensions: mbstring, xdebug, pcov
36+
extensions: xdebug
3737

3838
- name: Get Composer Cache Directory
3939
id: composer-cache
@@ -46,17 +46,13 @@ jobs:
4646
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
4747
restore-keys: ${{ runner.os }}-composer-
4848

49-
- name: Install dependencies
50-
run: composer install --no-progress --prefer-dist --optimize-autoloader
49+
- name: "Install dependencies"
50+
uses: "ramsey/composer-install@v2"
51+
with:
52+
dependency-versions: "${{ matrix.dependencies }}"
5153

5254
- name: Run tests
5355
run: |
5456
composer run analyse
5557
composer run lint
5658
composer run test
57-
58-
- name: Send Scrutinizer data
59-
run: |
60-
wget https://scrutinizer-ci.com/ocular.phar
61-
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
62-
continue-on-error: true
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
name: "Test Coverage"
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set git to use LF
14+
run: |
15+
git config --global core.autocrlf false
16+
git config --global core.eol lf
17+
18+
- name: Checkout
19+
uses: actions/checkout@v2.3.1
20+
with:
21+
fetch-depth: 10
22+
23+
- name: Install PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: 8.1
27+
extensions: pcov
28+
29+
- name: Get Composer Cache Directory
30+
id: composer-cache
31+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
32+
33+
- name: Cache dependencies
34+
uses: actions/cache@v2
35+
with:
36+
path: ${{ steps.composer-cache.outputs.dir }}
37+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
38+
restore-keys: ${{ runner.os }}-composer-
39+
40+
- name: "Install dependencies"
41+
uses: "ramsey/composer-install@v2"
42+
43+
- name: Run tests
44+
run: composer run test-coverage
45+
46+
- name: Upload Scrutinizer coverage
47+
uses: sudo-bot/action-scrutinizer@latest
48+
with:
49+
cli-args: "--format=php-clover coverage/clover.xml"

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
"scripts": {
7171
"analyse": "phpstan analyse --level 8 src",
7272
"lint": "php-cs-fixer fix --dry-run src && php-cs-fixer fix --dry-run spec",
73-
"test": "phpspec run"
73+
"test": "phpspec run --no-coverage",
74+
"test-coverage": "phpspec run"
7475
},
7576
"extra": {
7677
"branch-alias": {

0 commit comments

Comments
 (0)