kennytm / cargo-kcov

Cargo subcommand to run kcov to get coverage report on Linux
127 stars 20 forks source link

Make GitHub api usage more resilient to error #34

Closed macisamuele closed 5 years ago

macisamuele commented 5 years ago

I'm recently having build failures (check jsonschema-validator travis build) due to failures in downloading and building kcov.

The issue is caused by GitHub API limit from travis IP addresses

{
  "message": "API rate limit exceeded for 35.192.136.167. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
  "documentation_url": "https://developer.github.com/v3/#rate-limiting"
}

The goal of this PR is to make the detection of the latest more resilient to API limiting issues.

I manually verified that this works by maning sure that I hit the rate limiting from my IP addresses and testing out the different steps

✔ ~/pg/github/cargo-kcov [maci-make-github-api-usage-more-resilient L|✔]
19:09 $ KCOV_DEFAULT_VERSION="DEFAULT_VALUE"
✔ ~/pg/github/cargo-kcov [maci-make-github-api-usage-more-resilient L|✔]
19:10 $ GITHUB_KCOV="https://api.github.com/repos/SimonKagstrom/kcov/releases/latest"
✔ ~/pg/github/cargo-kcov [maci-make-github-api-usage-more-resilient L|✔]
19:10 $ KCOV_VERSION=$(curl --silent --show-error --fail ${GITHUB_KCOV} | jq -Mr .tag_name || echo)
curl: (22) The requested URL returned error: 403 Forbidden
✔ ~/pg/github/cargo-kcov [maci-make-github-api-usage-more-resilient L|✔]
19:10 $ KCOV_VERSION=${KCOV_VERSION:-$KCOV_DEFAULT_VERSION}
✔ ~/pg/github/cargo-kcov [maci-make-github-api-usage-more-resilient L|✔]
19:10 $ echo ${KCOV_VERSION}
DEFAULT_VALUE
✔ ~/pg/github/cargo-kcov [maci-make-github-api-usage-more-resilient L|✔]
19:10 $

FYI: @kennytm

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.1%) to 37.345% when pulling e04a833d30f3ab1879a88cb3537b701b7216ec1c on macisamuele:maci-make-github-api-usage-more-resilient into edd912d48184c3928f0bb6bc4a88b0edef10df6a on kennytm:master.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.1%) to 37.345% when pulling e04a833d30f3ab1879a88cb3537b701b7216ec1c on macisamuele:maci-make-github-api-usage-more-resilient into edd912d48184c3928f0bb6bc4a88b0edef10df6a on kennytm:master.