|
| 1 | +name: paddle metax build and publish |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + - cron: '0 18 * * *' # 2:00 AM China Standard Time (UTC+8) |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - '*' |
| 10 | + |
| 11 | +permissions: read-all |
| 12 | + |
| 13 | +defaults: |
| 14 | + run: |
| 15 | + shell: bash |
| 16 | + |
| 17 | +jobs: |
| 18 | + metax-gpu-publish: |
| 19 | + environment: PublishUploadUse |
| 20 | + runs-on: paddle-metax-runner-set |
| 21 | + steps: |
| 22 | + - name: Checkout repository |
| 23 | + run: | |
| 24 | + git config --global user.name "GitHub Actions" |
| 25 | + git config --global user.email "actions@github.com" |
| 26 | +
|
| 27 | + git clone \ |
| 28 | + --reference-if-able /home/runner/PaddleCustomDevice \ |
| 29 | + --depth=1 \ |
| 30 | + --shallow-submodules \ |
| 31 | + --jobs=8 \ |
| 32 | + --branch ${{ github.base_ref || github.ref_name}} \ |
| 33 | + --recurse-submodules \ |
| 34 | + https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git . |
| 35 | +
|
| 36 | +
|
| 37 | + - name: compile |
| 38 | + run: | |
| 39 | + if [[ "${{ github.ref_name }}" == "develop" ]];then |
| 40 | + GIT_COMMIT_TIME=$(git --no-pager show -s --format=%ci HEAD) |
| 41 | + DATE_ONLY=$(echo $GIT_COMMIT_TIME | sed "s/ .*//;s/-//g") |
| 42 | + echo "Git Commit Time: $GIT_COMMIT_TIME" |
| 43 | + echo "Date Only: $DATE_ONLY" |
| 44 | + export PADDLE_VERSION="${PaddleCustomDeviceVersion}.dev${DATE_ONLY}" |
| 45 | + export PLUGIN_VERSION="${PaddleCustomDeviceVersion}.dev${DATE_ONLY}" |
| 46 | + else |
| 47 | + TAG_REF="${{ github.ref_name }}" |
| 48 | + VERSION="${TAG_REF#v}" |
| 49 | + echo "VERSION=$VERSION" |
| 50 | + export PADDLE_VERSION="${VERSION}" |
| 51 | + export PLUGIN_VERSION="${VERSION}" |
| 52 | + fi |
| 53 | + cd backends/metax_gpu |
| 54 | + bash build.sh |
| 55 | +
|
| 56 | + - name: push whl |
| 57 | + env: |
| 58 | + AK: ${{ secrets.BOS_AK }} |
| 59 | + SK: ${{ secrets.BOS_SK }} |
| 60 | + run: | |
| 61 | + if [[ "${{ github.ref_name }}" == "develop" ]];then |
| 62 | + target_path="paddle-whl/nightly/maca/paddle-metax-gpu" |
| 63 | + elif [[ "${{ github.ref_type }}" == "tag" ]]; then |
| 64 | + target_path="paddle-whl/stable/maca/paddle-metax-gpu" |
| 65 | + else |
| 66 | + echo "Not develop or tag, do nothing" |
| 67 | + fi |
| 68 | + pip install bce-python-sdk==0.8.74 |
| 69 | +
|
| 70 | + if [ ! -f "BosClient.py}" ]; then |
| 71 | + wget -q --no-proxy https://xly-devops.bj.bcebos.com/home/bos_retry.tar.gz --no-check-certificate |
| 72 | + tar xf bos_retry.tar.gz |
| 73 | + fi |
| 74 | + cp backends/metax_gpu/build/dist/paddle_metax_gpu*.whl . |
| 75 | + python BosClient.py paddle_metax_gpu*.whl ${target_path} |
0 commit comments