Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
db0bb496d2 | ||
![]() |
97cb67e184 | ||
![]() |
88b9b22511 | ||
![]() |
50388b3607 | ||
![]() |
53db586642 | ||
![]() |
a08e68f5ac | ||
![]() |
e93ee24d11 | ||
![]() |
68ff79258f | ||
![]() |
a227aa8c8a |
|
@ -4,11 +4,8 @@ env:
|
|||
global:
|
||||
- RACKET_DIR=~/racket
|
||||
matrix:
|
||||
- RACKET_VERSION=6.1.1
|
||||
- RACKET_VERSION=6.2
|
||||
- RACKET_VERSION=6.2.1
|
||||
- RACKET_VERSION=6.3
|
||||
- RACKET_VERSION=6.4
|
||||
- RACKET_VERSION=6.6
|
||||
- RACKET_VERSION=6.7
|
||||
- RACKET_VERSION=HEAD
|
||||
|
||||
matrix:
|
||||
|
|
48
README.md
48
README.md
|
@ -2,19 +2,20 @@
|
|||
|
||||
[](https://travis-ci.org/codecov/codecov-racket)
|
||||
[](https://codecov.io/github/codecov/codecov-racket?branch=master)
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-racket?ref=badge_shield)
|
||||
|
||||
Adds [Codecov](https://codecov.io/) support to [Cover](https://github.com/florence/cover).
|
||||
|
||||
_Note_: [Travis CI](https://travis-ci.org/) is currently the only supported method of posting data to [Codecov](https://codecov.io/).
|
||||
_Note_: The currently supported methods of posting data to [Codecov](https://codecov.io/) are [Travis CI](https://travis-ci.org/) and [Gitlab CI](https://about.gitlab.com/gitlab-ci/).
|
||||
|
||||
## Use with TravisCI
|
||||
## Use with Travis CI
|
||||
First enable your repository on Travis and Codecov.
|
||||
Next add `cover-codecov` to the `build-deps` of your `info.rkt`.
|
||||
Then create a `.travis.yml` in the root of your repository.
|
||||
|
||||
```yml
|
||||
# .travis.yml
|
||||
langauge: c
|
||||
language: c
|
||||
sudo: false
|
||||
env:
|
||||
global:
|
||||
|
@ -33,8 +34,49 @@ script:
|
|||
- raco test $TRAVIS_BUILD_DIR # run tests. you wrote tests, right?
|
||||
|
||||
after_success:
|
||||
- raco pkg install --deps search-auto cover cover-codecov
|
||||
- raco cover -f codecov -d $TRAVIS_BUILD_DIR/coverage . # generate coverage information for coveralls
|
||||
```
|
||||
The above Travis configuration will install any project dependencies, test your project, and report coverage information to Codecov.
|
||||
|
||||
For additional Travis configuration information look at [Travis Racket](https://github.com/greghendershott/travis-racket).
|
||||
|
||||
## Use with Gitlab-CI
|
||||
Like with Travis, except that you should use the Gitlab format
|
||||
of the CI configuration file:
|
||||
|
||||
```yml
|
||||
image: frolvlad/alpine-glibc
|
||||
|
||||
variables:
|
||||
RACKET_DIR: "$HOME/racket"
|
||||
RACKET_VERSION: "6.8" # use the desired version of racket
|
||||
|
||||
before_script:
|
||||
- echo "ipv6" >> /etc/modules
|
||||
- apk update
|
||||
- apk add git curl bash openssl sqlite-libs
|
||||
- git clone https://github.com/greghendershott/travis-racket.git ~/ci-racket
|
||||
- cat ~/ci-racket/install-racket.sh | bash # pipe to bash not sh!
|
||||
- export PATH="$RACKET_DIR/bin:$PATH" #install-racket.sh can't set for us
|
||||
- raco pkg install --auto $CI_PROJECT_DIR
|
||||
|
||||
stages:
|
||||
- test
|
||||
- cover
|
||||
|
||||
test:
|
||||
stage: test
|
||||
script:
|
||||
- raco test $CI_PROJECT_DIR
|
||||
|
||||
cover:
|
||||
stage: cover
|
||||
script:
|
||||
- raco pkg install --auto cover cover-codecov
|
||||
- raco cover -f codecov $CI_PROJECT_DIR
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-racket?ref=badge_large)
|
|
@ -11,7 +11,9 @@
|
|||
net/uri-codec
|
||||
cover/private/file-utils
|
||||
"ci-service.rkt"
|
||||
"travis-service.rkt")
|
||||
"travis-service.rkt"
|
||||
"gitlab-service.rkt"
|
||||
"github-service.rkt")
|
||||
|
||||
(module+ test
|
||||
(require rackunit cover racket/runtime-path))
|
||||
|
@ -73,7 +75,9 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define services
|
||||
(hash travis-ci? travis-service@))
|
||||
(hash travis-ci? travis-service@
|
||||
gitlab-ci? gitlab-service@
|
||||
github-ci? github-service@))
|
||||
|
||||
(define CODECOV_HOST "codecov.io")
|
||||
|
||||
|
|
21
cover/private/github-service.rkt
Normal file
21
cover/private/github-service.rkt
Normal file
|
@ -0,0 +1,21 @@
|
|||
#lang racket/base
|
||||
(provide github-service@ github-ci?)
|
||||
|
||||
(require "ci-service.rkt" racket/unit racket/list racket/string)
|
||||
|
||||
(define (github-ci?) (and (getenv "GITHUB_REPOSITORY") (getenv "CODECOV_TOKEN")))
|
||||
|
||||
(define-unit github-service@
|
||||
(import)
|
||||
(export ci-service^)
|
||||
|
||||
(define (query)
|
||||
(define repo-slug (getenv "GITHUB_REPOSITORY"))
|
||||
(list (cons 'service "custom")
|
||||
(cons 'token (getenv "CODECOV_TOKEN"))
|
||||
;; TODO: this won't work for tags
|
||||
(cons 'branch (string-trim (getenv "GITHUB_REF") #px"refs/(heads|tags)/"))
|
||||
(cons 'job (getenv "GITHUB_JOB"))
|
||||
(cons 'slug (getenv "GITHUB_REPOSITORY"))
|
||||
(cons 'build (getenv "GITHUB_RUN_ID"))
|
||||
(cons 'commit (getenv "GITHUB_SHA")))))
|
23
cover/private/gitlab-service.rkt
Normal file
23
cover/private/gitlab-service.rkt
Normal file
|
@ -0,0 +1,23 @@
|
|||
#lang racket/base
|
||||
(provide gitlab-service@ gitlab-ci?)
|
||||
|
||||
(require "ci-service.rkt" racket/unit racket/list racket/string)
|
||||
|
||||
(define (gitlab-ci?) (and (getenv "CI") (getenv "GITLAB_CI")))
|
||||
|
||||
(define-unit gitlab-service@
|
||||
(import)
|
||||
(export ci-service^)
|
||||
|
||||
(define (query)
|
||||
(define project-url (getenv "CI_PROJECT_URL"))
|
||||
(define branch (getenv "CI_BUILD_REF_NAME"))
|
||||
(list (cons 'service "gitlab")
|
||||
(cons 'token (getenv "CODECOV_TOKEN"))
|
||||
(cons 'branch branch)
|
||||
(cons 'job (getenv "CI_PIPELINE_ID"))
|
||||
(cons 'slug (getenv "CI_PROJECT_PATH"))
|
||||
(cons 'tag (getenv "CI_BUILD_TAG"))
|
||||
(cons 'build (getenv "CI_BUILD_ID"))
|
||||
(cons 'build_url (and project-url branch (format "~a/tree/~a" project-url branch)))
|
||||
(cons 'commit (getenv "CI_BUILD_REF")))))
|
Loading…
Reference in New Issue
Block a user