From b5910bbd09558689506cc5f10df5ed96ae0cce86 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Mon, 22 Mar 2021 14:43:16 -0400 Subject: [PATCH] switch CI to GitHub Actions --- .github/workflows/CI.yml | 55 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 53 -------------------------------------- README.md | 6 ++--- etc/travis-coverage.jl | 2 +- etc/travis-test.jl | 3 --- src/codecovio.jl | 23 ++++++++++++----- test/runtests.jl | 9 +++++++ 7 files changed, 85 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/CI.yml delete mode 100644 .travis.yml delete mode 100644 etc/travis-test.jl diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..5a4237e --- /dev/null +++ b/.github/workflows/CI.yml @@ -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 with a fake job-id, + # 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 + # 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 }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 383282c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,53 +0,0 @@ -branches: - only: - - master - - /^release\/.*$/ # release branches - - /^v[0-9]+\.[0-9]+\.[0-9]+$/ # version tags - -language: julia - -os: - - linux - - osx - - windows - -arch: - - amd64 - - i386 - -julia: - - "1.0" - - "1" # Latest stable release (currently "1.5") - - nightly - -jobs: - fast_finish: true - allow_failures: - - julia: nightly - - exclude: - # Test 32-bit only on Linux - - arch: i386 - os: osx - - arch: i386 - os: windows - # Test fewer versions too - - julia: "1.0" - os: osx - - julia: nightly - os: osx - - julia: "1.0" - os: windows - -notifications: - webhooks: https://coveralls.io/webhook - email: false - -script: - - julia --color=yes --check-bounds=yes etc/travis-test.jl - # submit coverage data to a black hole server with a fake job-id, - # and collect new coverage data on that - - COVERALLS_URL=https://httpbingo.julialang.org/post - julia --color=yes --code-coverage=user etc/travis-coverage.jl - # submit coverage data *again*, this time without code coverage - - julia --color=yes etc/travis-coverage.jl diff --git a/README.md b/README.md index 00f0732..684d7d3 100644 --- a/README.md +++ b/README.md @@ -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"** diff --git a/etc/travis-coverage.jl b/etc/travis-coverage.jl index 84d80da..a552915 100644 --- a/etc/travis-coverage.jl +++ b/etc/travis-coverage.jl @@ -1,4 +1,4 @@ using Coverage cov_res = process_folder() -Coveralls.submit(cov_res) Codecov.submit(cov_res) +Coveralls.submit(cov_res) diff --git a/etc/travis-test.jl b/etc/travis-test.jl deleted file mode 100644 index 77ba437..0000000 --- a/etc/travis-test.jl +++ /dev/null @@ -1,3 +0,0 @@ -using Pkg -Pkg.build() -Pkg.test("Coverage"; coverage=true) diff --git a/src/codecovio.jl b/src/codecovio.jl index 5e3f03e..a28496d 100644 --- a/src/codecovio.jl +++ b/src/codecovio.jl @@ -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. """ @@ -222,11 +224,10 @@ 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 @@ -234,6 +235,9 @@ module Codecov 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)) @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index 61aa8c8..1b4ede7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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, @@ -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,