Skip to content

Commit

Permalink
Add code coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
yethee committed May 14, 2024
1 parent ab25c89 commit cee5c32
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
49 changes: 40 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
coding-standards:
name: "Check Coding Standards"

runs-on: ubuntu-latest
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
Expand All @@ -19,20 +19,20 @@ jobs:
with:
coverage: "none"
php-version: "8.1"
tools: composer:v2
tools: "composer:v2"

- name: "Install dependencies"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "highest"

- name: "Run phpcs"
run: vendor/bin/phpcs -n
run: "vendor/bin/phpcs -n"

static-analysis:
name: "Static Analysis"

runs-on: ubuntu-latest
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
Expand All @@ -43,20 +43,51 @@ jobs:
with:
coverage: "none"
php-version: "8.1"
tools: composer:v2
tools: "composer:v2"

- name: "Install dependencies"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "highest"

- name: "Run psalm"
run: vendor/bin/psalm
run: "vendor/bin/psalm"

code-coverage:
name: "Code coverage"

needs: [ "coding-standards", "static-analysis" ]
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "8.3"
tools: "composer:v2"

- name: "Install dependencies"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "highest"

- name: "Run tests"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Upload coverage reports to Codecov"
uses: "codecov/codecov-action@v4"
with:
token: ${{ secrets.CODECOV_TOKEN }}

tests:
name: "PHPUnit tests"

runs-on: ubuntu-latest
needs: ["code-coverage"]
runs-on: "ubuntu-latest"

strategy:
matrix:
Expand All @@ -78,12 +109,12 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
tools: composer:v2
tools: "composer:v2"

- name: "Install dependencies"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run tests"
run: vendor/bin/phpunit
run: "vendor/bin/phpunit --no-coverage"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

![Packagist Version](https://img.shields.io/packagist/v/yethee/tiktoken)
![Build status](https://img.shields.io/github/actions/workflow/status/yethee/tiktoken-php/ci.yml?branch=master)
[![codecov](https://codecov.io/github/yethee/tiktoken-php/graph/badge.svg)](https://codecov.io/github/yethee/tiktoken-php)
![License](https://img.shields.io/github/license/yethee/tiktoken-php)

This is a port of the [tiktoken](https://github.com/openai/tiktoken).
Expand Down

0 comments on commit cee5c32

Please sign in to comment.