Add support for Gitlab-CI
This commit is contained in:
parent
68ff79258f
commit
e93ee24d11
38
README.md
38
README.md
|
@ -5,16 +5,16 @@
|
||||||
|
|
||||||
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_: [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.
|
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
|
||||||
langauge: c
|
language: c
|
||||||
sudo: false
|
sudo: false
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
@ -39,3 +39,35 @@ after_success:
|
||||||
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
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
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")
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(require rackunit cover racket/runtime-path))
|
(require rackunit cover racket/runtime-path))
|
||||||
|
@ -73,7 +74,8 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(define services
|
(define services
|
||||||
(hash travis-ci? travis-service@))
|
(hash travis-ci? travis-service@
|
||||||
|
gitlab-ci? gitlab-service@))
|
||||||
|
|
||||||
(define CODECOV_HOST "codecov.io")
|
(define CODECOV_HOST "codecov.io")
|
||||||
|
|
||||||
|
|
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