Skip to content

Commit f0b94b7

Browse files
committed
add publish job
1 parent a12d0bc commit f0b94b7

File tree

7 files changed

+425
-15
lines changed

7 files changed

+425
-15
lines changed

.github/workflows/_build_linux.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,22 @@ on:
2222
description: "Enable nightly build mode (e.g. add date suffix to version)"
2323
required: false
2424
type: string
25-
default: "ON"
25+
default: "OFF"
2626
FD_VERSION:
2727
description: "FastDeploy Package Version"
2828
required: false
2929
type: string
3030
default: ""
31+
PADDLEVERSION:
32+
description: "Paddle Version Build Use"
33+
required: false
34+
type: string
35+
default: ""
36+
PADDLE_WHL_URL:
37+
description: "Paddle Wheel Package URL"
38+
required: false
39+
type: string
40+
default: ""
3141
UPLOAD:
3242
description: "Upload Package"
3343
required: false
@@ -85,6 +95,10 @@ jobs:
8595
compile_arch: ${{ inputs.COMPILE_ARCH }}
8696
fd_version: ${{ inputs.FD_VERSION }}
8797
CACHE_DIR: ${{ inputs.CACHE_DIR }}
98+
BRANCH_REF: ${{ github.ref_name }}
99+
PADDLEVERSION: ${{ inputs.PADDLEVERSION }}
100+
PADDLE_WHL_URL: ${{ inputs.PADDLE_WHL_URL }}
101+
WITH_NIGHTLY_BUILD: ${{ inputs.WITH_NIGHTLY_BUILD }}
88102
run: |
89103
set -x
90104
runner_name="${{ runner.name }}"
@@ -109,6 +123,9 @@ jobs:
109123
-e "COMPILE_ARCH=${compile_arch}" \
110124
-e "FD_VERSION=${fd_version}" \
111125
-e "WITH_NIGHTLY_BUILD=${WITH_NIGHTLY_BUILD}" \
126+
-e "PADDLEVERSION=${PADDLEVERSION}" \
127+
-e "PADDLE_WHL_URL=${PADDLE_WHL_URL}" \
128+
-e "BRANCH_REF=${BRANCH_REF}" \
112129
--gpus "\"device=${gpu_id}\"" ${docker_image} /bin/bash -c '
113130
if [[ -n "${FD_VERSION}" ]]; then
114131
export FASTDEPLOY_VERSION=${FD_VERSION}
@@ -124,7 +141,15 @@ jobs:
124141
echo "Date Only: $DATE_ONLY"
125142
export FASTDEPLOY_VERSION="${FASTDEPLOY_VERSION}.dev${DATE_ONLY}"
126143
fi
127-
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
144+
# 针对不同分支和tag使用不同的PaddlePaddle安装包
145+
if [[ "${PADDLE_WHL_URL}" != "" ]];then
146+
python -m pip install ${PADDLE_WHL_URL}
147+
elif [[ "${PADDLEVERSION}" != "" ]];then
148+
python -m pip install paddlepaddle-gpu==${PADDLEVERSION} -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
149+
else
150+
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
151+
fi
152+
128153
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
129154
130155
python -m pip install --upgrade pip
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI Coverage Docker Images Update
2+
description: "Docker Images Build And Upload"
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
DOCKER_IMAGE_NAME:
8+
description: "Images Name"
9+
required: true
10+
type: string
11+
default: "ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddleqa:cuda126-py310"
12+
DOCKER_IMAGE:
13+
description: "Images Name"
14+
required: false
15+
type: string
16+
default: "ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddleqa:cuda126-py310"
17+
FASTDEPLOY_ARCHIVE_URL:
18+
description: "URL of the compressed FastDeploy code archive."
19+
required: true
20+
type: string
21+
22+
jobs:
23+
docker_build:
24+
runs-on: [self-hosted, DockerBuild]
25+
steps:
26+
- name: Code Prepare
27+
shell: bash
28+
env:
29+
docker_image: ${{ inputs.DOCKER_IMAGE }}
30+
fd_archive_url: ${{ inputs.FASTDEPLOY_ARCHIVE_URL }}
31+
run: |
32+
set -x
33+
REPO="https://github.com/${{ github.repository }}.git"
34+
FULL_REPO="${{ github.repository }}"
35+
REPO_NAME="${FULL_REPO##*/}"
36+
BASE_BRANCH="${{ github.base_ref }}"
37+
38+
# Clean the repository directory before starting
39+
docker run --rm --net=host -v $(pwd):/workspace -w /workspace \
40+
-e "REPO_NAME=${REPO_NAME}" \
41+
${docker_image} /bin/bash -c '
42+
if [ -d ${REPO_NAME} ]; then
43+
echo "Directory ${REPO_NAME} exists, removing it..."
44+
rm -rf ${REPO_NAME}*
45+
fi
46+
'
47+
48+
wget -q ${fd_archive_url}
49+
tar -xf FastDeploy.tar.gz
50+
rm -rf FastDeploy.tar.gz
51+
cd FastDeploy
52+
git config --global user.name "FastDeployCI"
53+
git config --global user.email "[email protected]"
54+
git log -n 3 --oneline
55+
56+
- name: Docker Build And Upload
57+
shell: bash
58+
env:
59+
docker_image_name: ${{ inputs.DOCKER_IMAGE_NAME }}
60+
run: |
61+
cd FastDeploy/tools/dockerfile
62+
docker build -t ${docker_image_name} \
63+
-f Dockerfile.ci . \
64+
--network host
65+
docker push ${docker_image_name}

