Skip to content

Commit 08802c5

Browse files
author
lvkunpeng
committed
add and update cmake_switch_python.file
1 parent 66d2917 commit 08802c5

File tree

2 files changed

+294
-0
lines changed

2 files changed

+294
-0
lines changed
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: PaddlePaddle CMake 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+
jobs:
11+
prepare-source:
12+
runs-on: [self-hosted, GPU-8Card]
13+
env:
14+
AGILE_COMPILE_BRANCH: develop
15+
AGILE_REVISION: ef256258ca705ee3b4d709d7dec0332f33988c22
16+
outputs:
17+
source-dir: ${{ steps.set-output.outputs.source-dir }}
18+
19+
steps:
20+
- name: Prepare Paddle Source Code
21+
id: set-output
22+
run: |
23+
set -xe
24+
workspace=$(pwd)
25+
echo "当前工作目录: $workspace"
26+
27+
# echo "开始清空当前目录下所有文件..."
28+
# rm -rf "$workspace"/*
29+
# echo "当前目录已清空,开始重新下载 Paddle.tar..."
30+
# url="https://paddle-qa.bj.bcebos.com/CodeSync/${AGILE_COMPILE_BRANCH}/${AGILE_REVISION}/Paddle.tar"
31+
# wget -q --no-proxy ${url} --no-check-certificate || wget_failed=101
32+
# if [[ "${wget_failed}" == "101" ]]; then
33+
# echo "wget failed, start cloning..."
34+
# git clone https://github.com/PaddlePaddle/Paddle.git --depth=100 -b ${AGILE_COMPILE_BRANCH} Paddle
35+
# else
36+
# tar xf Paddle.tar
37+
# fi
38+
39+
if [ -f "Paddle.tar" ]; then
40+
echo "Paddle 源码包已存在,跳过下载/clone。"
41+
tar xf Paddle.tar
42+
else
43+
url="https://paddle-qa.bj.bcebos.com/CodeSync/${AGILE_COMPILE_BRANCH}/${AGILE_REVISION}/Paddle.tar"
44+
wget -q --no-proxy ${url} --no-check-certificate || wget_failed=101
45+
if [[ "${wget_failed}" == "101" ]]; then
46+
echo "wget failed, start cloning..."
47+
git clone https://github.com/PaddlePaddle/Paddle.git --depth=100 -b ${AGILE_COMPILE_BRANCH} Paddle
48+
else
49+
tar xf Paddle.tar
50+
fi
51+
fi
52+
53+
cd Paddle
54+
git reset --hard ${AGILE_REVISION}
55+
git submodule update --init --recursive
56+
git log -10
57+
mkdir -p BUILD_RESULT
58+
59+
echo "source-dir=$workspace/Paddle" >> $GITHUB_OUTPUT
60+
echo "源码准备完毕:$workspace/Paddle"
61+
62+
build-wheels:
63+
runs-on: [self-hosted, GPU-8Card]
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+
- name: Upload Wheel for Python ${{ matrix.python-version }}
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: paddle-whl-py${{ matrix.python-version }}
122+
path: Paddle/BUILD_RESULT
123+
if-no-files-found: ignore
124+
125+
collect-artifacts:
126+
runs-on: self-hosted
127+
needs: build-wheels
128+
steps:
129+
- name: Download All Wheels
130+
uses: actions/download-artifact@v4
131+
with:
132+
path: all-wheels
133+
134+
- name: Archive All Wheels
135+
run: |
136+
mkdir -p merged
137+
find all-wheels -name '*.whl' -exec cp {} merged/ \;
138+
ls -lh merged/
139+
140+
- name: Upload Merged Wheels
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: paddle-whl-all
144+
path: merged/

.github/workflows/lkp_cmake_py313.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
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

Comments
 (0)