[CICD] flagos user tests management #8
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: Test Dispatch - User Tests | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "flagos-user-tests/tests/**" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "flagos-user-tests/tests/**" | |
| workflow_dispatch: | |
| inputs: | |
| repo: | |
| description: "Target repository (e.g., flagscale, flaggems)" | |
| required: false | |
| type: string | |
| task: | |
| description: "Task type (train/inference/hetero_train)" | |
| required: false | |
| type: string | |
| model: | |
| description: "Model name (e.g., mixtral, deepseek)" | |
| required: false | |
| type: string | |
| case: | |
| description: "Specific test case YAML path (relative to flagos-user-tests/)" | |
| required: false | |
| type: string | |
| defaults: | |
| run: | |
| working-directory: flagos-user-tests | |
| jobs: | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.resolve.outputs.matrix }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: pip install pyyaml | |
| - name: Detect changed repos | |
| id: detect | |
| uses: actions/github-script@v7 | |
| env: | |
| INPUT_CASE: ${{ inputs.case }} | |
| INPUT_REPO: ${{ inputs.repo }} | |
| INPUT_TASK: ${{ inputs.task }} | |
| INPUT_MODEL: ${{ inputs.model }} | |
| with: | |
| script: | | |
| const run = require('./.github/scripts/detect_changed_repos.js'); | |
| await run({ github, context, core }); | |
| - name: Resolve resources to matrix | |
| id: resolve | |
| working-directory: flagos-user-tests | |
| run: | | |
| python tools/resolve_matrix.py \ | |
| --changed-cases '${{ steps.detect.outputs.changed_cases }}' \ | |
| --changed-repos '${{ steps.detect.outputs.changed_repos }}' \ | |
| --changed-repos-list '${{ steps.detect.outputs.changed_repos_list }}' | |
| run-tests: | |
| name: ${{ matrix.repo }}/${{ matrix.task }}/${{ matrix.model }} | |
| needs: detect-changes | |
| if: ${{ needs.detect-changes.outputs.matrix != '' && !contains(needs.detect-changes.outputs.matrix, '_none_') }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.detect-changes.outputs.matrix) }} | |
| runs-on: ${{ fromJson(matrix.runner_labels) }} | |
| container: | |
| image: ${{ matrix.container_image }} | |
| options: ${{ matrix.container_options }} | |
| volumes: ${{ fromJson(matrix.container_volumes) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install runner dependencies | |
| shell: bash | |
| run: | | |
| if [ -n "${{ matrix.conda_env }}" ]; then | |
| source tools/activate_conda.sh ${{ matrix.conda_env }} | |
| fi | |
| pip install pyyaml | |
| - name: Run user tests | |
| shell: bash | |
| run: | | |
| if [ -n "${{ matrix.conda_env }}" ]; then | |
| source tools/activate_conda.sh ${{ matrix.conda_env }} | |
| fi | |
| ARGS="" | |
| if [ -n "${{ matrix.case_path }}" ]; then | |
| ARGS="--case ${{ matrix.case_path }}" | |
| else | |
| ARGS="--repo ${{ matrix.repo }}" | |
| [ -n "${{ matrix.task }}" ] && ARGS="$ARGS --task ${{ matrix.task }}" | |
| [ -n "${{ matrix.model }}" ] && ARGS="$ARGS --model ${{ matrix.model }}" | |
| fi | |
| python tools/run_user_tests.py $ARGS |