Skip to content

Collect coverage data. #9107

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

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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: 7 additions & 12 deletions .github/scripts/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
set -ex


function run_torch_xla_python_tests() {
XLA_DIR=$1
USE_COVERAGE="${2:-0}"

pushd $XLA_DIR
echo "Running Python Tests"
./test/run_tests.sh
if [ "$USE_COVERAGE" != "0" ]; then
pip install coverage==6.5.0 --upgrade
pip install coverage-lcov
pip install toml
./test/run_tests.sh
coverage combine
mkdir lcov && cp .coverage lcov/
coverage-lcov --data_file_path lcov/.coverage
coverage html
cp lcov.info htmlcov/
mv htmlcov ~/
chmod -R 755 ~/htmlcov
else
./test/run_tests.sh
coverage-lcov --data_file_path $COVERAGE_FILE --output_file_path $COVERAGE_FILE.info
fi
popd
}
Expand Down Expand Up @@ -81,6 +72,10 @@ function run_torch_xla_benchmark_tests() {
echo "Running Torchbench Tests"
test/benchmarks/run_torchbench_tests.sh "${TORCHBENCH_MODELS[@]}"
popd
if [ "$USE_COVERAGE" != "0" ]; then
coverage combine
coverage-lcov --data_file_path $COVERAGE_FILE --output_file_path $COVERAGE_FILE.info
fi
}

