Skip to content

Only enable bazel caching writes for tensorflow/io github actions #1293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
GCP_CREDS: ${{ secrets.GCP_CREDS }}
REPO_NAME: ${{ github.repository }}
EVENT_NAME: ${{ github.event_name }}
BAZEL_OPTIMIZATION: --copt=-msse4.2 --copt=-mavx --compilation_mode=opt

Expand Down Expand Up @@ -51,7 +52,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: |
if [[ "${EVENT_NAME}" == "push" ]]; then
if [[ "${EVENT_NAME}" == "push" && "${REPO_NAME}" == "tensorflow/io" ]]; then
printf '%s\n' "${GCP_CREDS}" >service_account_creds.json
export BAZEL_OPTIMIZATION="--remote_cache=https://storage.googleapis.com/tensorflow-sigs-io --remote_upload_local_results=true --google_credentials=service_account_creds.json"
fi
Expand All @@ -71,7 +72,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: |
if [[ "${EVENT_NAME}" == "push" ]]; then
if [[ "${EVENT_NAME}" == "push" && "${REPO_NAME}" == "tensorflow/io" ]]; then
printf '%s\n' "${GCP_CREDS}" >service_account_creds.json
export BAZEL_OPTIMIZATION="--remote_cache=https://storage.googleapis.com/tensorflow-sigs-io --remote_upload_local_results=true --google_credentials=service_account_creds.json"
fi
Expand All @@ -89,7 +90,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: |
if [[ "${EVENT_NAME}" == "push" ]]; then
if [[ "${EVENT_NAME}" == "push" && "${REPO_NAME}" == "tensorflow/io" ]]; then
printf '%s\n' "${GCP_CREDS}" >service_account_creds.json
export BAZEL_OPTIMIZATION="--remote_cache=https://storage.googleapis.com/tensorflow-sigs-io --remote_upload_local_results=true --google_credentials=service_account_creds.json"
fi
Expand All @@ -108,7 +109,7 @@ jobs:
- uses: actions/checkout@v2
- name: Bazel on macOS
run: |
if [[ "${EVENT_NAME}" == "push" ]]; then
if [[ "${EVENT_NAME}" == "push" && "${REPO_NAME}" == "tensorflow/io" ]]; then
printf '%s\n' "${GCP_CREDS}" >service_account_creds.json
export BAZEL_OPTIMIZATION="${BAZEL_OPTIMIZATION} --remote_cache=https://storage.googleapis.com/tensorflow-sigs-io --remote_upload_local_results=true --google_credentials=service_account_creds.json"
fi
Expand Down Expand Up @@ -219,7 +220,7 @@ jobs:
- uses: actions/checkout@v2
- name: Bazel on Linux
run: |
if [[ "${EVENT_NAME}" == "push" ]]; then
if [[ "${EVENT_NAME}" == "push" && "${REPO_NAME}" == "tensorflow/io" ]]; then
printf '%s\n' "${GCP_CREDS}" >service_account_creds.json
export BAZEL_OPTIMIZATION="${BAZEL_OPTIMIZATION} --remote_cache=https://storage.googleapis.com/tensorflow-sigs-io --remote_upload_local_results=true --google_credentials=service_account_creds.json"
fi
Expand Down Expand Up @@ -327,8 +328,12 @@ jobs:
shell: cmd
run: |
if "%EVENT_NAME%" == "push" (
printenv GCP_CREDS > service_account_creds.json
set "BAZEL_OPTIMIZATION=--remote_cache=https://storage.googleapis.com/tensorflow-sigs-io --remote_upload_local_results=true --google_credentials=service_account_creds.json"
if "%REPO_NAME%" == "tensorflow/io" (
printenv GCP_CREDS > service_account_creds.json
set "BAZEL_OPTIMIZATION=--remote_cache=https://storage.googleapis.com/tensorflow-sigs-io --remote_upload_local_results=true --google_credentials=service_account_creds.json"
) else (
echo %REPO_NAME%
)
) else (
echo %EVENT_NAME%
)
Expand Down