.github/workflows/_clone_linux.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ on:
1414
value: ${{ jobs.code-clone.outputs.repo_archive_url }}
1515
jobs:
1616
code-clone:
17-
runs-on:
18-
group: HK-Clone
17+
runs-on: ubuntu-latest
1918
outputs:
2019
repo_archive_url: ${{ steps.set_output.outputs.repo_archive_url }}
2120
steps:

.github/workflows/_pre_ce_test.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ on:
2727
type: string
2828
default: ""
2929

30-
concurrency:
31-
group: ${{ github.event.pull_request.number }}
32-
cancel-in-progress: true
33-
3430
jobs:
3531
run_ce_cases:
3632
runs-on: [self-hosted, PRE_CE_RUN_2Card]

.github/workflows/_unit_test_coverage.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,13 @@ jobs:
7373
CACHE_DIR: ${{ inputs.CACHE_DIR }}
7474
BASE_REF: ${{ github.event.pull_request.base.ref }}
7575
MODEL_CACHE_DIR: ${{ inputs.MODEL_CACHE_DIR }}
76+
IS_PR: ${{ github.event_name == 'pull_request' }}
7677
run: |
77-
set -x
78+
if [[ "$IS_PR" == "true" ]]; then
79+
echo "Running on PR"
80+
else
81+
echo "Not a PR"
82+
fi
7883
runner_name="${{ runner.name }}"
7984
CARD_ID=$(echo "${runner_name}" | awk -F'-' '{print $NF}')
8085
DEVICES=$(echo "$CARD_ID" | fold -w1 | paste -sd,)
@@ -133,6 +138,7 @@ jobs:
133138
-e TZ="Asia/Shanghai" \
134139
-e "fd_wheel_url=${fd_wheel_url}" \
135140
-e "BASE_REF=${BASE_REF}" \
141+
-e "IS_PR=${IS_PR}" \
136142
--gpus "\"device=${DEVICES}\"" ${docker_image} /bin/bash -c '
137143
138144
git config --global --add safe.directory /workspace/FastDeploy
@@ -160,9 +166,13 @@ jobs:
160166
coverage combine coveragedata/
161167
coverage xml -o python_coverage_all.xml
162168
COVERAGE_EXIT_CODE=0
163-
diff-cover python_coverage_all.xml --diff-file=diff.txt --fail-under=80 --json-report diff_coverage.json || COVERAGE_EXIT_CODE=9
169+
if [[ "$IS_PR" == "true" ]]; then
170+
diff-cover python_coverage_all.xml --diff-file=diff.txt --fail-under=80 --json-report diff_coverage.json || COVERAGE_EXIT_CODE=9
171+
python scripts/generate_diff_coverage_xml.py diff.txt python_coverage_all.xml
172+
else
173+
echo "Not a PR, skipping diff-cover"
174+
fi
164175
echo "COVERAGE_EXIT_CODE=${COVERAGE_EXIT_CODE}" >> exit_code.env
165-
python scripts/generate_diff_coverage_xml.py diff.txt python_coverage_all.xml
166176
'
167177
if [ -f FastDeploy/exit_code.env ]; then
168178
cat FastDeploy/exit_code.env >> $GITHUB_ENV
@@ -224,6 +234,7 @@ jobs:
224234
echo "All tests passed"
225235
226236
- name: Verify Code Coverage Threshold (80%)
237+
if: ${{ github.event_name == 'pull_request' }}
227238
shell: bash
228239
run: |
229240
cd FastDeploy

0 commit comments

Comments
 (0)