Git Product home page Git Product logo

luacov-coveralls's Introduction

luacov-coveralls

Licence

LuaCov reporter for coveralls.io service.

Currently support

Also luacov-coveralls has code which support some other CI but I never test them. If you can test it please do that and send PR.

Install

luarocks install luacov-coveralls

To install current master use this command

luarocks install luacov-coveralls --server=http://rocks.moonscript.org/dev

Usage

  • Run tests with enabled LuaCov
  • Run luacov-coveralls

Command line arguments

luacov-coveralls [-h] [-v] [-c FILE] [-j FILE] [-e PAT] [-i PAT]
                 [-r DIR] [-t TOKEN] [-o FILE] [--dryrun]

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         print verbose messages
  -c FILE, --config FILE
                        configuration file
  -o FILE, --output FILE
                        output file
  -j FILE, --json FILE  merge report with this json report
  -m, --merge           merge statistics for files with same name
  -r DIR, --root DIR    set the root directory
  -e PAT, --exclude PAT set exclude pattern
  -i PAT, --include PAT set include pattern
  -s NAME, --service-name NAME
                        set `service_name` field explicitly
  -b [+-]VALUE, --build-number [+-]VALUE
                        set/change `service_number` field explicitly
  -t TOKEN, --repo-token TOKEN
                        set the repo_token of this project
  --dryrun              run coveralls without uploading report

Note! --build-number option is experimental.

Basic usage .travis.yml

before_install:
  - sudo luarocks install luacov-coveralls

script:
  - lua -lluacov test.lua

after_success:
  - luacov-coveralls

Advanced usage .travis.yml

If you're using a containerized version of luacov-coveralls you must repass all the required environment variables, here's a simple example:

.travis.yml

language: lua

services:
  - docker
dist: trusty

env:
  COMPOSE_VERSION: 18.06

install: docker-compose build test

script: docker-compose run --rm test

after_success: docker-compose run --rm coverage

after_script: docker-compose down

docker-compose.yml

version: '2.1'

services:
  test:
    command: busted -c
    environment:
      - TRAVIS=true
      - CI=true
      - COVERALLS_REPO_TOKEN=${COVERALLS_REPO_TOKEN}
      - TRAVIS_JOB_ID=${TRAVIS_JOB_ID}
      - TRAVIS_BRANCH=${TRAVIS_BRANCH}
      - TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}
    build:
      context: .
      dockerfile: Dockerfile.test
    volumes:
      - ".:/lua/"
    working_dir: "/lua"

  coverage:
    command: luacov-coveralls -v
    environment:
      - TRAVIS=true
      - CI=true
      - COVERALLS_REPO_TOKEN=${COVERALLS_REPO_TOKEN}
      - TRAVIS_JOB_ID=${TRAVIS_JOB_ID}
      - TRAVIS_BRANCH=${TRAVIS_BRANCH}
      - TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}
    build:
      context: .
      dockerfile: Dockerfile.test
    volumes:
      - ".:/lua/"
    working_dir: "/lua"

Test Lua module written on Lua and C using cpp-coveralls

before_install:
  - sudo pip install cpp-coveralls
  - sudo luarocks install luacov-coveralls

script:
  - lua -lluacov test.lua

after_success:
  - coveralls --dump c.report.json
  - luacov-coveralls -j c.report.json

See lua-travis-example

luacov-coveralls's People

Contributors

alerque avatar blueyed avatar fperrad avatar leandromoreira avatar moteus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

luacov-coveralls's Issues

Add support for Github Actions CI

It's possible to run CI jobs in Github Actions now. I'm able to run my test suite using busted and run this script, but it doesn't seem to know what's what. Build in support for matching up build numbers and aggregating results, understanding PRs, etc. would be nice.

Test on supported CIs

I am aware of the Travis example and of course my own Actions example. I assume there are others. But...

