Compare commits

..

No commits in common. "github-ci" and "master" have entirely different histories.

5 changed files with 10 additions and 97 deletions

View File

@ -4,8 +4,11 @@ env:
global: global:
- RACKET_DIR=~/racket - RACKET_DIR=~/racket
matrix: matrix:
- RACKET_VERSION=6.6 - RACKET_VERSION=6.1.1
- RACKET_VERSION=6.7 - RACKET_VERSION=6.2
- RACKET_VERSION=6.2.1
- RACKET_VERSION=6.3
- RACKET_VERSION=6.4
- RACKET_VERSION=HEAD - RACKET_VERSION=HEAD
matrix: matrix:

View File

@ -2,20 +2,19 @@
[![Build Status](https://travis-ci.org/codecov/codecov-racket.svg?branch=master)](https://travis-ci.org/codecov/codecov-racket) [![Build Status](https://travis-ci.org/codecov/codecov-racket.svg?branch=master)](https://travis-ci.org/codecov/codecov-racket)
[![codecov.io](https://codecov.io/github/codecov/codecov-racket/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-racket?branch=master) [![codecov.io](https://codecov.io/github/codecov/codecov-racket/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-racket?branch=master)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-racket.svg?type=shield)](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). Adds [Codecov](https://codecov.io/) support to [Cover](https://github.com/florence/cover).
_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/). _Note_: [Travis CI](https://travis-ci.org/) is currently the only supported method of posting data to [Codecov](https://codecov.io/).
## Use with Travis CI ## Use with TravisCI
First enable your repository on Travis and Codecov. First enable your repository on Travis and Codecov.
Next add `cover-codecov` to the `build-deps` of your `info.rkt`. Next add `cover-codecov` to the `build-deps` of your `info.rkt`.
Then create a `.travis.yml` in the root of your repository. Then create a `.travis.yml` in the root of your repository.
```yml ```yml
# .travis.yml # .travis.yml
language: c langauge: c
sudo: false sudo: false
env: env:
global: global:
@ -34,49 +33,8 @@ script:
- raco test $TRAVIS_BUILD_DIR # run tests. you wrote tests, right? - raco test $TRAVIS_BUILD_DIR # run tests. you wrote tests, right?
after_success: 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 - 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. 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). 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
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-racket.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-racket?ref=badge_large)

View File

@ -11,9 +11,7 @@
net/uri-codec net/uri-codec
cover/private/file-utils cover/private/file-utils
"ci-service.rkt" "ci-service.rkt"
"travis-service.rkt" "travis-service.rkt")
"gitlab-service.rkt"
"github-service.rkt")
(module+ test (module+ test
(require rackunit cover racket/runtime-path)) (require rackunit cover racket/runtime-path))
@ -75,9 +73,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define services (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") (define CODECOV_HOST "codecov.io")

View File

@ -1,21 +0,0 @@
#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")))))

View File

@ -1,23 +0,0 @@
#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")))))