Files
2026-07-13 12:40:42 +08:00

319 lines
10 KiB
YAML

name: PR-CI-SOT
on:
workflow_call:
inputs:
docker_sot_image:
type: string
required: true
clone-can-skip:
type: string
required: false
default: "false"
env:
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
TASK: paddle-CI-${{ github.event.pull_request.number }}-sot
ci_scripts: /paddle/ci
CI_name: sot
no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"
defaults:
run:
shell: bash
jobs:
check-bypass:
name: Check bypass
uses: ./.github/workflows/check-bypass.yml
with:
workflow-name: "sot"
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
build-and-test:
name: Build and Test
needs: [check-bypass]
if: ${{ needs.check-bypass.outputs.can-skip != 'true' && inputs.clone-can-skip != 'true' }}
runs-on:
group: GZ_BD-CPU
timeout-minutes: 120
steps:
- name: run container
env:
BRANCH: ${{ github.base_ref }}
work_dir: /paddle
PADDLE_ROOT: /paddle
WITH_SHARED_PHI: "ON"
WITH_MKL: "OFF"
WITH_TESTING: "OFF"
COVERALLS_UPLOAD: "OFF"
GIT_PR_ID: ${{ github.event.pull_request.number }}
PADDLE_VERSION: 0.0.0
PREC_SUFFIX: .py3
WITH_UNITY_BUILD: "ON"
PROC_RUN: 12
FLAGS_enable_eager_mode: 1
WITH_TENSORRT: "OFF"
GENERATOR: Ninja
WITH_INFERENCE_API_TEST: "OFF"
CCACHE_MAXSIZE: 50G
CCACHE_LIMIT_MULTIPLE: 0.8
WITH_AVX: "OFF"
CACHE_DIR: "/root/.cache/sot"
CCACHE_DIR: "/home/data/shared/.ccache/l1" # L1 cache on machine shared dir
CCACHE_SECONDARY_STORAGE: "file:///home/data/cfs/.ccache/l2" # L2 cache on cfs
run: |
set -x
container_name=${TASK}-$(date +%s)
echo "container_name=${container_name}" >> ${{ github.env }}
docker_image=${{ inputs.docker_sot_image }}
docker run -d -t --name ${container_name} \
-v "/home/data/cfs:/home/data/cfs" \
-v "/home/data/cfs/.cache:/root/.cache" \
-v "/home/data/shared:/home/data/shared" \
-v "/dev/shm:/dev/shm" \
-v "${{ github.workspace }}/../../..:${{ github.workspace }}/../../.." \
-v ${{ github.workspace }}:/paddle \
-e CI_name \
-e BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e work_dir \
-e PADDLE_ROOT \
-e WITH_SHARED_PHI \
-e WITH_MKL \
-e WITH_TESTING \
-e COVERALLS_UPLOAD \
-e GIT_PR_ID \
-e PADDLE_VERSION \
-e PREC_SUFFIX \
-e WITH_UNITY_BUILD \
-e PROC_RUN \
-e FLAGS_enable_eager_mode \
-e WITH_TENSORRT \
-e GENERATOR \
-e WITH_INFERENCE_API_TEST \
-e CCACHE_MAXSIZE \
-e CCACHE_LIMIT_MULTIPLE \
-e GITHUB_ENV \
-e ci_scripts \
-e WITH_AVX \
-e CACHE_DIR \
-e CCACHE_DIR \
-e CCACHE_SECONDARY_STORAGE \
-e no_proxy \
-w /paddle --network host ${docker_image}
- name: Download paddle.tar.gz and merge target branch
timeout-minutes: 30
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
rm -rf * .[^.]*
set -e
echo "Downloading Paddle.tar.gz"
wget -q --tries=5 --no-proxy https://paddle-github-action.bj.bcebos.com/PR/Paddle/${PR_ID}/${COMMIT_ID}/Paddle.tar.gz --no-check-certificate
echo "Extracting Paddle.tar.gz"
git config --global --add safe.directory ${work_dir}
tar xf Paddle.tar.gz --strip-components=1
git submodule foreach "git config --global --add safe.directory \$toplevel/\$sm_path"
rm Paddle.tar.gz
git config --global user.name "PaddleCI"
git config --global user.email "paddle_ci@example.com"
git remote add upstream https://github.com/PaddlePaddle/Paddle.git
source ${{ github.workspace }}/../../../proxy
cp ci/git_pull.sh ci/git_pull_copy.sh
git checkout $BRANCH
bash ci/git_pull_copy.sh $BRANCH
git fetch upstream $BRANCH
git checkout test
git merge --no-edit $BRANCH
git submodule update
'
- name: Determine sot ci trigger
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/determine_sot_ci_trigger.sh
determine_excode=$?
echo "determine_excode=$determine_excode" >> ${{ github.env }}
'
- name: CMake Pre-download
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/cmake-predownload.sh
EXCODE=$?
exit $EXCODE
'
- name: Build with python3.10
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 30
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
export PY_VERSION=3.10
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_setup.sh bdist_wheel
EXCODE=$?
exit $EXCODE
'
- name: Test with python3.10
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 10
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_sot_test.sh 3.10
EXCODE=$?
rm -rf ${PADDLE_ROOT}/build/CMakeCache.txt
exit $EXCODE
'
- name: Build with python3.11
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 30
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
export PY_VERSION=3.11
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_setup.sh bdist_wheel
EXCODE=$?
exit $EXCODE
'
- name: Test with python3.11
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 10
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_sot_test.sh 3.11
EXCODE=$?
rm -rf ${PADDLE_ROOT}/build/CMakeCache.txt
exit $EXCODE
'
- name: Build with python3.12
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 30
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
export PY_VERSION=3.12
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_setup.sh bdist_wheel
EXCODE=$?
exit $EXCODE
'
- name: Test with python3.12
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 10
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_sot_test.sh 3.12
EXCODE=$?
rm -rf ${PADDLE_ROOT}/build/CMakeCache.txt
exit $EXCODE
'
- name: Build with python3.13
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 30
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
export PY_VERSION=3.13
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_setup.sh bdist_wheel
EXCODE=$?
exit $EXCODE
'
- name: Test with python3.13
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 10
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_sot_test.sh 3.13
EXCODE=$?
rm -rf ${PADDLE_ROOT}/build/CMakeCache.txt
exit $EXCODE
'
- name: Build with python3.14
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 30
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
export PY_VERSION=3.14
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_setup.sh bdist_wheel
EXCODE=$?
rm -rf ${PADDLE_ROOT}/build/CMakeCache.txt
exit $EXCODE
'
- name: Test with python3.14
env:
work_dir: ${{ github.workspace }}
PADDLE_ROOT: ${{ github.workspace }}
if: ${{ env.determine_excode == 0 }}
timeout-minutes: 10
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
source ${{ github.workspace }}/../../../proxy
bash ${ci_scripts}/run_sot_test.sh 3.14
EXCODE=$?
rm -rf ${PADDLE_ROOT}/build/CMakeCache.txt
exit $EXCODE
'
- name: Terminate and delete the container
if: always()
run: |
set +e
docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*'
docker stop ${{ env.container_name }}
docker rm ${{ env.container_name }}