I would suggest setting this repository up with CI configs for as many different systems as possible and actually dog-food the code. This would do three things at once:

  • Test this repository's code
  • Show coverage data on this repos code that serves as an demonstration
  • Provide sample code for how to set it up on various CIs

Coveralls fails to show files

First of all, thank you for this plugin! Integrating Coveralls support for LuaRocks+Travis CI was a breeze!

I just noticed something strange. When I click on a filename, Coveralls gives me an error message:

https://coveralls.io/builds/2294176/source?filename=%2Fhome%2Ftravis%2Fbuild%2Fkeplerproject%2Fluarocks%2Fsrc%2Fluarocks%2Ftools%2Fpatch.lua

"Source Not Available"
The file "/home/travis/build/keplerproject/luarocks/src/luarocks/tools/patch.lua" isn't available on GitHub.
Either it's been removed, or the repo root directory needs to be updated.

Perhaps the prefix "/home/travis/build/keplerproject/luarocks/" should be stripped out of the pathnames when sending the data to coveralls.io? I wonder if the plugin could do this automatically.

Upload fails with LuaJIT compat52

Something goes wrong with a LuaJIT with Lua 5.2 compatibility mode.

LuaJIT 2.0.4 built with -DLUAJIT_ENABLE_LUA52COMPAT (see full log https://travis-ci.org/fperrad/lua-TestMore/jobs/210941900)

Upload error:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 31380  100    66  100 31314    148  70494 --:--:-- --:--:-- --:--:-- 78481

Upload error:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 31380  100    66  100 31314    200  95156 --:--:-- --:--:-- --:--:-- 96350

Upload error:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 31380  100    66  100 31314    238   110k --:--:-- --:--:-- --:--:--  111k

Without LUAJIT_ENABLE_LUA52COMPAT that works fine (see full log https://travis-ci.org/fperrad/lua-TestMore/jobs/210941897).

Uploaded Job #88.7 to https://coveralls.io/jobs/23829992

Same issue with LuaJIT 2.1.0-beta2 (Job 88.10)

bugs in version 0.2.0

Following on from #1

This build/job looks ok. May be it was glitch in coveralls service.

I removed recent reports from coveralls, reauthorize coveralls on GitHub. Then in several hours the empty reports have been filling themselves.

I tried again npge/lua-npge#20 (with luacov-coveralls 0.2.0 and dkjson).

It produced two coveralls reports:

  • 332, Travis, empty coverage;
  • 140, AppVeyor, unbound from the pull request.

Both reports have problems, so coveralls did not report the coverage to GitHub ("Waiting for status to be reported").

luacov-coveralls will use cjson if it can find it. so you can just install it.

Can you always use dkjson, please? More options, more bugs...

Could you please try again 2.0 with dkjson and with cjson.

I have just committed npge/lua-npge@fd3ec1e (install lua-cjson in Travis before luacov-coveralls):

  • 333, Travis, good.
  • 141, AppVeyor, similar to 140.

Add release that supports Github Actions

Github Actions has been supported in HEAD for a long time now but it's inconvenient to use for new projects because there is no stable release that supports it. Can you please tag and post an update on Luarocks?

Error Couldn't find a repository matching this job

How can I inform my repository?

Build: https://travis-ci.org/leandromoreira/nginx-lua-redis-rate-measuring/builds/487421925?utm_source=github_status&utm_medium=notification

TravisCI: https://github.com/leandromoreira/nginx-lua-redis-rate-measuring/blob/master/.travis.yml

docker-compose command: https://github.com/leandromoreira/nginx-lua-redis-rate-measuring/blob/add-coverage/docker-compose.yml#L27

CI: 
  name            : <UNKNOWN>
  branch          : <UNKNOWN>
  service_number  : <UNKNOWN>
  pull_request    : <UNKNOWN>
  job_id          : <UNKNOWN>
  commit_id       : <UNKNOWN>
  author_name     : <UNKNOWN>
  author_email    : <UNKNOWN>
  committer_name  : <UNKNOWN>
  committer_email : <UNKNOWN>
  message         : <UNKNOWN>
  token           : <NOT DETECTED>
Repository: 
  type            : git
  path            : /lua
  version         : git version 2.7.4
  id              : fff11ee973f54041e3ea318d016667819f55ba58
  author_name     : Leandro Moreira
  author_email    : [email protected]
  committer_name  : GitHub
  committer_email : [email protected]
  message         : Merge 068cb3dac220ce516aaef9bba2825b4a0c0c6583 into 51c1ddf4f0d1cb9187bb7f983dbf16d1ea6bf957
  current_branch  : HEAD
File './src/resty-redis-rate.lua'
Lines executed:91.30% of 23
--------------------
service_name         : 
repo_token           : <NOT DETECTED>
service_number       : 
service_job_id       : 
service_pull_request : 
source_files         : 1
  ./src/resty-redis-rate.lua
git
  head
    id             : fff11ee973f54041e3ea318d016667819f55ba58
    author_name    : Leandro Moreira
    author_email   : [email protected]
    committer_name : GitHub
    committer_email: [email protected]
    message        : Merge 068cb3dac220ce516aaef9bba2825b4a0c0c6583 into 51c1ddf4f0d1cb9187bb7f983dbf16d1ea6bf957
  branch           : HEAD
  remotes
    origin https://github.com/leandromoreira/nginx-lua-redis-rate-measuring.git 
--------------------
Uploading ...
Upload error: Couldn't find a repository matching this job.
Raw data:	Couldn't find a repository matching this job.
--------------------
Upload error: Couldn't find a repository matching this job.
Raw data:	Couldn't find a repository matching this job.
--------------------
Upload error: Couldn't find a repository matching this job.
Raw data:	Couldn't find a repository matching this job.
--------------------

Tweak Github Actions support to match official app

The official Coveralals app for Github Actions (not useful for Lua, but great otherwise) uses an internal parameter github-token as the identifier instead of having to pass a custom secret token.

See related upstream issue here.

We should update the support here to do the same thing.

  • Use github as the action name
  • Drop the custom token handling and pass github-token

Error when used with AppVeyor

I'm trying to set up Penlight to collect the WIndows coverage statistics, but I'm running into an error

This is the configuration:

shallow_clone: true

environment:
  matrix:
  - LUA: "lua 5.1"
  - LUA: "lua 5.2"
  - LUA: "lua 5.3"
  - LUA: "luajit 2.0"
  - LUA: "luajit 2.0 --compat 5.2"
  - LUA: "luajit 2.1"
  - LUA: "luajit 2.1 --compat 5.2"

before_build:
  - set PATH=C:\Python27\Scripts;%PATH%
  - pip install hererocks
  - hererocks here --%LUA% -rlatest
  - call here\bin\activate
  - luarocks install luacov-coveralls

build_script:
  - luarocks make

test_script:
  - lua run.lua tests --luacov

on_success:
  - luacov-coveralls

and this is the error I'm getting:

Running tests\test-types.lua
Running tests\test-tzone.lua
Running tests\test-url.lua
Running tests\test-utils.lua
Running tests\test-vector.lua
Running tests\test-xml.lua
Run completed successfully
luacov-coveralls
C:\projects\penlight\here\bin\lua.exe: ...ht\here\/share/lua/5.1/luacov\coveralls\repo\git.lua:57: attempt to call field 'fullpath' (a nil value)
stack traceback:
	...ht\here\/share/lua/5.1/luacov\coveralls\repo\git.lua:57: in function 'new'
	...ight\here\/share/lua/5.1/luacov\coveralls\CiRepo.lua:7: in function 'try_any_repo'
	...ight\here\/share/lua/5.1/luacov\coveralls\CiRepo.lua:22: in function 'new'
	...ht\here\/share/lua/5.1/luacov\reporter\coveralls.lua:66: in function 'new'
	...cts\penlight\here\/share/lua/5.1/luacov\reporter.lua:388: in function <...cts\penlight\here\/share/lua/5.1/luacov\reporter.lua:383>
	(tail call): ?
	...\rocks\luacov-coveralls\0.2.2-1\bin\luacov-coveralls:160: in main chunk
	[C]: ?
Command exited with code 1

Any ideas how to fix this?

EDIT: the PR showing the behaviour lunarmodules/Penlight#281

Invalid error report

Hi,

See this build (among others): https://travis-ci.org/thibaultcha/lua-resty-jit-uuid/builds/191860140

It seems it is encountering an error uploading the JSON file, but all 3 times, it seems we are printing the curl stdout instead of an actual error:

Uploading ...

Upload error:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 16190  100    66  100 16124    111  27257 --:--:-- --:--:-- --:--:-- 31677

Raw data:	  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 16190  100    66  100 16124    111  27257 --:--:-- --:--:-- --:--:-- 31677

--------------------

Upload error:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 16190  100    66  100 16124     98  24170 --:--:-- --:--:-- --:--:-- 24246

Raw data:	  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 16190  100    66  100 16124     98  24170 --:--:-- --:--:-- --:--:-- 24246

--------------------

Upload error:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 16190  100    66  100 16124    183  44885 --:--:-- --:--:-- --:--:-- 45292

Raw data:	  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 16190  100    66  100 16124    183  44885 --:--:-- --:--:-- --:--:-- 45292

--------------------

Uploading done

Maybe we could handle such a case properly and report the actual error, so then I could start working on fixing what's wrong with this build. This happened out of the blue on 0.2.1, so I am unsure how to actually reproduce it, sorry.

Support for Drone.io

I've been using luacov-coveralls without any trouble on Drone.io.

It's pretty straightfoward:

  • Install luacov and luacov-coveralls as part of the build process.
  • Add COVERALLS_REPO_TOKEN=<TOKEN> to your repo's Settings under Environment Variables.
  • Call luacov-coveralls -t "$COVERALLS_REPO_TOKEN" at the end of the build.

I'm wondering what else you might want to do to test Drone.io builds and whether you'd accept a pull request to add these instructions to the README.

Thanks.

Is there a way to use parallel builds?

I want to use parallel build for Coveralls with luacov-coveralls. Is it work?
Coveralls documentation says that it's enough to set env variable COVERALLS_PARALLEL, but I think special support for luacov-coveralls is required.

Pathcorrect doesn't merge coverage

Hi,

I'm in the process of adding coverage testing to awesome. Thanks for writing this code!
However, due to $REASONS there are two kind of tests in awesome. One of them runs through busted and ends up with absolute paths to the Lua source files while the other one has relative paths. With pathcorrect the paths end up correctly in the end, but LuaCov/Coveralls still counts these as two different files.

For an example look at https://coveralls.io/jobs/11825631 and search for files with "sort" in their name. Two instances of lib/gears/sort.lua will be found and they have different coverage.

Is there a sane way to have these duplicate files merged?

Thanks!

How to use it with Github Actions

Hi, I want to use this with my Github CI build. I get repo-token from coveralls that I kept in my environment secrets.
But the buid is failing giving the following error:

/usr/bin/lua5.1: .../rocks/luacov-coveralls/0.2.3-1/bin/luacov-coveralls:64: assertion failed!
stack traceback:
	[C]: in function 'assert'
	.../rocks/luacov-coveralls/0.2.3-1/bin/luacov-coveralls:64: in function 'read_key'
	.../rocks/luacov-coveralls/0.2.3-1/bin/luacov-coveralls:93: in main chunk
	[C]: ?

Here is the link to the build workflow:- https://github.com/devkapilbansal/openwrt-openwisp-monitoring/runs/3045353380?check_suite_focus=true

Can you please provide instructions in README for github actions too similar to travis?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.