Skip to content

Commit f1daec2

Browse files
authored
chore(ci): tweaks coverage. (#193)
* chore(ci): tweaks coverage. * fix(ci): fixes concat of strings. * chore(ci): fixes coveralls exec. * chore(ci): back to EOL. * chore: adds coveralls secret. * chore(ci): runs on PRs and merges to master only. * chore: ignore files that don't produce a change when merge into master. * chore: adds reference on the reason for running coverals locally. * chore(ci): adds badge.
1 parent 4bd0ef0 commit f1daec2

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
name: CI
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths-ignore:
7+
- "**/*.md"
8+
- "LICENSE"
9+
pull_request:
310
jobs:
411
test:
512
name: Zipkin PHP (PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
@@ -8,15 +15,14 @@ jobs:
815
fail-fast: false
916
matrix:
1017
operating-system: [ubuntu-latest, windows-latest, macos-latest]
11-
php-versions: ['7.1', '7.2', '7.3', '7.4']
18+
php-versions: ["7.1", "7.2", "7.3", "7.4"]
1219
steps:
1320
- name: Checkout
1421
uses: actions/checkout@v2
1522
- name: Setup PHP, with composer and extensions
1623
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
1724
with:
1825
php-version: ${{ matrix.php-versions }}
19-
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
2026
coverage: xdebug #optional
2127
- name: Get composer cache directory
2228
id: composer-cache
@@ -25,29 +31,32 @@ jobs:
2531
uses: actions/cache@v2
2632
with:
2733
path: ${{ steps.composer-cache.outputs.dir }}
28-
# Use composer.json for key, if composer.lock is not committed.
29-
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
30-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
34+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
3135
restore-keys: ${{ runner.os }}-composer-
3236
- name: Install Composer dependencies
3337
run: |
3438
composer install --no-progress --prefer-dist --optimize-autoloader
35-
- name: Download coveralls.phar
36-
if: matrix.operating-system != 'windows-latest'
39+
- name: Download php-coveralls.phar
40+
if: matrix.operating-system == 'ubuntu-latest'
3741
run: |
38-
wget -c -nc --retry-connrefused --tries=0 https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
39-
chmod +x coveralls.phar
40-
php coveralls.phar --version
42+
wget -c -nc --retry-connrefused --tries=0 https://github.com/satooshi/php-coveralls/releases/download/v2.4.2/php-coveralls.phar
43+
chmod +x php-coveralls.phar
44+
php php-coveralls.phar --version
4145
mkdir -p build/logs
42-
- name: Run Lint
46+
- name: Run lint
4347
if: matrix.operating-system != 'windows-latest'
4448
run: composer lint
45-
- name: Run Static check
49+
- name: Run static check
4650
run: composer static-check
47-
- name: Run Tests
51+
- name: Run tests
4852
run: composer test -- --coverage-clover=build/logs/clover.xml
4953
- name: Upload coverage report to codecov service
50-
if: matrix.operating-system != 'windows-latest'
54+
if: matrix.operating-system == 'ubuntu-latest'
5155
run: |
52-
php coveralls.phar -v
56+
php php-coveralls.phar -v
5357
bash <(curl -s https://codecov.io/bash)
58+
env:
59+
# Running coveralls with default config did not work so followed the workaround below:
60+
# https://github.com/php-coveralls/php-coveralls/issues/273#issuecomment-537473525
61+
COVERALLS_RUN_LOCALLY: 1
62+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/openzipkin/zipkin-php.svg?branch=master)](https://travis-ci.org/openzipkin/zipkin-php)
44
[![Build status](https://ci.appveyor.com/api/projects/status/f02q896uv1m3crg1?svg=true)](https://ci.appveyor.com/project/jcchavezs/zipkin-php)
5+
![CI](https://github.com/openzipkin/zipkin-php/workflows/CI/badge.svg)
56
[![Latest Stable Version](https://poser.pugx.org/openzipkin/zipkin/v/stable)](https://packagist.org/packages/openzipkin/zipkin)
67
[![Coverage Status](https://coveralls.io/repos/github/openzipkin/zipkin-php/badge.svg)](https://coveralls.io/github/openzipkin/zipkin-php)
78
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg)](https://php.net/)

tests/Unit/Reporters/JsonV2SerializerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ public function testJSONTagsAreSerializedCorrectly()
8787
. '"duration":1000,"localEndpoint":{"serviceName":"service1"},'
8888
. '"tags":{"test_key_1":"{\"name\":\"Kurt\"}","test_key_2":"foo\nbar"}'
8989
. '}]';
90+
9091
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
9192
$expectedSerialization = str_replace('\\n', '\\r\\n', $expectedSerialization);
9293
}
94+
9395
$this->assertEquals($expectedSerialization, $serializedSpans);
9496
}
9597
}

0 commit comments

Comments
 (0)