Refactor rollout topology and rollout metadata #2330
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: unit_test | |
| on: | |
| pull_request: | |
| branches: | |
| - "main" | |
| paths-ignore: | |
| - "docs/**" | |
| - "**.md" | |
| - "autotest/**" | |
| - ".github/workflows/ete_test_gpu.yaml" | |
| - ".github/workflows/ete_test_npu.yaml" | |
| - ".github/workflows/lint.yml" | |
| env: | |
| WORKSPACE_PREFIX: $(echo $GITHUB_WORKSPACE |cut -d '/' -f 1-5) | |
| WORKSPACE_PREFIX_SHORT: $(echo $GITHUB_WORKSPACE |cut -d '/' -f 1-3) | |
| IMAGE: ailab-llmrazor/xtuner:pt29_20260520_fb46fea | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| detect_changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| only_rl: ${{ steps.filter.outputs.only_rl }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - id: filter | |
| name: Detect changed paths | |
| run: | | |
| if ! changed_files="$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" 2>/dev/null)"; then | |
| changed_files="$(git diff --name-only HEAD^1 HEAD)" | |
| fi | |
| only_rl=true | |
| if [ -z "$changed_files" ]; then | |
| only_rl=false | |
| else | |
| while IFS= read -r file; do | |
| case "$file" in | |
| tests/rl/*|xtuner/v1/rl/*) | |
| ;; | |
| *) | |
| only_rl=false | |
| break | |
| ;; | |
| esac | |
| done <<< "$changed_files" | |
| fi | |
| echo "$changed_files" | |
| echo "only_rl=$only_rl" | |
| echo "only_rl=$only_rl" >> "$GITHUB_OUTPUT" | |
| lint: | |
| runs-on: ubuntu-latest | |
| needs: detect_changes | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.12 | |
| - name: Install pre-commit hook | |
| run: | | |
| pip install pre-commit | |
| pre-commit install | |
| - name: Linting | |
| run: | | |
| if [ "${{ needs.detect_changes.outputs.only_rl }}" = "true" ]; then | |
| lint_target="xtuner/v1/rl" | |
| else | |
| lint_target="xtuner/v1" | |
| fi | |
| pre-commit run --files $(find "$lint_target" -type f) | |
| unit_test: | |
| runs-on: [h_cluster] | |
| needs: | |
| - detect_changes | |
| - lint | |
| steps: | |
| - name: mask env | |
| run: | | |
| echo "::add-mask::${{env.WORKSPACE_PREFIX}}" | |
| echo "::add-mask::${{env.WORKSPACE_PREFIX_SHORT}}" | |
| sudo git clean -ffdx | |
| - uses: actions/checkout@v3 | |
| - name: unit-test | |
| run: | | |
| export PYTHONPYCACHEPREFIX=/tmp | |
| if [ "${{ needs.detect_changes.outputs.only_rl }}" = "true" ]; then | |
| test_target="tests/rl" | |
| else | |
| test_target="tests" | |
| fi | |
| echo "test_target=$test_target" | |
| python ci/scripts/xtuner_unittest.py "$IMAGE_INNER/$IMAGE" "source ${{env.WORKSPACE_PREFIX}}/BASE_ENV.sh;source ci/scripts/CI_ENV.sh" "pytest $test_target" |