Skip to content
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

Add a CPU check and CI #15

Merged
merged 1 commit into from
Jan 9, 2025
Merged
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
29 changes: 29 additions & 0 deletions .github/workflows/cpu_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CPU tests

on:
push:
branches:
- main
pull_request:
schedule:
- cron: "0 8 * * *"

jobs:
pytest:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.10", "3.11"]
container:
image: us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/xla:nightly_${{ matrix.python-version }}_tpuvm
steps:
- uses: actions/checkout@v4
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -e '.[dev]'
- name: Run PyTest
run: |
# TODO(https://github.com/AI-Hypercomputer/torchprime/issues/14): Remove and burn the token.
export HF_TOKEN=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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think github also has a way to store secrets. We do that for pytorch/xla repo but probably not worth spending time on given that we are going to remove this soon.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

pytest
51 changes: 51 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Lint

on:
push:
branches:
- main
pull_request:
schedule:
- cron: "0 10 * * *"

jobs:
lint:
name: Check format and lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -e '.[dev]'
- name: Lint the code with ruff
run: |
ruff check
- name: Check formatting with yapf
shell: bash
run: |
git_status=$(git status --porcelain)
if [[ $git_status ]]; then
echo "Checkout code is not clean"
echo "${git_status}"
exit 1
fi

yapf --recursive -i '*.py' torchprime launcher
git_status=$(git status --porcelain)
if [[ $git_status ]]; then
git diff
echo "yapf recommends the changes above, please manually apply them OR automatically apply the changes "
echo "by running `yapf -i /PATH/TO/foo.py` to the following files"
echo "${git_status}"
exit 1
else
echo "PASSED Python format"
fi
Loading