Skip to content

Commit f07c80c

Browse files
authored
ci: lint + unittests (#1)
1 parent 824a9a3 commit f07c80c

File tree

3 files changed

+80
-1
lines changed

3 files changed

+80
-1
lines changed

.github/workflows/lint.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- name: Setup Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: "3.10"
17+
architecture: x64
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
- name: Install Dependencies
21+
run: |
22+
set -eux
23+
24+
sudo apt-get install -y protobuf-compiler
25+
26+
pip install .[dev] -v
27+
- name: Run Python Lint
28+
run: |
29+
set -eux
30+
31+
black --check .
32+
- name: Run Rust Lint
33+
run: |
34+
set -eux
35+
36+
cargo fmt --check

.github/workflows/unittest.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
unittest:
11+
strategy:
12+
matrix:
13+
os:
14+
- ubuntu-20.04
15+
- "linux.4xlarge.nvidia.gpu"
16+
runs-on: ${{ matrix.os }}
17+
steps:
18+
- name: Setup Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: "3.10"
22+
architecture: x64
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
- name: Install Dependencies
26+
run: |
27+
set -eux
28+
29+
sudo apt-get install -y protobuf-compiler
30+
31+
pip install -e .[dev] -v
32+
- name: Run Python Tests
33+
run: |
34+
set -eux
35+
36+
pytest -v
37+
- name: Run Rust Lint
38+
run: |
39+
set -eux
40+
41+
cargo test -v
42+

torchft/process_group_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7-
from unittest import TestCase
7+
from unittest import TestCase, skipUnless
88

99
import torch
1010
from torch.distributed import TCPStore, ReduceOp
@@ -73,6 +73,7 @@ def test_dummy(self) -> None:
7373
m = torch.nn.parallel.DistributedDataParallel(m, process_group=pg)
7474
m(torch.rand(2, 3))
7575

76+
@skipUnless(torch.cuda.is_available(), "needs CUDA")
7677
def test_baby_nccl(self) -> None:
7778
store = TCPStore(
7879
host_name="localhost", port=0, is_master=True, wait_for_workers=False

0 commit comments

Comments
 (0)