Skip to content

Commit acfef26

Browse files
aoyulongMC952-arch
andauthored
Refactor install scripts and add dockerfiles (flagos-ai#1100)
### PR Category <!-- One of [ Train | Inference | Compress | Serve | RL | Core | Hardware | CICD | Tools | Others ] --> CICD ### PR Types <!-- One of [ User Experience | New Features | Bug Fixes | Improvements | Performance | Breaking Change| Deprecations | Test Case | Docs | Others ] --> Improvemetns ### PR Description <!-- Describe what you’ve done --> This pull request updates the CI/CD configuration to support a unified and flexible package manager/environment setup for functional tests, with a focus on future compatibility (e.g., for switching to `uv` or `pip`), and temporarily disables some functional test jobs. The changes introduce new configuration options, refactor workflow inputs/outputs, and update environment activation logic to be package-manager agnostic. Key changes: **Package Manager and Environment Configuration** - Added unified package manager configuration (`pkg_mgr`, `env_path`, `env_names`) to `.github/configs/cuda.yml`, supporting `pip`, `uv`, and `conda`, with clear documentation for future transitions. - Updated workflow inputs/outputs in `.github/workflows/all_tests_common.yml` to use generic `pkg_mgr`, `env_name`, and `env_path` variables instead of hardcoded `conda_env` and `conda_path`, allowing for flexible environment handling. **Functional Test Job Refactoring** - Updated `functional_tests_hetero_train.yml` to use the new `pkg_mgr`, `env_name`, and `env_path` inputs, and refactored the environment activation logic to support `conda`, `uv`, and `pip` using a new utility script (`pyenv_utils.sh`). **Temporary Disabling of Some Functional Tests** - Commented out (disabled) the `functional_tests_inference`, `functional_tests_serve`, and `functional_tests_rl` jobs in `all_tests_common.yml`, and removed their checks from the `all_tests_complete` job, with explanatory comments for future re-enabling. **Cosmetic and Documentation Updates** - Renamed workflow in `.github/workflows/all_tests_cuda.yml` from "CUDA Tests Validation" to "cuda_tests" and added a comment about reading environment settings from the config file. These changes make the CI/CD system more modular, easier to maintain, and ready for future upgrades in package management. --------- Co-authored-by: MC952-arch <MC952-arch@qq.com>
1 parent 00dd159 commit acfef26

45 files changed

Lines changed: 2855 additions & 1513 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/configs/cuda.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,32 @@ container_volumes:
2626

2727
# Container options (hardware-specific settings)
2828
container_options: "--gpus all --shm-size=500g --hostname flagscale_cicd --user root --ulimit nofile=65535:65535"
29+
30+
# =============================================================================
31+
# Package Manager Configuration
32+
# =============================================================================
33+
# Supported package managers: pip, uv, conda
34+
# - pip: Use pip directly (standard Python)
35+
# - uv: Use uv pip (fast, modern package manager)
36+
# - conda: Use conda environment with pip for PyPI packages
37+
#
38+
# Unified environment parameters:
39+
# - env_name: Conda environment name (for conda only)
40+
# - env_path: Environment path (venv path for uv, conda installation path for conda)
41+
#
42+
# To transition to uv in the future:
43+
# 1. Change pkg_mgr to "uv"
44+
# 2. Ensure uv is installed in the Docker image
45+
# 3. Set env_path to the virtual environment path (e.g., "/opt/venv")
46+
#
47+
pkg_mgr: "conda" # Current: conda for CI/CD compatibility
48+
49+
# Environment path (venv path for uv, conda installation path for conda)
50+
env_path: "/root/miniconda3"
51+
52+
# Conda environment name (for conda only)
53+
env_names:
54+
train: "flagscale-train"
55+
hetero_train: "flagscale-train"
56+
inference: "flagscale-inference"
57+
rl: "flagscale-rl"

.github/workflows/all_tests_common.yml

Lines changed: 87 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
inference_test_matrix: ${{ steps.config.outputs.inference_test_matrix }}
2626
serve_test_matrix: ${{ steps.config.outputs.serve_test_matrix }}
2727
rl_test_matrix: ${{ steps.config.outputs.rl_test_matrix }}
28+
pkg_mgr: ${{ steps.config.outputs.pkg_mgr }}
29+
env_path: ${{ steps.config.outputs.env_path }}
30+
env_name_train: ${{ steps.config.outputs.env_name_train }}
31+
env_name_inference: ${{ steps.config.outputs.env_name_inference }}
32+
env_name_serve: ${{ steps.config.outputs.env_name_serve }}
33+
env_name_rl: ${{ steps.config.outputs.env_name_rl }}
2834
steps:
2935
- name: Checkout code
3036
uses: actions/checkout@v4
@@ -107,8 +113,9 @@ jobs:
107113
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
108114
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
109115
source_artifact: flagscale-source-${{ github.sha }}
110-
conda_env: flagscale-train # Optional: can be empty for non-conda environments
111-
conda_path: "/root/miniconda3" # Optional: specify custom conda path, empty for auto-detection
116+
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
117+
env_name: ${{ needs.checkout_and_config.outputs.env_name_train }}
118+
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
112119

113120
functional_tests_train:
114121
needs:
@@ -124,8 +131,9 @@ jobs:
124131
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
125132
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
126133
source_artifact: flagscale-source-${{ github.sha }}
127-
conda_env: flagscale-train # Optional: can be empty for non-conda environments
128-
conda_path: "/root/miniconda3" # Optional: specify custom conda path, empty for auto-detection
134+
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
135+
env_name: ${{ needs.checkout_and_config.outputs.env_name_train }}
136+
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
129137

130138
functional_tests_hetero_train:
131139
needs:
@@ -141,59 +149,64 @@ jobs:
141149
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
142150
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
143151
source_artifact: flagscale-source-${{ github.sha }}
144-
conda_env: flagscale-train # Optional: can be empty for non-conda environments
145-
conda_path: "/root/miniconda3" # Optional: specify custom conda path, empty for auto-detection
152+
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
153+
env_name: ${{ needs.checkout_and_config.outputs.env_name_train }}
154+
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
146155

147-
functional_tests_inference:
148-
needs:
149-
- checkout_and_config
150-
- unit_tests
151-
if: fromJson(needs.checkout_and_config.outputs.inference_test_matrix)[0] != null
152-
uses: ./.github/workflows/functional_tests_inference.yml
153-
with:
154-
platform: ${{ inputs.platform }}
155-
test_matrix: ${{ needs.checkout_and_config.outputs.inference_test_matrix }}
156-
image: ${{ needs.checkout_and_config.outputs.ci_image }}
157-
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
158-
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
159-
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
160-
source_artifact: flagscale-source-${{ github.sha }}
161-
conda_env: flagscale-inference # Optional: can be empty for non-conda environments
162-
conda_path: "/root/miniconda3" # Optional: specify custom conda path, empty for auto-detection
156+
# NOTE: Inference, serve, and rl functional tests are temporarily disabled
157+
# functional_tests_inference:
158+
# needs:
159+
# - checkout_and_config
160+
# - unit_tests
161+
# if: fromJson(needs.checkout_and_config.outputs.inference_test_matrix)[0] != null
162+
# uses: ./.github/workflows/functional_tests_inference.yml
163+
# with:
164+
# platform: ${{ inputs.platform }}
165+
# test_matrix: ${{ needs.checkout_and_config.outputs.inference_test_matrix }}
166+
# image: ${{ needs.checkout_and_config.outputs.ci_image }}
167+
# runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
168+
# container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
169+
# container_options: ${{ needs.checkout_and_config.outputs.container_options }}
170+
# source_artifact: flagscale-source-${{ github.sha }}
171+
# pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
172+
# env_name: ${{ needs.checkout_and_config.outputs.env_name_inference }}
173+
# env_path: ${{ needs.checkout_and_config.outputs.env_path }}
163174

164-
functional_tests_serve:
165-
needs:
166-
- checkout_and_config
167-
- unit_tests
168-
if: fromJson(needs.checkout_and_config.outputs.serve_test_matrix)[0] != null
169-
uses: ./.github/workflows/functional_tests_serve.yml
170-
with:
171-
platform: ${{ inputs.platform }}
172-
test_matrix: ${{ needs.checkout_and_config.outputs.serve_test_matrix }}
173-
image: ${{ needs.checkout_and_config.outputs.ci_image }}
174-
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
175-
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
176-
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
177-
source_artifact: flagscale-source-${{ github.sha }}
178-
conda_env: flagscale-inference # Optional: can be empty for non-conda environments
179-
conda_path: "/root/miniconda3" # Optional: specify custom conda path, empty for auto-detection
175+
# functional_tests_serve:
176+
# needs:
177+
# - checkout_and_config
178+
# - unit_tests
179+
# if: fromJson(needs.checkout_and_config.outputs.serve_test_matrix)[0] != null
180+
# uses: ./.github/workflows/functional_tests_serve.yml
181+
# with:
182+
# platform: ${{ inputs.platform }}
183+
# test_matrix: ${{ needs.checkout_and_config.outputs.serve_test_matrix }}
184+
# image: ${{ needs.checkout_and_config.outputs.ci_image }}
185+
# runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
186+
# container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
187+
# container_options: ${{ needs.checkout_and_config.outputs.container_options }}
188+
# source_artifact: flagscale-source-${{ github.sha }}
189+
# pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
190+
# env_name: ${{ needs.checkout_and_config.outputs.env_name_serve }}
191+
# env_path: ${{ needs.checkout_and_config.outputs.env_path }}
180192

181-
functional_tests_rl:
182-
needs:
183-
- checkout_and_config
184-
- unit_tests
185-
if: fromJson(needs.checkout_and_config.outputs.rl_test_matrix)[0] != null
186-
uses: ./.github/workflows/functional_tests_rl.yml
187-
with:
188-
platform: ${{ inputs.platform }}
189-
test_matrix: ${{ needs.checkout_and_config.outputs.rl_test_matrix }}
190-
image: ${{ needs.checkout_and_config.outputs.ci_image }}
191-
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
192-
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
193-
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
194-
source_artifact: flagscale-source-${{ github.sha }}
195-
conda_env: flagscale-RL # Optional: can be empty for non-conda environments
196-
conda_path: "/root/miniconda3" # Optional: specify custom conda path, empty for auto-detection
193+
# functional_tests_rl:
194+
# needs:
195+
# - checkout_and_config
196+
# - unit_tests
197+
# if: fromJson(needs.checkout_and_config.outputs.rl_test_matrix)[0] != null
198+
# uses: ./.github/workflows/functional_tests_rl.yml
199+
# with:
200+
# platform: ${{ inputs.platform }}
201+
# test_matrix: ${{ needs.checkout_and_config.outputs.rl_test_matrix }}
202+
# image: ${{ needs.checkout_and_config.outputs.ci_image }}
203+
# runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
204+
# container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
205+
# container_options: ${{ needs.checkout_and_config.outputs.container_options }}
206+
# source_artifact: flagscale-source-${{ github.sha }}
207+
# pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
208+
# env_name: ${{ needs.checkout_and_config.outputs.env_name_rl }}
209+
# env_path: ${{ needs.checkout_and_config.outputs.env_path }}
197210

198211
all_tests_complete:
199212
defaults:
@@ -204,9 +217,10 @@ jobs:
204217
- unit_tests
205218
- functional_tests_train
206219
- functional_tests_hetero_train
207-
- functional_tests_inference
208-
- functional_tests_serve
209-
- functional_tests_rl
220+
# NOTE: Disabled tests removed from needs
221+
# - functional_tests_inference
222+
# - functional_tests_serve
223+
# - functional_tests_rl
210224
runs-on: ubuntu-latest
211225
if: always()
212226
steps:
@@ -233,23 +247,24 @@ jobs:
233247
failed=true
234248
fi
235249
236-
if [ "${{ needs.functional_tests_inference.result }}" != "success" ] && \
237-
[ "${{ needs.functional_tests_inference.result }}" != "skipped" ]; then
238-
echo "❌ Inference functional tests failed"
239-
failed=true
240-
fi
250+
# NOTE: Inference, serve, and rl checks disabled
251+
# if [ "${{ needs.functional_tests_inference.result }}" != "success" ] && \
252+
# [ "${{ needs.functional_tests_inference.result }}" != "skipped" ]; then
253+
# echo "❌ Inference functional tests failed"
254+
# failed=true
255+
# fi
241256
242-
if [ "${{ needs.functional_tests_serve.result }}" != "success" ] && \
243-
[ "${{ needs.functional_tests_serve.result }}" != "skipped" ]; then
244-
echo "❌ RL functional tests failed"
245-
failed=true
246-
fi
257+
# if [ "${{ needs.functional_tests_serve.result }}" != "success" ] && \
258+
# [ "${{ needs.functional_tests_serve.result }}" != "skipped" ]; then
259+
# echo "❌ Serve functional tests failed"
260+
# failed=true
261+
# fi
247262
248-
if [ "${{ needs.functional_tests_rl.result }}" != "success" ] && \
249-
[ "${{ needs.functional_tests_rl.result }}" != "skipped" ]; then
250-
echo "❌ RL functional tests failed"
251-
failed=true
252-
fi
263+
# if [ "${{ needs.functional_tests_rl.result }}" != "success" ] && \
264+
# [ "${{ needs.functional_tests_rl.result }}" != "skipped" ]; then
265+
# echo "❌ RL functional tests failed"
266+
# failed=true
267+
# fi
253268
254269
if [ "$failed" = "true" ]; then
255270
exit 1

.github/workflows/all_tests_cuda.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CUDA Tests Validation
1+
name: cuda_tests
22

33
on:
44
push:
@@ -12,6 +12,7 @@ concurrency:
1212

1313
jobs:
1414
run_tests:
15+
# Package manager and environment settings are read from .github/configs/cuda.yml
1516
uses: ./.github/workflows/all_tests_common.yml
1617
with:
1718
platform: cuda

0 commit comments

Comments
 (0)