|
| 1 | +name: buildkit-dockerfile-test |
| 2 | +# Test Dockerfile builds via docker/build-push-action@v7 on self-hosted runners |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + paths: |
| 7 | + - '.github/workflows/buildkit-dockerfile-test.yaml' |
| 8 | + - 'Dockerfile.a3' |
| 9 | + - 'Dockerfile.a3.openEuler' |
| 10 | + - 'Dockerfile.openEuler' |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-test: |
| 15 | + name: "${{ matrix.dockerfile }} (${{ matrix.runner_info.arch }})" |
| 16 | + runs-on: ${{ matrix.runner_info.runner }} |
| 17 | + container: |
| 18 | + image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:9.0.0-a3-ubuntu22.04-py3.12 |
| 19 | + |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + dockerfile: |
| 24 | + - Dockerfile.a3 |
| 25 | + - Dockerfile.a3.openEuler |
| 26 | + - Dockerfile.openEuler |
| 27 | + runner_info: |
| 28 | + - {runner: linux-aarch64-cpu-4-buildkit-gy006, arch: arm64} |
| 29 | + - {runner: linux-amd64-cpu-4-buildkit-gy006, arch: amd64} |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v7 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + persist-credentials: false |
| 37 | + |
| 38 | + - name: Determine SOC_VERSION |
| 39 | + id: vars |
| 40 | + run: | |
| 41 | + case "${{ matrix.dockerfile }}" in |
| 42 | + Dockerfile|Dockerfile.openEuler) |
| 43 | + echo "soc_version=ascend910b1" >> $GITHUB_OUTPUT |
| 44 | + ;; |
| 45 | + Dockerfile.a3|Dockerfile.a3.openEuler) |
| 46 | + echo "soc_version=ascend910_9391" >> $GITHUB_OUTPUT |
| 47 | + ;; |
| 48 | + esac |
| 49 | +
|
| 50 | + - name: Build and push |
| 51 | + uses: docker/build-push-action@v7 |
| 52 | + with: |
| 53 | + context: . |
| 54 | + file: ${{ matrix.dockerfile }} |
| 55 | + push: true |
| 56 | + tags: | |
| 57 | + swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/test-buildkit:${{ matrix.dockerfile }}-${{ matrix.runner_info.arch }}-${{ github.sha }} |
| 58 | + swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/buildkit-cache:${{ matrix.dockerfile }}-${{ matrix.runner_info.arch }} |
| 59 | + build-args: | |
| 60 | + APTMIRROR=http://cache-service.nginx-pypi-cache.svc.cluster.local:8081 |
| 61 | + PIP_INDEX_URL=http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple |
| 62 | + PIP_TRUSTED_HOST=cache-service.nginx-pypi-cache.svc.cluster.local |
| 63 | + PYTORCH_INDEX_URL=http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu |
| 64 | + ASCEND_INDEX_URL=http://cache-service.nginx-pypi-cache.svc.cluster.local/ascend/repos/pypi |
| 65 | + GIT_PROXY=https://gh-proxy.test.osinfra.cn/ |
| 66 | + SOC_VERSION=${{ steps.vars.outputs.soc_version }} |
| 67 | + COMPILE_CUSTOM_KERNELS=0 |
| 68 | + cache-from: type=registry,ref=swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/buildkit-cache:${{ matrix.dockerfile }}-${{ matrix.runner_info.arch }} |
| 69 | + cache-to: type=inline |
| 70 | + provenance: false |
0 commit comments