add non pipeline execution #266
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 | |
| on: | |
| pull_request: | |
| branches: | |
| - develop | |
| permissions: read-all | |
| concurrency: | |
| group: ${{ github.event.pull_request.number }}-${{ github.workflow }} | |
| cancel-in-progress: true | |
| env: | |
| PR_ID: ${{ github.event.pull_request.number || '0' }} | |
| COMMIT_ID: ${{ github.event.pull_request.head.sha || github.sha }} | |
| work_dir: /paddle | |
| PADDLE_ROOT: /paddle | |
| TASK: paddlefleet-CI-${{ github.event.pull_request.number }}-test | |
| ci_scripts: /paddle/ci | |
| BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }} | |
| CI_name: test | |
| no_proxy: "bcebos.com,.bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn" | |
| docker_image: "ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:cuda129-coverage-test" | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| check-bypass: | |
| name: Check bypass | |
| if: ${{ inputs.can-skip != 'true' }} | |
| uses: ./.github/workflows/check-bypass.yml | |
| with: | |
| workflow-name: 'test' | |
| secrets: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| single_card_test: | |
| name: Single card test | |
| needs: check-bypass | |
| if: ${{ needs.check-bypass.outputs.can-skip != 'true' }} | |
| runs-on: | |
| group: fleet-v100 | |
| env: | |
| PIP_CACHE_DIR: /root/.cache/pip | |
| steps: | |
| - name: Check docker image and run container | |
| run: | | |
| container_name=${TASK}-$(date +%Y%m%d-%H%M%S) | |
| echo "container_name=${container_name}" >> ${{ github.env }} | |
| docker pull $docker_image | |
| docker run -d -t --gpus all --name ${container_name} \ | |
| -v "/dev/shm:/dev/shm" \ | |
| -v "/home/data/cfs:/home/data/cfs" \ | |
| -v "/home/data/cfs/.cache:/root/.cache" \ | |
| -v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \ | |
| -v ${{ github.workspace }}/../../../proxy:/root/proxy \ | |
| -v ${{ github.workspace }}:/paddle \ | |
| -e BRANCH \ | |
| -e PR_ID \ | |
| -e COMMIT_ID \ | |
| -e work_dir \ | |
| -e PADDLE_ROOT \ | |
| -e ci_scripts \ | |
| -e CACHE_DIR \ | |
| -e no_proxy \ | |
| -e CI_name \ | |
| -e PIP_CACHE_DIR \ | |
| -e GITHUB_SHA="${{ github.event.pull_request.head.sha }}" \ | |
| -e GITHUB_HEAD_REF="${{ github.head_ref }}" \ | |
| -e GITHUB_BASE_SHA="${{ github.event.pull_request.base.sha }}" \ | |
| -e GITHUB_REPO_NAME="${{ github.repository }}" \ | |
| -e GITHUB_EVENT_PULL_REQUEST_NUMBER="${{ github.event.pull_request.number }}" \ | |
| -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" \ | |
| -e GITHUB_RUN_ID="${{ github.run_id }}" \ | |
| -w /paddle --network host ${docker_image} | |
| - name: Clone PaddleFleet | |
| run: | | |
| docker exec -t ${{ env.container_name }} /bin/bash -ce ' | |
| rm -rf * .[^.]* | |
| source /root/proxy | |
| git clone https://github.com/PaddlePaddle/PaddleFleet.git . | |
| git config --global --add safe.directory /paddle | |
| git config user.name "PaddleCI" | |
| git config user.email "[email protected]" | |
| git config pull.rebase false | |
| git pull --no-edit origin pull/${PR_ID}/head | |
| mkdir -p /root/.cache/pip | |
| pip cache dir | |
| echo "Install uv" | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| source $HOME/.local/bin/env | |
| echo "uv sync" | |
| uv sync --group ci -v > /dev/null | |
| ' | |
| - name: Single card test | |
| if: steps.check-bypass.outputs.can-skip != 'true' | |
| run: | | |
| docker exec -t ${{ env.container_name }} /bin/bash -xce ' | |
| source $HOME/.local/bin/env | |
| pwd | |
| export COVERAGE_FILE=/paddle/coveragedata/.coverage | |
| export COVERAGE_RCFILE=/paddle/ci/.coveragerc | |
| export WITH_COVERAGE=ON | |
| export UV_SKIP_WHEEL_FILENAME_CHECK=1 #This environment variable allows installing the latest commit-level whl package of Paddle. | |
| export UV_NO_SYNC=1 # This environment variable prevents uv sync from being executed when running un run. | |
| export UV_HTTP_TIMEOUT=300 | |
| uv pip install https://paddle-qa.bj.bcebos.com/paddle-pipeline/Develop-GpuAll-LinuxCentos-Gcc11-Cuda126-Cudnn95-Trt105-Py310-Compile/latest/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl --index-url=https://www.paddlepaddle.org.cn/packages/nightly/cu126/ | |
| bash ci/single_card_test.sh | |
| single_card_exit_code=$? | |
| ls -a /paddle/coveragedata/ | |
| uv run coverage combine | |
| uv run coverage report -m | |
| uv run coverage xml -o /paddle/coveragedata/coverage.xml | |
| if [[ "$single_card_exit_code" != "0" ]]; then | |
| echo -e "::error:: \033[31mSingle card test failed.\033[0m" | |
| exit 1 | |
| else | |
| echo -e "\033[32mSingle card test succeeded.\033[0m" | |
| fi | |
| ' | |
| - name: Single card Coverage Upload to BOS | |
| if: steps.check-bypass.outputs.can-skip != 'true' | |
| run: | | |
| docker exec -t ${{ env.container_name }} /bin/bash -xce ' | |
| source $HOME/.local/bin/env | |
| export COVERAGE_FILE=/paddle/coveragedata/.coverage | |
| export COVERAGE_RCFILE=/paddle/ci/.coveragerc | |
| export WITH_COVERAGE=ON | |
| export UV_SKIP_WHEEL_FILENAME_CHECK=1 #This environment variable allows installing the latest commit-level whl package of Paddle. | |
| export UV_NO_SYNC=1 # This environment variable prevents uv sync from being executed when running un run. | |
| wget -q --no-proxy --no-check-certificate \ | |
| https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddlePaddle/PaddleTest/tools/bos_tools.py \ | |
| -O bos_tools.py | |
| push_file=$(realpath bos_tools.py) | |
| cp /paddle/coveragedata/coverage.xml coverage.xml | |
| target_path="paddle-github-action/${GITHUB_REPO_NAME}/pull/${PR_ID}/${GITHUB_SHA}/single-card" | |
| uv run ${push_file} coverage.xml ${target_path} | |
| ' | |
| - name: Terminate and delete the container | |
| if: ${{ steps.check-bypass.outputs.can-skip != 'true' && always() }} | |
| run: | | |
| set +e | |
| docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*' | |
| docker rm -f ${{ env.container_name }} | |
| multi-card_test: | |
| name: Multi-card test | |
| needs: check-bypass | |
| if: ${{ needs.check-bypass.outputs.can-skip != 'true' }} | |
| runs-on: | |
| group: CI-H | |
| env: | |
| PIP_CACHE_DIR: /root/.cache/pip | |
| steps: | |
| - name: Check docker image and run container | |
| run: | | |
| container_name=${TASK}-$(date +%Y%m%d-%H%M%S) | |
| echo "container_name=${container_name}" >> ${{ github.env }} | |
| docker pull $docker_image | |
| docker run -d -t --gpus all --name ${container_name} \ | |
| -v "/dev/shm:/dev/shm" \ | |
| -v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \ | |
| -v ${{ github.workspace }}/../../../proxy:/root/proxy \ | |
| -v ${{ github.workspace }}/../../../.cache:/root/.cache \ | |
| -v ${{ github.workspace }}:/paddle \ | |
| -e BRANCH \ | |
| -e PR_ID \ | |
| -e COMMIT_ID \ | |
| -e work_dir \ | |
| -e PADDLE_ROOT \ | |
| -e ci_scripts \ | |
| -e CACHE_DIR \ | |
| -e no_proxy \ | |
| -e CI_name \ | |
| -e PIP_CACHE_DIR \ | |
| -e GITHUB_SHA="${{ github.event.pull_request.head.sha }}" \ | |
| -e GITHUB_HEAD_REF="${{ github.head_ref }}" \ | |
| -e GITHUB_BASE_SHA="${{ github.event.pull_request.base.sha }}" \ | |
| -e GITHUB_REPO_NAME="${{ github.repository }}" \ | |
| -e GITHUB_EVENT_NAME="${{ github.event_name }}" \ | |
| -e GITHUB_EVENT_PULL_REQUEST_NUMBER="${{ github.event.pull_request.number }}" \ | |
| -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" \ | |
| -e GITHUB_RUN_ID="${{ github.run_id }}" \ | |
| -w /paddle --network host ${docker_image} | |
| - name: Clone PaddleFleet | |
| run: | | |
| docker exec -t ${{ env.container_name }} /bin/bash -ce ' | |
| rm -rf * .[^.]* | |
| source /root/proxy | |
| git clone https://github.com/PaddlePaddle/PaddleFleet.git . | |
| git config --global --add safe.directory /paddle | |
| git config user.name "PaddleCI" | |
| git config user.email "[email protected]" | |
| git config pull.rebase false | |
| git pull --no-edit origin pull/${PR_ID}/head | |
| mkdir -p /root/.cache/pip | |
| pip cache dir | |
| echo "Install uv" | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| source $HOME/.local/bin/env | |
| echo "uv sync" | |
| uv sync --group ci -v > /dev/null | |
| wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq | |
| chmod +x /usr/local/bin/yq | |
| ' | |
| - name: Multi-card test | |
| if: steps.check-bypass.outputs.can-skip != 'true' | |
| run: | | |
| docker exec -t ${{ env.container_name }} /bin/bash -ce ' | |
| source $HOME/.local/bin/env | |
| export COVERAGE_FILE=/paddle/coveragedata/.coverage | |
| export COVERAGE_RCFILE=/paddle/ci/.coveragerc | |
| export WITH_COVERAGE=ON | |
| export UV_SKIP_WHEEL_FILENAME_CHECK=1 #This environment variable allows installing the latest commit-level whl package of Paddle. | |
| export UV_NO_SYNC=1 # This environment variable prevents uv sync from being executed when running un run. | |
| export UV_HTTP_TIMEOUT=300 | |
| uv pip install https://paddle-qa.bj.bcebos.com/paddle-pipeline/Develop-GpuAll-LinuxCentos-Gcc11-Cuda129-Cudnn99-Trt105-Py310-Compile/latest/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl --index-url=https://www.paddlepaddle.org.cn/packages/nightly/cu129/ | |
| bash ci/multi-card_test.sh | |
| multi_card_exit_code=$? | |
| ls -a /paddle/coveragedata/ | |
| uv run coverage combine | |
| uv run coverage xml -o /paddle/coveragedata/coverage.xml | |
| uv run coverage report -m | |
| if [[ "$multi_card_exit_code" != "0" ]]; then | |
| echo -e "::error:: \033[31mMulti card test failed.\033[0m" | |
| exit 1 | |
| else | |
| echo -e "\033[32mMulti card test succeeded.\033[0m" | |
| fi | |
| ' | |
| - name: Multi-card Coverage Upload to BOS | |
| if: steps.check-bypass.outputs.can-skip != 'true' | |
| run: | | |
| docker exec -t ${{ env.container_name }} /bin/bash -xce ' | |
| source $HOME/.local/bin/env | |
| export COVERAGE_FILE=/paddle/coveragedata/.coverage | |
| export COVERAGE_RCFILE=/paddle/ci/.coveragerc | |
| export WITH_COVERAGE=ON | |
| export UV_SKIP_WHEEL_FILENAME_CHECK=1 #This environment variable allows installing the latest commit-level whl package of Paddle. | |
| export UV_NO_SYNC=1 # This environment variable prevents uv sync from being executed when running un run. | |
| wget -q --no-proxy --no-check-certificate \ | |
| https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddlePaddle/PaddleTest/tools/bos_tools.py \ | |
| -O bos_tools.py | |
| push_file=$(realpath bos_tools.py) | |
| cp /paddle/coveragedata/coverage.xml coverage.xml | |
| target_path="paddle-github-action/${GITHUB_REPO_NAME}/pull/${PR_ID}/${GITHUB_SHA}/multi-card" | |
| uv run ${push_file} coverage.xml ${target_path} | |
| ' | |
| - name: Terminate and delete the container | |
| if: ${{ steps.check-bypass.outputs.can-skip != 'true' && always() }} | |
| run: | | |
| set +e | |
| docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*' | |
| docker rm -f ${{ env.container_name }} | |
| coverage_check: | |
| name: Coverage Upload And Check | |
| needs: [multi-card_test, single_card_test, check-bypass] | |
| if: ${{ needs.check-bypass.outputs.can-skip != 'true' }} | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_REPO_NAME: ${{ github.repository }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Fetch base branch | |
| run: | | |
| echo "Fetching base branch: ${{ github.event.pull_request.base.ref }}" | |
| git fetch origin ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }} | |
| - name: coverage file download | |
| shell: bash | |
| run: | | |
| multi_card_cov_file_url="https://paddle-github-action.bj.bcebos.com/${GITHUB_REPO_NAME}/pull/${PR_ID}/${COMMIT_ID}/multi-card/coverage.xml" | |
| wget "${multi_card_cov_file_url}" -O multi_coverage.xml --no-proxy | |
| single_card_cov_file_url="https://paddle-github-action.bj.bcebos.com/${GITHUB_REPO_NAME}/pull/${PR_ID}/${COMMIT_ID}/single-card/coverage.xml" | |
| wget "${single_card_cov_file_url}" -O single_coverage.xml --no-proxy | |
| sed -i 's|<source>/paddle/paddlefleet</source>|<source>paddlefleet</source>|' multi_coverage.xml | |
| sed -i 's|<source>/paddle/paddlefleet</source>|<source>paddlefleet</source>|' single_coverage.xml | |
| git diff origin/${{ github.event.pull_request.base.ref }}..HEAD --unified=0 > diff.txt | |
| python -m pip install diff-cover | |
| COVERAGE_EXIT_CODE=0 | |
| diff-cover multi_coverage.xml single_coverage.xml --diff-file=diff.txt --fail-under=90 || COVERAGE_EXIT_CODE=9 | |
| exit ${COVERAGE_EXIT_CODE} | |
| - name: Upload coverage to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./multi_coverage.xml, ./single_coverage.xml | |
| flags: coverage_combine | |
| name: "${{ env.TASK }}-${{ github.run_id }}" | |
| fail_ci_if_error: true | |
| verbose: true |