PYTORCH_DIR=$1
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/_build_plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ on:
type: number
description: Timeout in minutes for the build job
default: 120
has_code_changes:
required: false
type: string
description: Whether to run full workflow or not
default: 'true'
secrets:
gcloud-service-key:
required: true
Expand All @@ -37,31 +32,23 @@ jobs:
BAZEL_REMOTE_CACHE: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- name: Checkout actions
if: inputs.has_code_changes == 'true'
uses: actions/checkout@v4
with:
sparse-checkout: |
.github/workflows/setup
path: .actions
- name: Setup
if: inputs.has_code_changes == 'true'
uses: ./.actions/.github/workflows/setup
with:
torch-commit: ${{ inputs.torch-commit }}
cuda: true
- name: Build
if: inputs.has_code_changes == 'true'
shell: bash
run: |
cd pytorch/xla/infra/ansible
ansible-playbook playbook.yaml -vvv -e "stage=build_plugin arch=amd64 accelerator=cuda cuda_compute_capabilities=5.2,7.5,8.6 src_root=${GITHUB_WORKSPACE} cache_suffix=-ci" --skip-tags=fetch_srcs,install_deps
- name: Upload wheel
if: inputs.has_code_changes == 'true'
uses: actions/upload-artifact@v4
with:
name: cuda-plugin
path: /dist/*.whl
- name: Report no code changes
if: inputs.has_code_changes == 'false'
run: |
echo "No code changes were detected that require running the full test suite."
13 changes: 0 additions & 13 deletions .github/workflows/_build_torch_with_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ on:
type: number
description: Timeout in minutes for the build job
default: 120
has_code_changes:
required: false
type: string
description: Whether to run full workflow or not
default: 'true'
jobs:
build:
runs-on: ${{ inputs.runner }}
Expand All @@ -38,31 +33,23 @@ jobs:
MAX_JOBS: 24
steps:
- name: Checkout actions
if: inputs.has_code_changes == 'true'
uses: actions/checkout@v4
with:
sparse-checkout: |
.github/workflows/setup
path: .actions
- name: Setup
if: inputs.has_code_changes == 'true'
uses: ./.actions/.github/workflows/setup
with:
torch-commit: ${{ inputs.torch-commit }}
cuda: true
- name: Build PyTorch with CUDA enabled
if: inputs.has_code_changes == 'true'
shell: bash
run: |
cd pytorch
python setup.py bdist_wheel
- name: Upload wheel
if: inputs.has_code_changes == 'true'
uses: actions/upload-artifact@v4
with:
name: torch-with-cuda
path: pytorch/dist/*.whl
- name: Report no code changes
if: inputs.has_code_changes == 'false'
run: |
echo "No code changes were detected that require running the full test suite."
20 changes: 6 additions & 14 deletions .github/workflows/_build_torch_xla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ on:
type: number
description: Timeout in minutes for the build job
default: 120
has_code_changes:
required: false
type: string
description: Whether to run full workflow or not
default: 'true'
secrets:
gcloud-service-key:
required: true
Expand All @@ -40,41 +35,38 @@ jobs:
BAZEL_REMOTE_CACHE: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
BAZEL_JOBS: 16
BUILD_CPP_TESTS: 1
GCNO_OUTPUT_DIR: "/tmp/torch-xla-gcno"
steps:
# Need to check out local composite actions before using them
# https://github.com/orgs/community/discussions/11771
- name: Checkout actions
if: inputs.has_code_changes == 'true'
uses: actions/checkout@v4
with:
sparse-checkout: |
.github/workflows/setup
path: .actions
- name: Setup
if: inputs.has_code_changes == 'true'
uses: ./.actions/.github/workflows/setup
with:
torch-commit: ${{ inputs.torch-commit }}
- name: Build
if: inputs.has_code_changes == 'true'
shell: bash
run: |
cd pytorch/xla/infra/ansible
ansible-playbook playbook.yaml -vvv -e "stage=build arch=amd64 accelerator=tpu src_root=${GITHUB_WORKSPACE} bundle_libtpu=0 build_cpp_tests=1 git_versioned_xla_build=1 cache_suffix=-ci" --skip-tags=fetch_srcs,install_deps
- name: Upload wheel
if: inputs.has_code_changes == 'true'
uses: actions/upload-artifact@v4
with:
name: torch-xla-wheels
path: /dist/*.whl
- name: Upload CPP test binaries
if: inputs.has_code_changes == 'true'
uses: actions/upload-artifact@v4
with:
name: cpp-test-bin
path: /tmp/test/bin
- name: Report no code changes
if: inputs.has_code_changes == 'false'
run: |
echo "No code changes were detected that require running the full test suite."
- name: Upload GCNO files
uses: actions/upload-artifact@v4
with:
name: torch-xla-gcnos
path: ${{ env.GCNO_OUTPUT_DIR }}

111 changes: 0 additions & 111 deletions .github/workflows/_check_code_changes.yml

This file was deleted.

18 changes: 1 addition & 17 deletions .github/workflows/_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ on:
type: string
description: Runner type for the test
default: linux.4xlarge
has_code_changes:
required: false
type: string
description: Whether to run full workflow or not
default: 'true'
secrets:
torchxla-bot-token:
required: true
Expand All @@ -29,50 +24,42 @@ jobs:
BRANCH_NAME: ${{ github.ref_name }}
steps:
- name: Fetch wheels
if: inputs.has_code_changes == 'true'
uses: actions/download-artifact@v4
with:
name: torch-xla-wheels
path: /tmp/wheels/
- name: Install wheels
if: inputs.has_code_changes == 'true'
shell: bash
run: |
pip install /tmp/wheels/*.whl
- name: Checkout PyTorch/XLA Repo
if: inputs.has_code_changes == 'true'
uses: actions/checkout@v4
with:
path: pytorch/xla
- name: Build docs
if: inputs.has_code_changes == 'true'
shell: bash
run: |
cd pytorch/xla/docs
pip install -r requirements.txt
sphinx-build -b html source build
- name: Checkout GitHub Pages
if: inputs.has_code_changes == 'true'
uses: actions/checkout@v4
with:
path: gh-pages
ref: gh-pages
token: ${{ github.event_name == 'push' && secrets.torchxla-bot-token || github.token }}
- name: Merge changes
if: inputs.has_code_changes == 'true'
shell: bash
run: |
subdir=${{ env.BRANCH_NAME == 'master' && 'master' || format('{0}/{1}', 'release', env.BRANCH_NAME) }}
mkdir -p gh-pages/$subdir
cp -fR pytorch/xla/docs/build/* gh-pages/$subdir
- name: Upload preview as artifact
if: inputs.has_code_changes == 'true'
uses: actions/upload-artifact@v4
with:
name: github-pages
path: pytorch/xla/docs/build/
- name: Deploy
if: inputs.has_code_changes == 'true' && github.event_name == 'push'
shell: bash
run: |
cd gh-pages
Expand All @@ -81,7 +68,4 @@ jobs:
git add . -v
git diff --cached --exit-code || git commit -m "Update doc from commit ${{ github.sha }}"
git push origin gh-pages
- name: Report no code changes
if: inputs.has_code_changes == 'false'
run: |
echo "No code changes were detected that require running the full test suite."
if: github.event_name == 'push'
Loading
Loading