From 86b615aa285fb1bac707613e7faf66148cdfc2bd Mon Sep 17 00:00:00 2001 From: Zumi Daxuya Date: Wed, 19 Jun 2024 23:23:16 +0700 Subject: [PATCH] ci: add uncovered lines report to test --- .github/ci/bashcov.dockerfile | 23 +++++++++++++++++++++++ .github/ci/bashcov.sh | 5 +++++ .github/workflows/testing.yml | 6 ++++-- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .github/ci/bashcov.dockerfile create mode 100644 .github/ci/bashcov.sh diff --git a/.github/ci/bashcov.dockerfile b/.github/ci/bashcov.dockerfile new file mode 100644 index 0000000..69d19a3 --- /dev/null +++ b/.github/ci/bashcov.dockerfile @@ -0,0 +1,23 @@ +FROM ruby:latest + +# https://github.com/infertux/bashcov/issues/43#issuecomment-1423015292 + +RUN gem install bashcov simplecov-lcov +RUN useradd -m bashcov + +RUN apt-get update && \ + apt-get install -y libpng-dev pkg-config build-essential bison git curl + +COPY . /rgbenv +WORKDIR /rgbenv +RUN chown -R bashcov:bashcov /rgbenv + +USER bashcov + +RUN make bats +RUN echo "require 'simplecov-lcov'" > .simplecov && \ + echo "SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter" >> .simplecov + +CMD ["bash", ".github/ci/bashcov.sh"] + + diff --git a/.github/ci/bashcov.sh b/.github/ci/bashcov.sh new file mode 100644 index 0000000..69c54dd --- /dev/null +++ b/.github/ci/bashcov.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +bashcov -- /rgbenv/bats/bin/bats tests + +cat coverage/lcov/rgbenv.lcov | grep ",0" diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 6bfdb7f..a925c38 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -23,7 +23,9 @@ jobs: with: path: rgbenv - - name: Run tests - run: make test + - name: Run tests and print lines without coverage + run: | + docker build -t rgbenv-test -f .github/ci/bashcov.dockerfile . + docker run -t --rm rgbenv-test working-directory: rgbenv/