diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..537ce362d --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,24 @@ +# Codecov configuration: +# - CPU/GPU coverage reports are uploaded with separate flags +# - Codecov auto-merges them per commit/PR and reports back via status checks +coverage: + status: + project: + default: + target: auto + threshold: 1% + patch: + default: + target: auto + threshold: 1% + +flags: + cpu-tests: + carryforward: true + gpu-tests: + carryforward: true + +comment: + layout: "reach, diff, flags, files" + behavior: default + require_changes: false diff --git a/.github/workflows/ci-cpu.yml b/.github/workflows/ci-cpu.yml new file mode 100644 index 000000000..85656cec9 --- /dev/null +++ b/.github/workflows/ci-cpu.yml @@ -0,0 +1,62 @@ +name: tests-cpu + +on: + pull_request: + branches: [ "main" ] + types: [ opened, synchronize, reopened ] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + # ============ Job: test in cpu ============ + test-cpu: + runs-on: ubuntu-latest + timeout-minutes: 60 + + # tested in certain python version + strategy: + matrix: + python-version: [ "3.12" ] + + steps: + # 1. git clone code + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + + # 2. set up python + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + # 3. install dependencies + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-test.txt + + git clone --branch v4.1.0 https://github.com/princeton-nlp/SWE-bench.git + cd SWE-bench + pip install -e . + + # 4. Test with pytest + - name: Test with pytest + run: | + pip install pytest pytest-cov pytest-custom_exit_code + export PYTHONPATH="${PYTHONPATH}:${GITHUB_WORKSPACE}" + pytest tests/uni_agent/ -m="cpu and level0" --suppress-no-test-exit-code --cov=./uni_agent/ --cov-report=xml --cov-report=term + + - name: Upload CPU coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: cpu-tests diff --git a/.github/workflows/ci-gpu.yml b/.github/workflows/ci-gpu.yml new file mode 100644 index 000000000..f8d353045 --- /dev/null +++ b/.github/workflows/ci-gpu.yml @@ -0,0 +1,92 @@ +name: tests-gpu + +on: + pull_request: + branches: [ "main" ] + types: [ opened, synchronize, reopened ] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +env: + IMAGE: "verl-ci-cn-beijing.cr.volces.com/verlai/verl:vllm018.dev1" + DYNAMIC_RUNNER_ENDPOINT: "https://sh6mtrbg8demerkmc1uhk.apigateway-cn-beijing.volceapi.com/runner/create/runner" + +jobs: + # ============ Job: test in gpu ============ + setup: + runs-on: ubuntu-latest + outputs: + runner-label: ${{ steps.create-runner.outputs.runner-label }} + mlp-task-id: ${{ steps.create-runner.outputs.mlp-task-id }} + steps: + - id: create-runner + uses: volcengine/vemlp-github-runner@v1 + with: + mode: "create" + faas-url: "${{ env.DYNAMIC_RUNNER_ENDPOINT }}" + mlp-image: "${{ env.IMAGE }}" + + test-gpu: + needs: setup + runs-on: [ "${{ needs.setup.outputs.runner-label || 'L20x8' }}" ] + timeout-minutes: 60 + + # tested in certain python version + strategy: + matrix: + python-version: [ "3.12" ] + + steps: + # 1. git clone code + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + + # 2. set up python + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + # 3. install dependencies + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-test.txt -i https://pypi.org/simple + + git clone --branch v4.1.0 https://github.com/princeton-nlp/SWE-bench.git + cd SWE-bench + pip install -e . + + # 4. Test with pytest + - name: Test with pytest + run: | + pip install pytest pytest-cov pytest-custom_exit_code + export PYTHONPATH="${PYTHONPATH}:${GITHUB_WORKSPACE}" + pytest tests/uni_agent/ -m="gpu and level0" --suppress-no-test-exit-code --cov=./uni_agent/ --cov-report=xml --cov-report=term + + - name: Upload GPU coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: gpu-tests + + cleanup: + runs-on: ubuntu-latest + needs: [ setup, test-gpu ] + if: always() + steps: + - id: destroy-runner + uses: volcengine/vemlp-github-runner@v1 + with: + mode: "destroy" + faas-url: "${{ env.DYNAMIC_RUNNER_ENDPOINT }}" + mlp-task-id: "${{ needs.setup.outputs.mlp-task-id }}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5fe42532..e6c1bf8cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,66 +1,29 @@ -name: Python Backend CI - -on: - push: - branches: [ "main", "develop" ] - pull_request: - branches: [ "main" ] - types: [ opened, synchronize, reopened ] - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -jobs: - test-and-build: - runs-on: ubuntu-latest - timeout-minutes: 60 - - # tested in multi python version - strategy: - matrix: - python-version: [ "3.11", "3.12" ] - - steps: - # 1. git clone code - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - # 2. set up python - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - - # 3. install dependencies - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements-test.txt - - git clone --branch v4.1.0 https://github.com/princeton-nlp/SWE-bench.git - cd SWE-bench - pip install -e . - - # 4. Test with pytest - - name: Test with pytest - run: | - pip install pytest pytest-cov - export PYTHONPATH="${PYTHONPATH}:${GITHUB_WORKSPACE}" - pytest tests/uni_agent/ -m="cpu and level0" --cov=./uni_agent/ --cov-report=xml --cov-report=term - - # 5. Upload coverage to Codecov - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage.xml - flags: unittests - name: codecov-umbrella - fail_ci_if_error: false +# This file is used for old workflow, which changes name, to pass required tests. +# The file will be removed lately. +name: Python Backend CI + +on: + pull_request: + branches: [ "main" ] + types: [ opened, synchronize, reopened ] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + test-and-build: + runs-on: ubuntu-latest + timeout-minutes: 60 + + # tested in multi python version + strategy: + matrix: + python-version: [ "3.11", "3.12" ] + + steps: + - name: info + run: echo "deprecation workflow, will be removed lately"