-
Notifications
You must be signed in to change notification settings - Fork 689
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3c1552c
Update
swolchok 0e3df0a
Update
swolchok c2540c1
Update
swolchok ae01ff1
Update
swolchok c1886a1
Update
swolchok ea89350
Update
swolchok 52785b5
Update
swolchok 608e938
Update
swolchok da33783
Update
swolchok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/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 | ||
ls pytorch/.git || git clone https://github.com/pytorch/pytorch.git | ||
pytorch_pin="$(< .ci/docker/ci_commit_pins/pytorch.txt)" | ||
pushd pytorch | ||
git checkout "$pytorch_pin" | ||
popd | ||
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/c10 pytorch/c10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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 | ||
- runtime/core/portable_type/c10/** | ||
|
||
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: | | ||
.ci/scripts/check_c10_sync.sh |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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