Skip to content

Commit 338414d

Browse files
committed
install curl for upload coverage; active python
1 parent c56bbf2 commit 338414d

1 file changed

Lines changed: 28 additions & 47 deletions

File tree

.github/workflows/unit_tests_common.yml

Lines changed: 28 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,18 @@ jobs:
7979
fail-fast: false
8080
matrix:
8181
test_group:
82+
- name: license
83+
path: "qa/L0_license/test.sh"
84+
test_type: "license"
8285
- name: pytorch_lint
8386
path: "qa/L0_pytorch_lint/test.sh"
84-
test_type: "sh"
87+
test_type: "lint"
8588
- name: pytorch_debug
8689
path: "qa/L0_pytorch_debug_unittest/test.sh"
87-
test_type: "sh"
90+
test_type: "debug"
8891
- name: pytorch_unittest
8992
path: "qa/L0_pytorch_unittest/test.sh"
90-
test_type: "sh"
93+
test_type: "unittest"
9194

9295
name: unit-${{ inputs.device }}-${{ matrix.test_group.name }}
9396
container:
@@ -120,17 +123,17 @@ jobs:
120123
with:
121124
set-safe-directory: true
122125

123-
- name: Activate Python environment
124-
run: |
125-
if [[ "$PLATFORM" == "cuda" ]] && [ -f /opt/miniconda3/etc/profile.d/conda.sh ]; then
126-
source /opt/miniconda3/etc/profile.d/conda.sh
127-
conda activate flagscale-train
128-
elif [ -f /opt/conda/etc/profile.d/conda.sh ]; then
129-
source /opt/conda/etc/profile.d/conda.sh
130-
conda activate base
131-
fi
132-
echo "PATH=$PATH" >> $GITHUB_ENV
133-
echo "Python: $(which python3) ($(python3 --version 2>&1))"
126+
# - name: Activate Python environment
127+
# run: |
128+
# if [[ "$PLATFORM" == "cuda" ]] && [ -f /opt/miniconda3/etc/profile.d/conda.sh ]; then
129+
# source /opt/miniconda3/etc/profile.d/conda.sh
130+
# conda activate flagscale-train
131+
# elif [ -f /opt/conda/etc/profile.d/conda.sh ]; then
132+
# source /opt/conda/etc/profile.d/conda.sh
133+
# conda activate base
134+
# fi
135+
# echo "PATH=$PATH" >> $GITHUB_ENV
136+
# echo "Python: $(which python3) ($(python3 --version 2>&1))"
134137

135138
- name: Environment Setup Cuda-specific
136139
if: steps.should_run.outputs.should_run == 'true' && inputs.platform == 'cuda'
@@ -161,6 +164,12 @@ jobs:
161164
run: |
162165
set -euo pipefail
163166
167+
echo "===== Step 0: Activate Python environment ====="
168+
source /opt/conda/etc/profile.d/conda.sh
169+
conda activate base
170+
echo "PATH=$PATH" >> $GITHUB_ENV
171+
echo "Python: $(which python3) ($(python3 --version 2>&1))"
172+
164173
echo "===== Step 1: Base Environment Setup ====="
165174
# Configure MACA toolchain paths
166175
export PATH=/opt/maca/bin:$PATH
@@ -174,13 +183,11 @@ jobs:
174183
175184
echo "===== Step 3: Install Required System Tools ====="
176185
# Install essential build tools (avoid modifying Python dependencies)
177-
apt-get update -qq && apt-get install -y -qq git cmake ninja-build
186+
apt-get update -qq && apt-get install -y -qq git cmake ninja-build curl
178187
179188
echo "===== Step 4: Remove Existing TransformerEngine ====="
180189
# Prevent conflicts with preinstalled or incompatible versions
181190
python3 -m pip uninstall transformer_engine -y || true
182-
183-
184191
python3 -m pip install nvdlfw-inspect --no-deps || true
185192
186193
# echo "===== Step 5: Install Metax Binary Backend ====="
@@ -272,7 +279,7 @@ jobs:
272279
timeout-minutes: 60
273280

274281
- name: Generate Coverage Report
275-
if: inputs.upload_coverage && matrix.test_group.name == 'pytorch_unittest'
282+
if: inputs.upload_coverage && matrix.test_group.test_type == 'unittest'
276283
working-directory: ${{ github.workspace }}
277284
env:
278285
PLATFORM: ${{ inputs.platform }}
@@ -286,45 +293,19 @@ jobs:
286293
# Generate JSON coverage report (requires .coverage data from pytest --cov)
287294
python3 -m coverage json -o "coverage-${PLATFORM}-${DEVICE}.json" \
288295
--include="transformer_engine/*" 2>/dev/null || echo "WARNING: No coverage data found, skipping coverage-${PLATFORM}-${DEVICE}.json"
289-
290-
# Generate a JSON test report from JUnit XML logs
291-
python3 - <<'PYEOF'
292-
import json, glob, os, xml.etree.ElementTree as ET
293-
platform = os.environ["PLATFORM"]
294-
device = os.environ["DEVICE"]
295-
results = {"platform": platform, "device": device, "test_suites": []}
296-
for xml_file in sorted(glob.glob("/logs/**/*.xml", recursive=True)):
297-
try:
298-
tree = ET.parse(xml_file)
299-
root = tree.getroot()
300-
suite = {
301-
"name": root.get("name", os.path.basename(xml_file)),
302-
"tests": int(root.get("tests", 0)),
303-
"errors": int(root.get("errors", 0)),
304-
"failures": int(root.get("failures", 0)),
305-
"skipped": int(root.get("skipped", 0)),
306-
"time": float(root.get("time", 0)),
307-
}
308-
results["test_suites"].append(suite)
309-
except Exception as e:
310-
print(f"WARNING: Failed to parse {xml_file}: {e}")
311-
with open(f"report-{platform}-{device}.json", "w") as f:
312-
json.dump(results, f, indent=2)
313-
print(f"Generated report-{platform}-{device}.json with {len(results['test_suites'])} suites")
314-
PYEOF
315296
continue-on-error: true
316297

317298
- name: Upload Coverage Report
318-
if: inputs.upload_coverage && matrix.test_group.name == 'pytorch_unittest'
299+
if: inputs.upload_coverage && matrix.test_group.test_type == 'unittest'
319300
uses: actions/upload-artifact@v4
301+
continue-on-error: true
320302
with:
321303
name: coverage-${{ inputs.platform }}-${{ inputs.device }}
322304
path: |
323305
coverage-${{ inputs.platform }}-${{ inputs.device }}.json
324-
report-${{ inputs.platform }}-${{ inputs.device }}.json
325306
326307
- name: Upload Coverage Report to FlagCICD
327-
if: inputs.upload_coverage && matrix.test_group.name == 'pytorch_unittest'
308+
if: inputs.upload_coverage && matrix.test_group.test_type == 'unittest'
328309
uses: flagos-ai/FlagOps/actions/post-pytest-report@v2
329310
continue-on-error: true
330311
with:

0 commit comments

Comments
 (0)