Skip to content

Commit

Permalink
switch CI to GitHub Actions
Browse files Browse the repository at this point in the history
Fixes #301
  • Loading branch information
vtjnash committed Mar 22, 2021
1 parent d762754 commit d8f912d
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 66 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
tags: '*'
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.0'
# - '1'
# - 'nightly'
os:
- ubuntu-latest
arch:
- x64
#include:
# - version: '1'
# os: ubuntu-latest
# arch: x86
# - version: '1'
# os: windows-latest
# arch: x64
# - version: '1'
# os: macos-latest
# arch: x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
# submit coverage data to a black hole server, and collect new coverage data on that
- run: julia --color=yes --project="$GITHUB_WORKSPACE" --code-coverage=user etc/travis-coverage.jl
env:
COVERALLS_TOKEN: token
COVERALLS_URL: https://httpbingo.julialang.org/post
CODECOV_URL: https://httpbingo.julialang.org
CODECOV_URL_PATH: /post
## TODO: submit coverage data *again*, this time without code coverage
#- run: julia --color=yes --project="$GITHUB_WORKSPACE" etc/travis-coverage.jl
# env:
# COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
# COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53 changes: 0 additions & 53 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Coverage.jl
===========

[![Build Status](https://travis-ci.com/JuliaCI/Coverage.jl.svg?branch=master)](https://travis-ci.com/JuliaCI/Coverage.jl)
[![Coverage Status](https://coveralls.io/repos/github/JuliaCI/Coverage.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaCI/Coverage.jl?branch=master)
[![codecov](https://codecov.io/gh/JuliaCI/Coverage.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaCI/Coverage.jl)
[![Build Status](https://github.com/JuliaCI/Coverage.jl/workflows/CI/badge.svg)](https://github.com/JuliaCI/Coverage.jl/actions/workflows/CI.yml?query=branch%3Amaster)
[![coveralls](https://coveralls.io/repos/github/JuliaCI/Coverage.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaCI/Coverage.jl?branch=master)
[![codecov](https://codecov.io/gh/JuliaCI/Coverage.jl/branch/master/graph/badge.svg?label=codecov)](https://codecov.io/gh/JuliaCI/Coverage.jl)

**"Take Julia code coverage and memory allocation results, do useful things with them"**

Expand Down
2 changes: 1 addition & 1 deletion etc/travis-coverage.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Coverage
cov_res = process_folder()
Coveralls.submit(cov_res)
Codecov.submit(cov_res)
Coveralls.submit(cov_res)
3 changes: 0 additions & 3 deletions etc/travis-test.jl

This file was deleted.

23 changes: 17 additions & 6 deletions src/codecovio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ module Codecov
values match the Codecov upload/v2 API specification.
The `codecov_url` keyword argument or the CODECOV_URL environment variable
can be used to specify the base path of the uri.
The `codecov_url_path` keyword argument or the CODECOV_URL_PATH environment variable
can be used to specify the final path of the uri.
The `dry_run` keyword can be used to prevent the http request from
being generated.
"""
Expand All @@ -222,18 +224,20 @@ module Codecov
@debug "Codecov.io API URL:\n" * mask_token(uri_str)

if !dry_run
heads = Dict("Content-Type" => "application/json",
"Accept" => "application/json")
heads = Dict("Content-Type" => "application/json")
data = to_json(fcs)
req = HTTP.post(uri_str; body = JSON.json(data), headers = heads)
@debug "Result of submission:" * String(req)
@debug "Result of submission:" * mask_token(String(req))
end
end

function construct_uri_string(kwargs::Dict)
url = get(ENV, "CODECOV_URL", "")
isempty(url) || (kwargs = set_defaults(kwargs, codecov_url = url))

path = get(ENV, "CODECOV_URL_PATH", "")
isempty(path) || (kwargs = set_defaults(kwargs, codecov_url_path = path))

token = get(ENV, "CODECOV_TOKEN", "")
isempty(token) || (kwargs = set_defaults(kwargs, token = token))

Expand All @@ -244,15 +248,22 @@ module Codecov
isempty(name) || (kwargs = set_defaults(kwargs; name = name))

codecov_url = get(kwargs, :codecov_url, "https://codecov.io")
codecov_url[end] == "/" && error("the codecov_url should not end with a /, given url $(repr(codecov_url))")
if isempty(codecov_url) || codecov_url[end] == '/'
error("the codecov_url should not end with a /, given url $(repr(codecov_url))")
end

codecov_url_path = get(kwargs, :codecov_url_path, "/upload/v2")
if isempty(codecov_url_path) || codecov_url_path[1] != '/' || codecov_url_path[end] == '/'
error("the codecov_url_path should begin with, but not end with, a /, given url $(repr(codecov_url_path))")
end

uri_str = "$(codecov_url)/upload/v2?"
uri_str = "$(codecov_url)$(codecov_url_path)?"
for (k, v) in kwargs
# add all except a few special key/value pairs to the URL
# (:verbose is there for backwards compatibility with versions
# of this code that treated it in a special way)
if k != :codecov_url && k != :dry_run && k != :verbose
uri_str = "$(uri_str)&$(k)=$(v)"
uri_str = "$(uri_str)$(k)=$(v)&"
end
end

Expand Down
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ withenv(
"COVERALLS_TOKEN" => "token_name_1",
"COVERALLS_URL" => nothing,
"CODECOV_URL" => nothing,
"CODECOV_URL_PATH" => nothing,
"CODECOV_TOKEN" => nothing,
"CODECOV_NAME" => nothing,
"CODECOV_FLAGS" => nothing,
Expand All @@ -35,6 +36,14 @@ withenv(
"APPVEYOR_BUILD_NUMBER" => nothing,
"APPVEYOR_BUILD_ID" => nothing,
"APPVEYOR_JOB_ID" => nothing,
"GITHUB_ACTION" => nothing,
"GITHUB_EVENT_PATH" => nothing,
"GITHUB_HEAD_REF" => nothing,
"GITHUB_REF" => nothing,
"GITHUB_REPOSITORY" => nothing,
"GITHUB_RUN_ID" => nothing,
"GITHUB_SHA" => nothing,
"service_job_id" => nothing,
"JENKINS" => nothing,
"BUILD_ID" => nothing,
"CI_PULL_REQUEST" => nothing,
Expand Down

0 comments on commit d8f912d

Please sign in to comment.