diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 649f24cfd53..e2b4d4820a0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -47,6 +47,11 @@ jobs: uses: ./.github/workflows/_IXUCA.yml needs: [Codestyle-Check] + metax: + name: metax + uses: ./.github/workflows/_Metax-X86.yml + needs: [Codestyle-Check] + #sdaa: #name: sdaa #uses: ./.github/workflows/_SDAA.yml diff --git a/.github/workflows/_Metax-X86.yaml b/.github/workflows/_Metax-X86.yaml deleted file mode 100644 index 486236955ad..00000000000 --- a/.github/workflows/_Metax-X86.yaml +++ /dev/null @@ -1,96 +0,0 @@ -name: paddle metax gpu test - -on: - workflow_dispatch: - pull_request: - types: [opened, synchronize] - branches: [develop, release/**] -permissions: read-all - -defaults: - run: - shell: bash - -jobs: - metax-gpu-test: - runs-on: paddle-metax-runner-set - # runs-on: debug-paddle-runner-set - steps: - - name: Checkout repository - run: | - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" - - git clone \ - --reference-if-able /home/runner/PaddleCustomDevice \ - --depth=1 \ - --shallow-submodules \ - --jobs=8 \ - --branch ${{ github.base_ref || github.ref_name}} \ - --recurse-submodules \ - https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git . - - if [ "${{ github.event_name }}" == "pull_request" ]; then - git fetch origin pull/${{ github.event.pull_request.number }}/head:pull/${{ github.event.pull_request.number }}/head - git checkout pull/${{ github.event.pull_request.number }}/head - - - - - paddle_branch=${{ github.base_ref || github.ref_name}} - echo $paddle_branch - # sleep 10000 - change_numbers=$(git diff --name-only remotes/origin/${paddle_branch} | wc -l) - echo $change_numbers - - - change_backend=$(git diff --name-only remotes/origin/${paddle_branch} | grep -c "backends/" || true) - echo $change_backend - change_metax_only=$(git diff --name-only remotes/origin/${paddle_branch} | grep -c "backends/metax_gpu" || true) - echo $change_metax_only - - # change_backend=$(git diff --name-only remotes/origin/${paddle_branch} | grep "backends/"| wc -l) - # echo $change_backend - # change_metax_only=$(git diff --name-only remotes/origin/${paddle_branch} | grep "backends/metax_gpu"| wc -l) - # echo $change_metax_only - - git diff --name-only remotes/origin/${paddle_branch} - - if [ $change_numbers -ne $change_backend ]; then - echo "Common file changed, continue to run metax FULL CI test ..." - elif [ $paddle_branch -eq 0 ] ; then - echo "NO metax backend changes found, skip metax FULL CI ....." - exit 0 - fi - - - # git submodule update --init --recursive - fi - - - - name: compile - run: | - # sleep 10000 - cd backends/metax_gpu - bash build.sh - - - name: run test - - run: | - cd backends/metax_gpu/tests - bash run_test.sh -j 8 - - - name: push whl - env: - PR_ID: ${{ github.event.pull_request.number }} - COMMIT_ID: ${{ github.event.pull_request.head.sha }} - run: | - pip install bce-python-sdk==0.8.74 - export AK=paddle - export SK=paddle - if [ ! -f "BosClient.py}" ]; then - wget -q --no-proxy https://xly-devops.bj.bcebos.com/home/bos_retry.tar.gz --no-check-certificate - tar xf bos_retry.tar.gz - fi - cp backends/metax_gpu/build/dist/paddle_metax_gpu*.whl . - python BosClient.py paddle_metax_gpu*.whl paddle-github-action/PaddleCustomDevice/metax_gpu/${PR_ID}/${COMMIT_ID} diff --git a/.github/workflows/_Metax-X86.yml b/.github/workflows/_Metax-X86.yml new file mode 100644 index 00000000000..c5ef96471c9 --- /dev/null +++ b/.github/workflows/_Metax-X86.yml @@ -0,0 +1,95 @@ +name: PR-CI-METAX + +on: + workflow_call: + inputs: + workflow-name: + type: string + required: false + clone_dir: + type: string + required: false + default: 'PaddlecustomDevice' + is_pr: + type: string + required: false + default: 'true' + +defaults: + run: + shell: bash + +jobs: + metax-gpu-test: + runs-on: paddle-metax-runner-set + env: + PR_ID: ${{ github.event.pull_request.number }} + COMMIT_ID: ${{ github.event.pull_request.head.sha }} + BRANCH: develop + + steps: + - name: Checkout repository + run: | + set -x + wget -q --tries=5 --no-proxy https://paddle-github-action.bj.bcebos.com/PaddleCustomDevice/PR/${PR_ID}/${COMMIT_ID}/PaddleCustomDevice.tar.gz --no-check-certificate + echo "Extracting PaddleCustomDevice.tar.gz" + tar -xf PaddleCustomDevice.tar.gz + cd PaddleCustomDevice + git config --global --add safe.directory "*" + git remote add upstream https://github.com/PaddlePaddle/PaddleCustomDevice.git + git merge ${BRANCH} --no-edit + git --no-pager log --pretty=oneline -5 + + - name: Check bypass + id: check-bypass + uses: ./PaddleCustomDevice/.github/actions/check-bypass + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + workflow-name: metax + + - name: RUN METAX-GPU + id: run-metax + if: steps.check-bypass.outputs.can-skip != 'true' + run: | + cd PaddleCustomDevice + # !!!!! SKIP IF NO METAX CHANGE !!!! + echo "=========== Checking PR Changes If METAX FULL CI Needed ===========" + change_numbers=$(git diff --name-only remotes/origin/${BRANCH} | wc -l) + change_backend=$(git diff --name-only remotes/origin/${BRANCH} | grep "backends/"| wc -l) + change_metax_only=$(git diff --name-only remotes/origin/${BRANCH} | grep "backends/metax_gpu"| wc -l) + git --no-pager diff --name-only remotes/origin/${BRANCH} + if [ $change_numbers -ne $change_backend ]; then + echo "Common file changed, continue to run METAX FULL CI test ..." + echo "should_skip=false" >> $GITHUB_OUTPUT + elif [ $change_metax_only -eq 0 ] ; then + echo "NO METAX backend changes found, skip METAX FULL CI ...." + echo "should_skip=true" >> $GITHUB_OUTPUT + exit 0 + else + echo "should_skip=false" >> $GITHUB_OUTPUT + fi + + - name: compile + run: | + cd PaddleCustomDevice/backends/metax_gpu + bash build.sh + + - name: run test + run: | + cd PaddleCustomDevice/backends/metax_gpu/tests + bash run_test.sh -j 8 + + - name: push whl + env: + PR_ID: ${{ github.event.pull_request.number }} + COMMIT_ID: ${{ github.event.pull_request.head.sha }} + run: | + pip install bce-python-sdk==0.8.74 + export AK=paddle + export SK=paddle + if [ ! -f "BosClient.py}" ]; then + wget -q --no-proxy https://xly-devops.bj.bcebos.com/home/bos_retry.tar.gz --no-check-certificate + tar xf bos_retry.tar.gz + fi + cp PaddleCustomDevice/backends/metax_gpu/build/dist/paddle_metax_gpu*.whl . + python BosClient.py paddle_metax_gpu*.whl paddle-github-action/PaddleCustomDevice/metax_gpu/${PR_ID}/${COMMIT_ID}