|
| 1 | +name: PaddlePaddle CMake Wheel Build |
| 2 | +run-name: Runs on ${{ github.event_name }} |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + agile_branch: |
| 8 | + description: 'Branch for compilation' |
| 9 | + required: false |
| 10 | + default: 'develop' |
| 11 | + agile_revision: |
| 12 | + description: 'Git commit or revision hash' |
| 13 | + required: false |
| 14 | + default: 'ef256258ca705ee3b4d709d7dec0332f33988c22' |
| 15 | + |
| 16 | + workflow_call: |
| 17 | + inputs: |
| 18 | + agile_branch: |
| 19 | + required: false |
| 20 | + type: string |
| 21 | + default: 'develop' |
| 22 | + agile_revision: |
| 23 | + required: false |
| 24 | + type: string |
| 25 | + default: 'ef256258ca705ee3b4d709d7dec0332f33988c22' |
| 26 | + |
| 27 | + repository_dispatch: |
| 28 | + types: [cebuild-mac-arm] |
| 29 | + |
| 30 | +jobs: |
| 31 | + prepare-source: |
| 32 | + runs-on: [self-hosted] |
| 33 | + env: |
| 34 | + AGILE_COMPILE_BRANCH: ${{ github.event.client_payload.agile_branch || github.event.inputs.agile_branch || inputs.agile_branch || 'develop' }} |
| 35 | + AGILE_REVISION: ${{ github.event.client_payload.agile_revision || github.event.inputs.agile_revision || inputs.agile_revision || 'ef256258ca705ee3b4d709d7dec0332f33988c22' }} |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Prepare Paddle Source Code |
| 39 | + id: set-output |
| 40 | + run: | |
| 41 | + set -xe |
| 42 | + workspace=$(pwd) |
| 43 | +
|
| 44 | + echo "开始清空当前目录下所有文件..." |
| 45 | + rm -rf "$workspace"/* |
| 46 | + echo "当前目录已清空,开始重新下载 Paddle.tar..." |
| 47 | + url="https://paddle-qa.bj.bcebos.com/CodeSync/${AGILE_COMPILE_BRANCH}/${AGILE_REVISION}/Paddle.tar" |
| 48 | + wget -q --no-proxy ${url} --no-check-certificate || wget_failed=101 |
| 49 | + if [[ "${wget_failed}" == "101" ]]; then |
| 50 | + echo "wget failed, start cloning..." |
| 51 | + git clone https://github.com/PaddlePaddle/Paddle.git --depth=100 -b ${AGILE_COMPILE_BRANCH} Paddle |
| 52 | + else |
| 53 | + tar xf Paddle.tar |
| 54 | + fi |
| 55 | +
|
| 56 | + cd Paddle |
| 57 | + git reset --hard ${AGILE_REVISION} |
| 58 | + git submodule update --init --recursive |
| 59 | + git log -10 |
| 60 | + mkdir -p BUILD_RESULT |
| 61 | +
|
| 62 | + build-wheels: |
| 63 | + runs-on: [self-hosted] |
| 64 | + needs: prepare-source |
| 65 | + strategy: |
| 66 | + fail-fast: false |
| 67 | + max-parallel: 1 |
| 68 | + matrix: |
| 69 | + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 70 | + env: |
| 71 | + AGILE_COMPILE_BRANCH: develop |
| 72 | + AGILE_REVISION: ef256258ca705ee3b4d709d7dec0332f33988c22 |
| 73 | + GENERATOR: Ninja |
| 74 | + MACOSX_DEPLOYMENT_TARGET: 10.11 |
| 75 | + PADDLE_DEV_NAME: paddlepaddle/paddle:dev |
| 76 | + COVERALLS_UPLOAD: OFF |
| 77 | + WITH_DEB: OFF |
| 78 | + RUN_TEST: OFF |
| 79 | + WITH_DISTRIBUTE: ON |
| 80 | + WITH_FLUID_ONLY: ON |
| 81 | + WITH_INFERENCE_API_TEST: OFF |
| 82 | + INSTALL_PREFIX: /Users/paddle/CI_install_path |
| 83 | + WITH_AVX: ON |
| 84 | + PROC_RUN: 6 |
| 85 | + WITH_CACHE: ON |
| 86 | + WITH_NIGHTLY_BUILD: ${IPIPE_WITH_NIGHTLY_BUILD} |
| 87 | + NINJAJOBS: 6 |
| 88 | + |
| 89 | + steps: |
| 90 | + - name: Prepare build environment |
| 91 | + run: | |
| 92 | + cd Paddle |
| 93 | + GIT_COMMIT_TIME=$(git --no-pager show -s --format=%ci HEAD) |
| 94 | + DATE_ONLY=$(echo $GIT_COMMIT_TIME | sed "s/ .*//;s/-//g") |
| 95 | + echo "GIT_COMMIT_TIME=$GIT_COMMIT_TIME" |
| 96 | + echo "DATE_ONLY=$DATE_ONLY" |
| 97 | + if [[ "${WITH_NIGHTLY_BUILD}" == "ON" ]]; then |
| 98 | + echo "PADDLE_VERSION_SUFFIX=.dev${DATE_ONLY}" >> $GITHUB_ENV |
| 99 | + fi |
| 100 | +
|
| 101 | + - name: Build Paddle for Python ${{ matrix.python-version }} |
| 102 | + run: | |
| 103 | + cd Paddle |
| 104 | + python${{ matrix.python-version }} -m venv myenv --clear |
| 105 | + source myenv/bin/activate |
| 106 | +
|
| 107 | + echo "已切换到 Python 版本:$(python3 --version)" |
| 108 | +
|
| 109 | + python -m pip install -U pip |
| 110 | + python -m pip install wheel setuptools |
| 111 | + python -m pip install -r python/requirements.txt |
| 112 | + python -m pip install -r paddle/scripts/compile_requirements.txt |
| 113 | +
|
| 114 | + bash -x paddle/scripts/paddle_build.sh mac_m1_arm || exit 1 |
| 115 | + cp ./build/python/dist/*.whl ./BUILD_RESULT || true |
| 116 | + rm -rf ./build |
| 117 | + |
| 118 | + upload_bos: |
| 119 | + environment: CodeSync |
| 120 | + runs-on: [self-hosted] |
| 121 | + needs: build-wheels |
| 122 | + env: |
| 123 | + AK: ${{ secrets.BOS_CREDENTIAL_AK }} |
| 124 | + SK: ${{ secrets.BOS_CREDENTIAL_SK }} |
| 125 | + steps: |
| 126 | + - name: Setup Python 3.10 and Upload to BOS |
| 127 | + run: | |
| 128 | + cd Paddle |
| 129 | + set -xe |
| 130 | + PYTHON_BIN=python3.10 |
| 131 | + workspace=$(pwd) |
| 132 | + |
| 133 | + $PYTHON_BIN -m venv myenv --clear |
| 134 | + source myenv/bin/activate |
| 135 | + python -m pip install bce-python-sdk==0.9.29 |
| 136 | +
|
| 137 | + wget -q --no-proxy --no-check-certificate https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddlePaddle/PaddleTest/tools/bos_tools.py |
| 138 | + push_file=$PWD/bos_tools.py |
| 139 | +
|
| 140 | + cd ${workspace}/BUILD_RESULT |
| 141 | +
|
| 142 | + for whl_file in $(ls *.whl); do |
| 143 | + python $push_file $whl_file ${whl_package} |
| 144 | + done |
| 145 | +
|
0 commit comments