Trying to add github service
This commit is contained in:
parent
50388b3607
commit
88b9b22511
|
@ -12,7 +12,8 @@
|
||||||
cover/private/file-utils
|
cover/private/file-utils
|
||||||
"ci-service.rkt"
|
"ci-service.rkt"
|
||||||
"travis-service.rkt"
|
"travis-service.rkt"
|
||||||
"gitlab-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,7 +76,8 @@
|
||||||
|
|
||||||
(define services
|
(define services
|
||||||
(hash travis-ci? travis-service@
|
(hash travis-ci? travis-service@
|
||||||
gitlab-ci? gitlab-service@))
|
gitlab-ci? gitlab-service@
|
||||||
|
github-ci? github-service@))
|
||||||
|
|
||||||
(define CODECOV_HOST "codecov.io")
|
(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-env?)
|
||||||
|
|
||||||
|
(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 (substring (getenv "GITHUB_REF") (string-length "refs/heads/")))
|
||||||
|
(cons 'job (getenv "GITHUB_JOB"))
|
||||||
|
(cons 'slug (getenv "GITHUB_REPOSITORY"))
|
||||||
|
(cons 'build (getenv "GITHUB_RUN_ID"))
|
||||||
|
(cons 'commit (getenv "GITHUB_SHA")))))
|
Loading…
Reference in New Issue
Block a user