|
| 1 | +name: PaddlePaddle Mac M1 Wheel Build |
| 2 | +run-name: Runs on ${{ github.event_name }} |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + workflow_call: |
| 7 | + repository_dispatch: |
| 8 | + types: [cmake-build] |
| 9 | + |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-wheels: |
| 13 | + runs-on: [self-hosted, GPU-8Card] |
| 14 | + env: |
| 15 | + PY_VERSION: 3.13 |
| 16 | + |
| 17 | + steps: |
| 18 | + # - name: Download or Clone Paddle source code |
| 19 | + # run: | |
| 20 | + # set -x |
| 21 | + # workspace=$(pwd) |
| 22 | + # AGILE_COMPILE_BRANCH=develop |
| 23 | + # AGILE_REVISION=ef256258ca705ee3b4d709d7dec0332f33988c22 |
| 24 | + # url="https://paddle-qa.bj.bcebos.com/CodeSync/${AGILE_COMPILE_BRANCH}/${AGILE_REVISION}/Paddle.tar" |
| 25 | + # wget -q --no-proxy ${url} --no-check-certificate || wget_failed=101 |
| 26 | + # if [[ "${wget_failed}" == "101" ]]; then |
| 27 | + # echo "wget failed, start cloning..." |
| 28 | + # git clone https://github.com/PaddlePaddle/Paddle.git --depth=100 -b ${AGILE_COMPILE_BRANCH} |
| 29 | + # else |
| 30 | + # tar xf Paddle.tar |
| 31 | + # fi |
| 32 | + |
| 33 | + - name: Checkout Paddle code to specified revision |
| 34 | + run: | |
| 35 | + cd Paddle |
| 36 | + git reset --hard ef256258ca705ee3b4d709d7dec0332f33988c22 |
| 37 | + git submodule update --init --recursive |
| 38 | + git log -10 |
| 39 | + mkdir -p BUILD_RESULT |
| 40 | +
|
| 41 | + - name: Prepare build environment |
| 42 | + run: | |
| 43 | + cd Paddle |
| 44 | + export GENERATOR=Ninja |
| 45 | + export MACOSX_DEPLOYMENT_TARGET=10.11 |
| 46 | + export PADDLE_DEV_NAME=paddlepaddle/paddle:dev |
| 47 | + export COVERALLS_UPLOAD=OFF |
| 48 | + export WITH_DEB=OFF |
| 49 | + export RUN_TEST=OFF |
| 50 | + export WITH_DISTRIBUTE=ON |
| 51 | + export WITH_FLUID_ONLY=ON |
| 52 | + export WITH_INFERENCE_API_TEST=OFF |
| 53 | + export INSTALL_PREFIX=/Users/paddle/CI_install_path |
| 54 | + export WITH_AVX=ON |
| 55 | + export PROC_RUN=6 |
| 56 | + export WITH_CACHE=ON |
| 57 | + export WITH_NIGHTLY_BUILD=${IPIPE_WITH_NIGHTLY_BUILD} |
| 58 | + export NINJAJOBS=6 |
| 59 | +
|
| 60 | + GIT_COMMIT_TIME=$(git --no-pager show -s --format=%ci HEAD) |
| 61 | + DATE_ONLY=$(echo $GIT_COMMIT_TIME | sed "s/ .*//;s/-//g") |
| 62 | + echo "Git Commit Time: $GIT_COMMIT_TIME" |
| 63 | + echo "Date Only: $DATE_ONLY" |
| 64 | + if [[ "${WITH_NIGHTLY_BUILD}" == "ON" ]]; then |
| 65 | + export PADDLE_VERSION="${PADDLE_VERSION}.dev${DATE_ONLY}" |
| 66 | + fi |
| 67 | + set +e |
| 68 | +
|
| 69 | + python${{ env.PY_VERSION }} -m venv myenv --clear |
| 70 | + source myenv/bin/activate |
| 71 | +
|
| 72 | + echo "已切换到 Python 版本:$(python3 --version)" |
| 73 | + echo "Python3位置:$(which python${{ env.PY_VERSION }})" |
| 74 | + |
| 75 | + python -m pip install --upgrade pip |
| 76 | + python -m pip install -r python/requirements.txt |
| 77 | + python -m pip install -r paddle/scripts/compile_requirements.txt |
| 78 | + python -m pip install wheel setuptools |
| 79 | + |
| 80 | + bash -x paddle/scripts/paddle_build.sh mac_m1_arm || exit 1 |
| 81 | + cp ./build/python/dist/*.whl ./BUILD_RESULT || true |
| 82 | + rm -rf ./build |
| 83 | +
|
| 84 | + # - name: Switch to Python version ${{ env.PY_VERSION }} |
| 85 | + # run: | |
| 86 | + # chmod +x ~/switch_python.sh |
| 87 | + # # 调用切换脚本,传入版本号参数 |
| 88 | + # source ~/switch_python.sh ${{ env.PY_VERSION }} |
| 89 | + # echo "当前 python 路径:$(which python3)" |
| 90 | + # python3 --version |
| 91 | + |
| 92 | + # - name: Build Paddle |
| 93 | + # run: | |
| 94 | + # cd Paddle |
| 95 | + # python${{ env.PY_VERSION }} -m venv myenv --clear |
| 96 | + # source myenv/bin/activate |
| 97 | + |
| 98 | + # echo "已切换到 Python 版本:$(python3 --version)" |
| 99 | + # echo "Python3位置:$(which python${{ env.PY_VERSION }})" |
| 100 | + |
| 101 | + # python -m pip install --upgrade pip |
| 102 | + # python -m pip install -r python/requirements.txt |
| 103 | + # python -m pip install -r paddle/scripts/compile_requirements.txt |
| 104 | + # python -m pip install wheel setuptools |
| 105 | + |
| 106 | + # bash -x paddle/scripts/paddle_build.sh mac_m1_arm || exit 1 |
| 107 | + # cp ./build/python/dist/*.whl ./BUILD_RESULT || true |
| 108 | + # rm -rf ./build |
| 109 | + |
| 110 | + # - name: Build Paddle |
| 111 | + # shell: bash |
| 112 | + # run: | |
| 113 | + # #PYTHON_VERSION=${{ env.PY_VERSION }} |
| 114 | + # #PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/$PYTHON_VERSION" |
| 115 | + # #export P |
| 116 | + # python${{ env.PY_VERSION }} -m venv myenv --clear |
| 117 | + # #source myenv/bin/activate |
| 118 | + # export PATH=myenv/bin:${PATH} |
| 119 | + # export DYLD_LIBRARY_PATH=myenv/lib:${DYLD_LIBRARY_PATH} |
| 120 | + # python -m pip list |
| 121 | + # python --version |
| 122 | + |
| 123 | + # python -m pip install -r python/requirements.txt |
| 124 | + # python -m pip install -r paddle/scripts/compile_requirements.txt |
| 125 | + # python -m pip install wheel |
| 126 | + # python -m pip install setuptools |
| 127 | + # python -m pip list |
| 128 | + # bash -x paddle/scripts/paddle_build.sh mac_m1_arm || exit 1 |
| 129 | + # cp ./build/python/dist/*.whl ./BUILD_RESULT || true |
| 130 | + # rm -rf ./build |
| 131 | + |
| 132 | + |
| 133 | + - name: Upload build results |
| 134 | + uses: actions/upload-artifact@v4 |
| 135 | + with: |
| 136 | + name: paddle-whl-${{ github.run_number }} |
| 137 | + path: Paddle/BUILD_RESULT |
| 138 | + if-no-files-found: ignore |
| 139 | + |
| 140 | + - name: Upload failure marker if build failed |
| 141 | + if: failure() |
| 142 | + run: echo "Build failed for Python ${{ env.PY_VERSION }}" > build_failed.txt |
| 143 | + |
| 144 | + - name: Upload failure artifact |
| 145 | + if: always() |
| 146 | + uses: actions/upload-artifact@v4 |
| 147 | + with: |
| 148 | + name: build-failed-marker |
| 149 | + path: build_failed.txt |
| 150 | + if-no-files-found: ignore |
0 commit comments