Skip to content

Commit

Permalink
Create _setup.yml to wrap common setup steps.
Browse files Browse the repository at this point in the history
  • Loading branch information
will-cromar committed Jun 13, 2024
1 parent 1cad403 commit 4812c58
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 21 deletions.
26 changes: 5 additions & 21 deletions .github/workflows/_build_torch_xla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,15 @@ jobs:
image: ${{ inputs.dev-image }}
env:
GCLOUD_SERVICE_KEY: ${{ secrets.gcloud-service-key }}
GOOGLE_APPLICATION_CREDENTIALS: /tmp/default_credentials.json
BAZEL_JOBS: 16
BAZEL_REMOTE_CACHE: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
BAZEL_JOBS: 16
BUILD_CPP_TESTS: 1
steps:
# See https://github.com/actions/checkout/issues/1014#issuecomment-1906802802
- name: Clean up workspace
run: |
ls -la
rm -rvf ${GITHUB_WORKSPACE}/*
- name: Setup gcloud
shell: bash
run: |
echo "${GCLOUD_SERVICE_KEY}" > $GOOGLE_APPLICATION_CREDENTIALS
- name: Checkout PyTorch Repo
uses: actions/checkout@v4
with:
repository: pytorch/pytorch
path: pytorch
ref: ${{ inputs.torch-commit }}
submodules: recursive
- name: Checkout PyTorch/XLA Repo
uses: actions/checkout@v4
- name: Setup
uses: ./.github/workflows/_setup.yml
with:
path: pytorch/xla
torch-commit: ${{ inputs.torch-commit }}
setup-remote-cache: ${{ env.BAZEL_REMOTE_CACHE }}
- name: Build
shell: bash
run: |
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/_setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Set up PyTorch/XLA
inputs:
torch-commit:
required: true
type: string
remote-cache:
required: true
type: string
description: Whether to set up Google Cloud credentials for Bazel cache.
runs:
using: "composite"
steps:
# See https://github.com/actions/checkout/issues/1014#issuecomment-1906802802
- name: Clean up workspace
run: |
ls -la
rm -rvf ${GITHUB_WORKSPACE}/*
- name: Setup gcloud
shell: bash
run: |
echo "${GCLOUD_SERVICE_KEY}" > /tmp/default_credentials.json
echo "GOOGLE_APPLICATION_CREDENTIALS=/tmp/default_credentials.json" >> $GITHUB_ENV
if: ${{ inputs.remote-cache }}
- name: Checkout PyTorch Repo
uses: actions/checkout@v4
with:
repository: pytorch/pytorch
path: pytorch
ref: c
submodules: recursive
- name: Checkout PyTorch/XLA Repo
uses: actions/checkout@v4
with:
path: pytorch/xla

0 comments on commit 4812c58

Please sign in to comment.