Trying to add github service

This commit is contained in:
Suzanne Soy 2021-07-28 17:10:40 +01:00
parent 50388b3607
commit 88b9b22511
2 changed files with 25 additions and 2 deletions

View File

@ -12,7 +12,8 @@
cover/private/file-utils
"ci-service.rkt"
"travis-service.rkt"
"gitlab-service.rkt")
"gitlab-service.rkt"
"github-service.rkt")
(module+ test
(require rackunit cover racket/runtime-path))
@ -75,7 +76,8 @@
(define services
(hash travis-ci? travis-service@
gitlab-ci? gitlab-service@))
gitlab-ci? gitlab-service@
github-ci? github-service@))
(define CODECOV_HOST "codecov.io")

View 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")))))