Add bazel logs upload to GHA (#13251)

This commit is contained in:
Simon Mo 2021-01-13 15:17:11 -08:00 committed by GitHub
parent 15501a4151
commit b257cb7d98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 8 deletions

View file

@ -94,6 +94,17 @@ jobs:
. ./ci/travis/ci.sh test_python
. ./ci/travis/ci.sh test_core
. ./ci/travis/ci.sh test_wheels
- name: Upload test result
if: github.repository == 'ray-project/ray' && github.event_name != 'pull_request'
shell: bash -e -o pipefail -l {0}
env:
# TODO: upload this secret to github
BAZEL_LOG_BUCKET_ACCESS_KEY: ${{ secrets.BAZEL_LOG_BUCKET_ACCESS_KEY }}
TRAVIS_BRANCH: ${{ github.ref }}
TRAVIS_COMMIT: ${{ github.sha }}
TRAVIS_JOB_ID: ${{ github.run_id }}
run: |
./ci/travis/upload_build_info.sh
- name: Run Clang Include-What-You-Use
continue-on-error: true
if: runner.os == 'Linux'

View file

@ -128,7 +128,8 @@ test_core() {
)
;;
esac
bazel test --config=ci --build_tests_only -- "${args[@]}"
# shellcheck disable=SC2046
bazel test --config=ci --build_tests_only $(./scripts/bazel_export_options) -- "${args[@]}"
}
test_python() {
@ -168,7 +169,8 @@ test_python() {
# It's unclear to me if this should be necessary, but this is to make tests run for now.
# Check why this issue doesn't arise on Linux/Mac.
# Ideally importing ray.cloudpickle should import pickle5 automatically.
bazel test --config=ci --build_tests_only \
# shellcheck disable=SC2046
bazel test --config=ci --build_tests_only $(./scripts/bazel_export_options) \
--test_env=PYTHONPATH="${PYTHONPATH-}${pathsep}${WORKSPACE_DIR}/python/ray/pickle5_files" -- \
"${args[@]}";
fi
@ -176,7 +178,8 @@ test_python() {
test_cpp() {
bazel build --config=ci //cpp:all
bazel test --config=ci //cpp:all --build_tests_only
# shellcheck disable=SC2046
bazel test --config=ci $(./scripts/bazel_export_options) //cpp:all --build_tests_only
}
test_wheels() {

View file

@ -16,17 +16,46 @@ import json
import requests
def gha_get_self_url():
# stringed together api call to get the current check's html url.
sha = os.environ["GITHUB_SHA"]
repo = os.environ["GITHUB_REPOSITORY"]
resp = requests.get(
"https://api.github.com/repos/{}/commits/{}/check-suites".format(
repo, sha))
data = resp.json()
for check in data["check_suites"]:
slug = check["app"]["slug"]
if slug == "github-actions":
run_url = check["check_runs_url"]
html_url = (
requests.get(run_url).json()["check_runs"][0]["html_url"])
return html_url
# Return a fallback url
return "https://github.com/ray-project/ray/actions"
def get_build_env():
if os.environ.get("GITHUB_ACTION"):
return {
"TRAVIS_COMMIT": os.environ["GITHUB_SHA"],
"TRAVIS_JOB_WEB_URL": gha_get_self_url(),
"TRAVIS_OS_NAME": "windows",
}
keys = [
"TRAVIS_BRANCH", "TRAVIS_BUILD_ID", "TRAVIS_BUILD_NUMBER",
"TRAVIS_BUILD_WEB_URL", "TRAVIS_COMMIT", "TRAVIS_COMMIT_MESSAGE",
"TRAVIS_DIST", "TRAVIS_JOB_ID", "TRAVIS_JOB_NUMBER",
"TRAVIS_JOB_WEB_URL", "TRAVIS_OS_NAME", "TRAVIS_TEST_RESULT"
"TRAVIS_COMMIT",
"TRAVIS_JOB_WEB_URL",
"TRAVIS_OS_NAME",
]
return {key: os.environ.get(key) for key in keys}
def get_build_config():
if os.environ.get("GITHUB_ACTION"):
return {"config": {"env": "Windows CI"}}
url = "https://api.travis-ci.com/job/{job_id}?include=job.config"
url = url.format(job_id=os.environ["TRAVIS_JOB_ID"])
resp = requests.get(url, headers={"Travis-API-Version": "3"})

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Cause the script to exit if a single command fails.
set -e
set -ex
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
RAY_DIR=$(cd "${ROOT_DIR}/../../"; pwd)
@ -13,6 +13,9 @@ mkdir -p /tmp/bazel_event_logs
pip install -q awscli
# Strip the leading "refs/heads/" in the posssible branch tag
TRAVIS_BRANCH=${TRAVIS_BRANCH/refs\/heads\//}
export AWS_ACCESS_KEY_ID=AKIAQQPDA73RF7PSLH5N
export AWS_SECRET_ACCESS_KEY=${BAZEL_LOG_BUCKET_ACCESS_KEY}
export AWS_DEFAULT_REGION=us-west-2