-
Notifications
You must be signed in to change notification settings - Fork 688
Add CI workflow to check c10 is synced with PyTorch #10413
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
Changes from 7 commits
3c1552c
0e3df0a
c2540c1
ae01ff1
c1886a1
ea89350
52785b5
608e938
da33783
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,13 @@ | ||||||
#!/bin/bash | ||||||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||||||
# All rights reserved. | ||||||
# | ||||||
# This source code is licensed under the BSD-style license found in the | ||||||
# LICENSE file in the root directory of this source tree. | ||||||
|
||||||
set -exu | ||||||
ls pytorch/.git || git clone https://github.com/pytorch/pytorch.git | ||||||
pushd pytorch | ||||||
git checkout "$(< ../.ci/docker/ci_commit_pins/pytorch.txt)" | ||||||
popd | ||||||
"$(dirname "${BASH_SOURCE[0]}")"/diff_c10_mirror_with_pytorch.sh | ||||||
|
"$(dirname "${BASH_SOURCE[0]}")"/diff_c10_mirror_with_pytorch.sh | |
"$(git rev-parse --show-toplevel)/.ci/scripts/diff_c10_mirror_with_pytorch.sh" |
mega nit: this implicitly assumes theses scripts will always be adjacent
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
set -eux | ||
|
||
# Check if dir1's files are also found in dir2 with the same | ||
# contents. Exempt files named BUCK, CMakeLists.txt, TARGETS, or | ||
# targets.bzl. | ||
|
||
if [ $# -ne 2 ]; then | ||
echo "Usage: $0 dir1 dir2" >&2 | ||
exit 1 | ||
fi | ||
dir1="$1" | ||
dir2="$2" | ||
|
||
if [ ! -d "$dir1" ] || [ ! -d "$dir2" ]; then | ||
echo "Error: Both directories must exist" >&2 | ||
exit 1 | ||
fi | ||
|
||
exit_status=0 | ||
while IFS= read -r -d '' file; do | ||
base=$(basename "$file") | ||
case "$base" in | ||
"BUCK"|"CMakeLists.txt"|"TARGETS"|"targets.bzl") | ||
continue | ||
;; | ||
esac | ||
# Construct the corresponding path in the second directory | ||
file2="$dir2/${file#$dir1/}" | ||
# Check if the corresponding file exists in the second directory | ||
if [ ! -f "$file2" ]; then | ||
echo "Error: File '$file' found in '$dir1' but not found in '$dir2'" >&2 | ||
exit 1 | ||
fi | ||
# Compare the contents of the two files using diff | ||
set +ex | ||
differences=$(diff -u -p "$file" "$file2") | ||
set -e # leave x off | ||
# If there are any differences, print an error message and exit with failure status | ||
if [ -n "$differences" ]; then | ||
echo "Error: Mismatch detected in file '$file':" >&2 | ||
echo "$differences" >&2 | ||
exit_status=1 | ||
fi | ||
set -x | ||
done < <(find "$dir1" -type f -print0) | ||
|
||
exit $exit_status |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
$(dirname "${BASH_SOURCE[0]}")/compare_dirs.sh runtime/core/portable_type/c10/c10 pytorch/c10 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: check-c10-sync | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also add |
||
- .ci/docker/ci_commit_pins/pytorch.txt | ||
- .ci/scripts/compare_dirs.sh | ||
- .ci/scripts/diff_c10_mirror_with_pytorch.sh | ||
|
||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-c10-sync: | ||
permissions: | ||
id-token: write | ||
contents: read | ||
name: check-c10-sync | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Clone PyTorch | ||
run: | | ||
set -ex | ||
git clone https://github.com/pytorch/pytorch.git | ||
pushd pytorch || return | ||
git checkout "$(< ../.ci/docker/ci_commit_pins/pytorch.txt)" | ||
popd | ||
|
||
.ci/scripts/check_c10_sync.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
--depth 1
? or will the commit checkout not work?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty sure --depth 1 will break checking out specific commit. also checked and there's no way to clone just a specific commit