@@ -1400,25 +1400,54 @@ jobs:
14001400 chip_type : ['910b', '310p']
14011401 build : ['Release']
14021402 runs-on : ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
1403- container : ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc1.alpha001-910b-openeuler22.03-py3.11' || '8.2.rc1-310p-openeuler22.03-py3.11' }}
14041403 steps :
14051404 - name : Checkout
14061405 uses : actions/checkout@v4
1406+ with :
1407+ fetch-depth : 0
14071408
1408- - name : Dependencies
1409- run : |
1410- yum update -y
1411- yum install -y git gcc gcc-c++ make cmake libcurl-devel
1409+ - name : Free up disk space
1410+ 1411+ with :
1412+ tool-cache : true
14121413
1413- - name : Build
1414+ - name : Set container image
1415+ id : cann-image
14141416 run : |
1415- export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
1417+ image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc2-910b-openeuler24.03-py3.11' || '8.3.rc2-310p-openeuler24.03-py3.11' }}"
1418+ echo "image=${image}" >> "${GITHUB_OUTPUT}"
14161419
1417- cmake -S . -B build \
1418- -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
1419- -DGGML_CANN=on \
1420- -DSOC_TYPE=ascend${{ matrix.chip_type }}
1421- cmake --build build -j $(nproc)
1420+ - name : Pull container image
1421+ run : docker pull "${{ steps.cann-image.outputs.image }}"
1422+
1423+ - name : Build
1424+ env :
1425+ BUILD_TYPE : ${{ matrix.build }}
1426+ SOC_TYPE : ascend${{ matrix.chip_type }}
1427+ run : |
1428+ HOST_UID=$(id -u)
1429+ HOST_GID=$(id -g)
1430+
1431+ docker run --rm \
1432+ -v "${PWD}:/workspace" \
1433+ -w /workspace \
1434+ -e SOC_TYPE=${SOC_TYPE} \
1435+ -e BUILD_TYPE=${BUILD_TYPE} \
1436+ "${{ steps.cann-image.outputs.image }}" \
1437+ bash -lc '
1438+ set -e
1439+ yum install -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs git gcc gcc-c++ make cmake libcurl-devel
1440+ yum clean all && rm -rf /var/cache/yum
1441+ git config --global --add safe.directory "/workspace"
1442+ export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
1443+ cmake -S . -B build \
1444+ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
1445+ -DGGML_CANN=on \
1446+ -DSOC_TYPE=${SOC_TYPE}
1447+ cmake --build build -j $(nproc)
1448+
1449+ chown -R '"${HOST_UID}"':'"${HOST_GID}"' /workspace/build
1450+ '
14221451
14231452# TODO: simplify the following workflows using a matrix
14241453# TODO: run lighter CI on PRs and the full CI only on master (if needed)
0 commit comments