Skip to content

Commit

Permalink
ci: generate code coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey committed Dec 28, 2021
1 parent 824cdf4 commit ef0ac57
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/.simplecov export-ignore
/CHANGELOG.md export-ignore
/CODE_OF_CONDUCT.md export-ignore
/codecov.yml export-ignore
/composer.json export-ignore
/composer.lock export-ignore
/CONTRIBUTING.md export-ignore
Expand Down
33 changes: 31 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,37 @@ name: "build"
on: ["pull_request", "push"]

jobs:
code-coverage:
name: "Code coverage"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repository"
uses: "actions/checkout@v2"
- name: "Install expect"
run: |
sudo apt-get update
sudo apt-get -y install expect
- name: "Set up Ruby"
uses: "actions/setup-ruby@v1"
with:
ruby-version: "2.7"
- name: "Install Ruby dependencies"
run: |
gem install bashcov
gem install codecov
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
tools: "composer:v2"
coverage: "none"
- name: "Run expect tests"
run: "bashcov --root ./bin -- ./tests/bash-test.sh tests/tests.sh"
- name: "Publish coverage report to Codecov"
uses: "codecov/codecov-action@v1"

test:
name: "Expect Tests"
name: "Expect tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
Expand All @@ -30,7 +59,7 @@ jobs:
run: "composer test"

run:
name: "Run Action"
name: "Run action"
runs-on: "${{ matrix.operating-system }}"
strategy:
matrix:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/vendor/
/coverage/
/tests/expect/**.txt
4 changes: 4 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'codecov'
require 'simplecov'

SimpleCov.formatter = Codecov::SimpleCov::Formatter
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<a href="https://github.com/ramsey/composer-install"><img src="http://img.shields.io/badge/source-ramsey/composer--install-blue.svg?style=flat-square" alt="Source Code"></a>
<a href="https://github.com/ramsey/composer-install/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-darkcyan.svg?style=flat-square" alt="Read License"></a>
<a href="https://github.com/ramsey/composer-install/actions?query=workflow%3ACI"><img src="https://img.shields.io/github/workflow/status/ramsey/composer-install/CI?logo=github&style=flat-square" alt="Build Status"></a>
<a href="https://codecov.io/gh/ramsey/composer-install"><img src="https://img.shields.io/codecov/c/gh/ramsey/composer-install?label=codecov&logo=codecov&style=flat-square" alt="Codecov Code Coverage"></a>
</p>

## About
Expand Down
29 changes: 29 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: auto
threshold: 0%
patch:
default:
target: auto
threshold: 0%

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: false

0 comments on commit ef0ac57

Please sign in to comment.