Skip to content

Commit

Permalink
chore(ci): tweaks coverage. (#193)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jcchavezs authored Nov 23, 2020
1 parent 4bd0ef0 commit f1daec2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
41 changes: 25 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: CI
on: [push, pull_request]
on:
push:
branches:
- master
paths-ignore:
- "**/*.md"
- "LICENSE"
pull_request:
jobs:
test:
name: Zipkin PHP (PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
Expand All @@ -8,15 +15,14 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.1', '7.2', '7.3', '7.4']
php-versions: ["7.1", "7.2", "7.3", "7.4"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
coverage: xdebug #optional
- name: Get composer cache directory
id: composer-cache
Expand All @@ -25,29 +31,32 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: |
composer install --no-progress --prefer-dist --optimize-autoloader
- name: Download coveralls.phar
if: matrix.operating-system != 'windows-latest'
- name: Download php-coveralls.phar
if: matrix.operating-system == 'ubuntu-latest'
run: |
wget -c -nc --retry-connrefused --tries=0 https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
chmod +x coveralls.phar
php coveralls.phar --version
wget -c -nc --retry-connrefused --tries=0 https://github.com/satooshi/php-coveralls/releases/download/v2.4.2/php-coveralls.phar
chmod +x php-coveralls.phar
php php-coveralls.phar --version
mkdir -p build/logs
- name: Run Lint
- name: Run lint
if: matrix.operating-system != 'windows-latest'
run: composer lint
- name: Run Static check
- name: Run static check
run: composer static-check
- name: Run Tests
- name: Run tests
run: composer test -- --coverage-clover=build/logs/clover.xml
- name: Upload coverage report to codecov service
if: matrix.operating-system != 'windows-latest'
if: matrix.operating-system == 'ubuntu-latest'
run: |
php coveralls.phar -v
php php-coveralls.phar -v
bash <(curl -s https://codecov.io/bash)
env:
# Running coveralls with default config did not work so followed the workaround below:
# https://github.com/php-coveralls/php-coveralls/issues/273#issuecomment-537473525
COVERALLS_RUN_LOCALLY: 1
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Build Status](https://travis-ci.org/openzipkin/zipkin-php.svg?branch=master)](https://travis-ci.org/openzipkin/zipkin-php)
[![Build status](https://ci.appveyor.com/api/projects/status/f02q896uv1m3crg1?svg=true)](https://ci.appveyor.com/project/jcchavezs/zipkin-php)
![CI](https://github.com/openzipkin/zipkin-php/workflows/CI/badge.svg)
[![Latest Stable Version](https://poser.pugx.org/openzipkin/zipkin/v/stable)](https://packagist.org/packages/openzipkin/zipkin)
[![Coverage Status](https://coveralls.io/repos/github/openzipkin/zipkin-php/badge.svg)](https://coveralls.io/github/openzipkin/zipkin-php)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg)](https://php.net/)
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Reporters/JsonV2SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ public function testJSONTagsAreSerializedCorrectly()
. '"duration":1000,"localEndpoint":{"serviceName":"service1"},'
. '"tags":{"test_key_1":"{\"name\":\"Kurt\"}","test_key_2":"foo\nbar"}'
. '}]';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$expectedSerialization = str_replace('\\n', '\\r\\n', $expectedSerialization);
}

$this->assertEquals($expectedSerialization, $serializedSpans);
}
}

0 comments on commit f1daec2

Please sign in to comment.