Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.

Commit c1a7ed0

Browse files
committed
Create Action
0 parents  commit c1a7ed0

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM ubuntu:latest
2+
3+
RUN apt-get update
4+
RUN apt-get install -y lcov
5+
6+
COPY entrypoint.sh /entrypoint.sh
7+
8+
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# lcov cop
2+
3+
A Github Action which helps enforce a minimum code coverage threshold.
4+
5+
## Inputs
6+
7+
### `path`
8+
9+
**Required** The path to the `lcov.info` file.
10+
11+
## Example usage
12+
13+
```yaml
14+
uses: ChicagoFlutter/lcov-cop@master
15+
with:
16+
path: './coverage/lcov.info'
17+
```

action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: lcov-cop
2+
author: felangel
3+
description: 'Enforce LCOV Coverage Thresholds'
4+
branding:
5+
icon: 'code'
6+
color: green
7+
inputs:
8+
path:
9+
description: 'lcov path'
10+
required: true
11+
runs:
12+
using: 'docker'
13+
image: 'Dockerfile'
14+
args:
15+
- ${{ inputs.path }}

entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh -l
2+
3+
LCOV_PATH=$1
4+
5+
code_coverage=$(lcov --list ${LCOV_PATH} | sed -n "s/.*Total:|\(.*\)%.*/\1/p")
6+
7+
echo "Code Coverage: ${code_coverage}%"
8+
if (( $(echo "$code_coverage < 100" | bc) )); then exit 1; fi

0 commit comments

Comments
 (0)