Skip to content

Commit d87f2e4

Browse files
committed
feat(ci): Add uv-based CI infrastructure
Migrate to uv pip interface for CI builds with static dependency override support. This establishes a simpler, reproducible CI workflow. Changes: - Add GitHub Copilot instructions (.github/copilot-instructions.md) with comprehensive repository context, build commands, and development guidelines - Add static CI overrides file (requirements/ci/overrides.txt) for Lightning commit pinning, replacing dynamic generation approach - Add locked CI requirements (requirements/ci/requirements.txt) generated via uv pip compile for reproducible builds - Add lock script (requirements/utils/lock_ci_requirements.sh) wrapper around uv pip compile - Add CI composite action (.github/actions/install-ci-dependencies) for unified uv-based installation - Add process management wrapper (scripts/manage_standalone_processes.sh) to prevent duplicate test execution during coverage collection The override file is used with `uv pip install --override` to pin Lightning to a specific git commit during CI builds.
1 parent c043815 commit d87f2e4

File tree

20 files changed

+2001
-183
lines changed

20 files changed

+2001
-183
lines changed

.azure-pipelines/gpu-tests.yml

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pr:
4040
- "requirements/**"
4141
- ".azure-pipelines/**"
4242
- ".actions/**"
43+
drafts: false # Only run for PRs that are "ready for review"
4344

4445
jobs:
4546
- job: pytest
@@ -68,59 +69,94 @@ jobs:
6869
steps:
6970

7071
- bash: |
71-
. /tmp/venvs/fts_dev/bin/activate
72-
pip install --upgrade pip requests setuptools
73-
pip install -e . --no-warn-script-location --requirement requirements/devel.txt
74-
# pip install lightning --upgrade # rather than upgrade, we now use the relevant pin
72+
set -e # Exit on any error
73+
source /tmp/venvs/fts_dev/bin/activate
74+
75+
echo "=== Installing finetuning-scheduler in editable mode ==="
76+
if ! uv pip install -e ".[all]" --override requirements/ci/overrides.txt; then
77+
echo "ERROR: Failed to install finetuning-scheduler in editable mode"
78+
exit 1
79+
fi
80+
echo "✓ Finetuning-scheduler installation completed"
81+
82+
echo "=== Installing locked CI requirements ==="
83+
if ! uv pip install -r requirements/ci/requirements.txt; then
84+
echo "ERROR: Failed to install locked CI requirements"
85+
exit 1
86+
fi
87+
echo "✓ CI requirements installation completed"
88+
89+
echo "=== Installed packages ==="
90+
uv pip list
7591
env:
7692
USE_CI_COMMIT_PIN: "1"
7793
displayName: 'Install dependencies'
7894
7995
- bash: |
80-
. /tmp/venvs/fts_dev/bin/activate
96+
source /tmp/venvs/fts_dev/bin/activate
8197
python requirements/collect_env_details.py
8298
python -c "import torch ; print(f'PyTorch CUDA version: {torch.version.cuda}') ; mgpu = torch.cuda.device_count() ; assert mgpu >= 2, f'GPU: {mgpu}'"
8399
displayName: 'Env details'
84100
85101
- bash: |
86-
. /tmp/venvs/fts_dev/bin/activate
102+
source /tmp/venvs/fts_dev/bin/activate
87103
python -m coverage run --source src/finetuning_scheduler -m pytest src/finetuning_scheduler tests -v --junitxml=$(Build.Repository.LocalPath)/test-results.xml --durations=50
88104
displayName: 'Testing: standard'
89105
90106
- bash: |
91-
. /tmp/venvs/fts_dev/bin/activate
107+
source /tmp/venvs/fts_dev/bin/activate
92108
bash ./tests/special_tests.sh --mark_type=standalone --filter_pattern='test_f'
93109
displayName: 'Testing: standalone multi-gpu'
94110
95111
# - bash: |
96-
# . /tmp/venvs/fts_dev/bin/activate
112+
# source /tmp/venvs/fts_dev/bin/activate
97113
# bash ./tests/special_tests.sh --mark_type=exp_patch --filter_pattern='test_f' --experiment_patch_mask="1 0 0 1"
98114
# displayName: 'Testing: Experimental Multi-GPU'
99115

