-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (121 loc) · 4.38 KB
/
ci.yml
File metadata and controls
142 lines (121 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# =============================================================================
# GitHub Actions CI Workflow
# =============================================================================
# This workflow runs CPU tests on every push and pull request.
# GPU tests are skipped in CI as GitHub Actions runners don't have GPUs.
#
# For GPU testing, use self-hosted runners with GPU support or
# manual testing on GPU-enabled machines.
# =============================================================================
name: CI
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install CPU-only PyTorch for faster CI
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements.txt
pip install pytest pytest-xdist
- name: Check Python syntax
run: |
python -m py_compile src/train/utils.py
python -m py_compile src/train/train_single_gpu.py
python -m py_compile src/train/train_dataparallel.py
python -m py_compile src/train/train_ddp.py
python -m py_compile src/inference/inference.py
python -m py_compile src/examples/simple_dataset.py
python -m py_compile src/cutile_examples/cutile_vector_add.py
python -m py_compile src/cutile_examples/cutile_integration_example.py
python -m py_compile scripts/multi_task_scheduler.py
- name: Run CPU tests
run: |
pytest tests/ -v --ignore=tests/test_ddp_local.py -x
- name: Run DDP tests (skipped without GPUs)
run: |
# DDP tests will be skipped automatically due to requires_cuda markers
pytest tests/test_ddp_local.py -v || true
- name: Test imports
run: |
python -c "from src.train.utils import set_seed, get_device, check_cutile_available"
python -c "from src.examples.simple_dataset import SimpleDataset, get_simple_model"
python -c "import torch; print(f'PyTorch {torch.__version__}')"
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install linting tools
run: |
pip install flake8
- name: Run flake8 (warnings only)
run: |
# Run flake8 but don't fail on issues (for now)
flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics || true
flake8 src/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: false
tags: gpu-runner:test
cache-from: type=gha
cache-to: type=gha,mode=max
# Optional: GPU tests on self-hosted runner
# Uncomment if you have a self-hosted runner with GPU
#
# gpu-test:
# runs-on: [self-hosted, gpu]
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.10'
#
# - name: Install dependencies
# run: |
# pip install -r requirements.txt
# pip install pytest
#
# - name: Run GPU tests
# run: |
# nvidia-smi
# pytest tests/ -v
#
# - name: Run DDP smoke test
# run: |
# torchrun --nproc_per_node=2 src/train/train_ddp.py --epochs 1