├── .gitignore ├── .dockerignore ├── Dockerfile ├── action.yml ├── entrypoint.sh ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | coverage 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # ignore all files by default 2 | * 3 | # include required files with an exception 4 | !entrypoint.sh 5 | !LICENSE 6 | !README.md -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y bc 5 | RUN apt-get install -y lcov 6 | 7 | COPY entrypoint.sh /entrypoint.sh 8 | 9 | ENTRYPOINT ["/entrypoint.sh"] -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: lcov-cop 2 | author: felangel 3 | description: 'Enforce LCOV Coverage Thresholds' 4 | branding: 5 | icon: 'check-circle' 6 | color: green 7 | inputs: 8 | path: 9 | description: 'lcov path' 10 | required: false 11 | default: './coverage/lcov.info' 12 | min_coverage: 13 | description: 'minimum coverage percentage allowed' 14 | required: false 15 | default: 100 16 | exclude: 17 | description: 'paths to exclude from coverage' 18 | required: false 19 | runs: 20 | using: 'docker' 21 | image: 'Dockerfile' 22 | args: 23 | - ${{ inputs.path }} 24 | - ${{ inputs.min_coverage }} 25 | - ${{ inputs.exclude }} 26 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | LCOV_PATH=$1 6 | MINIMUM_COVERAGE=$2 7 | FILTERED_COVERAGE_PATH='./lcov_filtered.info' 8 | 9 | if [ ! -z "$3" ]; then 10 | echo "Excluding $3 from coverage..." 11 | lcov --remove ${LCOV_PATH} $3 -o ${FILTERED_COVERAGE_PATH} 12 | CODE_COVERAGE=$(lcov --list ${FILTERED_COVERAGE_PATH} | sed -n "s/.*Total:|\([^%]*\)%.*/\1/p") 13 | else 14 | CODE_COVERAGE=$(lcov --list ${LCOV_PATH} | sed -n "s/.*Total:|\([^%]*\)%.*/\1/p") 15 | fi 16 | 17 | echo "Minumum Coverage Required: ${MINIMUM_COVERAGE}%" 18 | echo "Current Code Coverage: ${CODE_COVERAGE}%" 19 | if (( $(echo "$CODE_COVERAGE < $2" | bc) )); then exit 1; fi 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | ⚠️ ⚠️ ⚠️
3 |
4 | This project has been deprecated in favor of Very Good Coverage.
5 |
6 | Please migrate to Very Good Coverage for continued support and improvements.
7 |