100116
- bash: |
101-
. /tmp/venvs/fts_dev/bin/activate
117+
source /tmp/venvs/fts_dev/bin/activate
102118
python -m coverage report
103119
python -m coverage xml
104120
python -m coverage html
105-
curl -Os https://uploader.codecov.io/latest/linux/codecov
121+
# curl -Os https://uploader.codecov.io/latest/linux/codecov
122+
123+
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
124+
curl -Os https://cli.codecov.io/latest/linux/codecov
125+
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
126+
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
127+
gpg --no-default-keyring --keyring trustedkeys.gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
128+
shasum -a 256 -c codecov.SHA256SUM
106129
chmod +x codecov
107-
./codecov -t $CODECOV_TOK --commit=$(Build.SourceVersion) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure
130+
# ./codecov -t $CODECOV_TOK --commit=$(Build.SourceVersion) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure
131+
./codecov upload-process --slug 'speediedan/finetuning-scheduler' -t $CODECOV_TOK --commit-sha $(Build.SourceVersion) --git-service 'github' -n "GPU-coverage" -F 'gpu,pytest' --env 'linux,azure' -f 'coverage.xml'
108132
env:
109133
CODECOV_TOK: $(CODECOV_TOKEN) # explicit mapping required for secret azure pipeline variables
110134
displayName: 'Statistics'
111135
112136
- bash: |
113137
set -e
114-
. /tmp/venvs/fts_dev/bin/activate
138+
source /tmp/venvs/fts_dev/bin/activate
115139
python -m pytest src/fts_examples -v --maxfail=1 --durations=0 -W ignore:\`np.object\`:DeprecationWarning -W ignore:'`np.int` is':DeprecationWarning
116140
# condition: notIn(variables['scope'], '2.0.1')
117141
displayName: 'Testing: Examples'
118142
119143
- bash: |
120-
. /tmp/venvs/fts_dev/bin/activate
144+
source /tmp/venvs/fts_dev/bin/activate
121145
mkdir -p /__w/_temp/kernel_cache
122146
bash ./tests/special_tests.sh --mark_type=standalone --collect_dir='src/fts_examples' --filter_pattern='model_parallel_examples'
123147
# condition: notIn(variables['scope'], '2.0.1')
124148
env:
125149
PYTORCH_KERNEL_CACHE_PATH: "/__w/_temp/kernel_cache"
126150
displayName: 'Testing: Multi-GPU Examples'
151+
152+
- bash: |
153+
# since we use rootless docker and userns-remapping, we need to ensure all files/directories in previous
154+
# steps that may have been written with Azure's `az_pipeline_agent_azpcontainer` user (100997 in the host
155+
# subuid range) are chmod'd or removed
156+
echo "Adjusting ownership/permissions..."
157+
sudo chmod -R 775 /__w/1/s || true
158+
echo "Cleaning up ephemeral directories..."
159+
sudo rm -rf /__w/1/s/.pytest_cache || true
160+
echo 'Agent workspace cleanup completed'
161+
condition: always()
162+
displayName: 'Cleaning up agent workspace'
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Install CI Dependencies"
2+
description: "Install Python dependencies for CI workflows using uv"
3+
4+
inputs:
5+
python_version:
6+
description: "Python version to use"
7+
required: false
8+
default: "3.12"
9+
use_oldest:
10+
description: "Whether to use oldest compatible versions (for testing min version support)"
11+
required: false
12+
default: "false"
13+
use_commit_pin:
14+
description: "Whether to use Lightning commit pinning"
15+
required: false
16+
default: "true"
17+
show_pip_list:
18+
description: "Whether to show package list output after installations"
19+
required: false
20+
default: "false"
21+
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: Install uv and set Python version
26+
uses: astral-sh/setup-uv@v7
27+
with:
28+
python-version: ${{ inputs.python_version }}
29+
activate-environment: true
30+
enable-cache: true
31+
32+
- name: Set min. dependencies
33+
if: inputs.use_oldest == 'true'
34+
shell: bash
35+
run: |
36+
# Use assistant.py to replace version constraints with oldest compatible versions
37+
python .actions/assistant.py replace_oldest_ver
38+
39+
- name: Install project in editable mode (with commit pin)
40+
if: inputs.use_commit_pin == 'true'
41+
shell: bash
42+
env:
43+
USE_CI_COMMIT_PIN: "1"
44+
run: |
45+
echo "Installing finetuning-scheduler in editable mode with Lightning commit pin..."
46+
uv pip install -e ".[all]" --override requirements/ci/overrides.txt
47+
48+
- name: Install project in editable mode (without commit pin)
49+
if: inputs.use_commit_pin != 'true'
50+
shell: bash
51+
run: |
52+
echo "Installing finetuning-scheduler in editable mode..."
53+
uv pip install -e ".[all]"
54+
55+
- name: Install locked CI requirements
56+
if: inputs.use_oldest != 'true'
57+
shell: bash
58+
run: |
59+
echo "Installing locked CI requirements for reproducibility..."
60+
uv pip install -r requirements/ci/requirements.txt
61+
62+
- name: Show package list
63+
if: inputs.show_pip_list == 'true'
64+
shell: bash
65+
run: |
66+
uv pip list

0 commit comments

Comments
 (0)