From 79ae03c503ffed68a04b9421b05560df3740f28b Mon Sep 17 00:00:00 2001 From: Adrien Date: Fri, 19 Jul 2024 20:58:51 +0200 Subject: [PATCH] revert tests Signed-off-by: Adrien --- .github/workflows/build.yaml | 322 +++++++++++++---------------- integration-tests/pyproject.toml | 2 +- integration-tests/requirements.txt | 2 +- 3 files changed, 149 insertions(+), 177 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 89929f7b..c7beff59 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,178 +18,149 @@ on: type: boolean jobs: - # build-and-push: - # outputs: - # docker_image: ${{ steps.final.outputs.docker_image }} - # docker_devices: ${{ steps.final.outputs.docker_devices }} - # runs_on: ${{ steps.final.outputs.runs_on }} - # label: ${{ steps.final.outputs.label }} - # concurrency: - # group: ${{ github.workflow }}-build-and-push-image-${{ inputs.hardware }}-${{ github.head_ref || github.run_id }} - # cancel-in-progress: true - # runs-on: - # group: aws-r7i-8xlarge-priv - # permissions: - # contents: write - # packages: write - # # This is used to complete the identity challenge - # # with sigstore/fulcio when running outside of PRs. - # id-token: write - # security-events: write - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - # - name: Inject slug/short variables - # uses: rlespinasse/github-slug-action@v4.4.1 - # - name: Construct harware variables - # shell: bash - # run: | - # case ${{ inputs.hardware }} in - # cuda) - # export dockerfile="Dockerfile" - # export label_extension="" - # export docker_devices="" - # export runs_on="aws-g5-12xlarge" - # ;; - # rocm) - # export dockerfile="Dockerfile_amd" - # export label_extension="-rocm" - # export docker_devices="/dev/kfd,/dev/dri" - # # TODO Re-enable when they pass. - # # export runs_on="amd-gpu-tgi" - # export runs_on="ubuntu-latest" - # ;; - # intel) - # export dockerfile="Dockerfile_intel" - # export label_extension="-intel" - # export docker_devices="" - # export runs_on="ubuntu-latest" - # ;; - # esac - # echo $dockerfile - # echo "Dockerfile=${dockerfile}" - # echo $label_extension - # echo $docker_devices - # echo $runs_on - # echo "DOCKERFILE=${dockerfile}" >> $GITHUB_ENV - # echo "LABEL=${label_extension}" >> $GITHUB_ENV - # echo "DOCKER_DEVICES=${docker_devices}" >> $GITHUB_ENV - # echo "RUNS_ON=${runs_on}" >> $GITHUB_ENV - # - name: Initialize Docker Buildx - # uses: docker/setup-buildx-action@v3 - # with: - # install: true - # buildkitd-config-inline: | - # [registry."docker.io"] - # mirrors = ["registry-us-east-1-mirror.prod.aws.ci.huggingface.tech"] - # - name: Login to internal Container Registry - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.REGISTRY_USERNAME }} - # password: ${{ secrets.REGISTRY_PASSWORD }} - # registry: registry.internal.huggingface.tech - # - name: Login to GitHub Container Registry - # if: github.event_name != 'pull_request' - # uses: docker/login-action@v3 - # with: - # registry: ghcr.io - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} - # - name: Login to Azure Container Registry - # if: github.event_name != 'pull_request' - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.AZURE_DOCKER_USERNAME }} - # password: ${{ secrets.AZURE_DOCKER_PASSWORD }} - # registry: db4c2190dd824d1f950f5d1555fbadf0.azurecr.io - # # If pull request - # - name: Extract metadata (tags, labels) for Docker - # if: ${{ github.event_name == 'pull_request' }} - # id: meta-pr - # uses: docker/metadata-action@v5 - # with: - # images: | - # registry-us-east-1.prod.aws.ci.huggingface.tech/api-inference/community/text-generation-inference - # registry.internal.huggingface.tech/api-inference/community/text-generation-inference - # tags: | - # type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}${{ env.LABEL }} - # # If main, release or tag - # - name: Extract metadata (tags, labels) for Docker - # if: ${{ github.event_name != 'pull_request' }} - # id: meta - # uses: docker/metadata-action@v4.3.0 - # with: - # flavor: | - # latest=auto - # images: | - # registry-us-east-1.prod.aws.ci.huggingface.tech/api-inference/community/text-generation-inference - # registry.internal.huggingface.tech/api-inference/community/text-generation-inferenceca - # ghcr.io/huggingface/text-generation-inference - # db4c2190dd824d1f950f5d1555fbadf0.azurecr.io/text-generation-inference - # tags: | - # type=semver,pattern={{version}}${{ env.LABEL }} - # type=semver,pattern={{major}}.{{minor}}${{ env.LABEL }} - # type=raw,value=latest${{ env.LABEL }},enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} - # type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}${{ env.LABEL }} - # - name: Build and push Docker image - # id: build-and-push - # uses: docker/build-push-action@v4 - # with: - # context: . - # file: ${{ env.DOCKERFILE }} - # push: true - # platforms: 'linux/amd64' - # build-args: | - # GIT_SHA=${{ env.GITHUB_SHA }} - # DOCKER_LABEL=sha-${{ env.GITHUB_SHA_SHORT }}${{ env.LABEL }} - # tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} - # cache-from: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_ACCESS_KEY_ID }},secret_access_key=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_SECRET_ACCESS_KEY }},mode=min - # cache-to: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_ACCESS_KEY_ID }},secret_access_key=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_SECRET_ACCESS_KEY }},mode=min - # - name: Final - # id: final - # run: | - # echo "docker_image=registry-us-east-1.prod.aws.ci.huggingface.tech/api-inference/community/text-generation-inference:sha-${{ env.GITHUB_SHA_SHORT}}${{ env.LABEL }}" >> "$GITHUB_OUTPUT" - # echo "docker_devices=${{ env.DOCKER_DEVICES }}" >> "$GITHUB_OUTPUT" - # echo "runs_on=${{ env.RUNS_ON }}" >> "$GITHUB_OUTPUT" - # echo "label=${{ env.LABEL }}" >> "$GITHUB_OUTPUT" - # integration_tests: - # concurrency: - # group: ${{ github.workflow }}-${{ github.job }}-${{ needs.build-and-push.outputs.label }}-${{ github.head_ref || github.run_id }} - # cancel-in-progress: true - # needs: build-and-push - # runs-on: - # group: ${{ needs.build-and-push.outputs.runs_on }} - # if: needs.build-and-push.outputs.runs_on != 'ubuntu-latest' - # env: - # PYTEST_FLAGS: ${{ (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || inputs.release-tests == true) && '--release' || '' }} - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - # - name: Inject slug/short variables - # uses: rlespinasse/github-slug-action@v4.4.1 - # - name: Set up Python - # uses: actions/setup-python@v4 - # with: - # python-version: "3.10" - # - name: Install - # run: | - # make install-integration-tests - # - name: Run tests - # run: | - # export DOCKER_VOLUME=/mnt/cache - # export DOCKER_IMAGE=${{ needs.build-and-push.outputs.docker_image }} - # export DOCKER_DEVICES=${{ needs.build-and-push.outputs.docker_devices }} - # export HF_TOKEN=${{ secrets.HF_TOKEN }} - # echo $DOCKER_IMAGE - # pytest -x -s -vv integration-tests ${PYTEST_FLAGS} - # - name: Setup tmate session - # if: ${{ failure() }} - # uses: mxschmitt/action-tmate@v3 - # timeout-minutes: 30 - integration_tests2: + build-and-push: + outputs: + docker_image: ${{ steps.final.outputs.docker_image }} + docker_devices: ${{ steps.final.outputs.docker_devices }} + runs_on: ${{ steps.final.outputs.runs_on }} + label: ${{ steps.final.outputs.label }} + concurrency: + group: ${{ github.workflow }}-build-and-push-image-${{ inputs.hardware }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true runs-on: - group: aws-g5-12xlarge + group: aws-r7i-8xlarge-priv + permissions: + contents: write + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + security-events: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v4.4.1 + - name: Construct harware variables + shell: bash + run: | + case ${{ inputs.hardware }} in + cuda) + export dockerfile="Dockerfile" + export label_extension="" + export docker_devices="" + export runs_on="aws-g5-12xlarge" + ;; + rocm) + export dockerfile="Dockerfile_amd" + export label_extension="-rocm" + export docker_devices="/dev/kfd,/dev/dri" + # TODO Re-enable when they pass. + # export runs_on="amd-gpu-tgi" + export runs_on="ubuntu-latest" + ;; + intel) + export dockerfile="Dockerfile_intel" + export label_extension="-intel" + export docker_devices="" + export runs_on="ubuntu-latest" + ;; + esac + echo $dockerfile + echo "Dockerfile=${dockerfile}" + echo $label_extension + echo $docker_devices + echo $runs_on + echo "DOCKERFILE=${dockerfile}" >> $GITHUB_ENV + echo "LABEL=${label_extension}" >> $GITHUB_ENV + echo "DOCKER_DEVICES=${docker_devices}" >> $GITHUB_ENV + echo "RUNS_ON=${runs_on}" >> $GITHUB_ENV + - name: Initialize Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + install: true + buildkitd-config-inline: | + [registry."docker.io"] + mirrors = ["registry-us-east-1-mirror.prod.aws.ci.huggingface.tech"] + - name: Login to internal Container Registry + uses: docker/login-action@v3 + with: + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + registry: registry.internal.huggingface.tech + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to Azure Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ secrets.AZURE_DOCKER_USERNAME }} + password: ${{ secrets.AZURE_DOCKER_PASSWORD }} + registry: db4c2190dd824d1f950f5d1555fbadf0.azurecr.io + # If pull request + - name: Extract metadata (tags, labels) for Docker + if: ${{ github.event_name == 'pull_request' }} + id: meta-pr + uses: docker/metadata-action@v5 + with: + images: | + registry-us-east-1.prod.aws.ci.huggingface.tech/api-inference/community/text-generation-inference + registry.internal.huggingface.tech/api-inference/community/text-generation-inference + tags: | + type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}${{ env.LABEL }} + # If main, release or tag + - name: Extract metadata (tags, labels) for Docker + if: ${{ github.event_name != 'pull_request' }} + id: meta + uses: docker/metadata-action@v4.3.0 + with: + flavor: | + latest=auto + images: | + registry-us-east-1.prod.aws.ci.huggingface.tech/api-inference/community/text-generation-inference + registry.internal.huggingface.tech/api-inference/community/text-generation-inferenceca + ghcr.io/huggingface/text-generation-inference + db4c2190dd824d1f950f5d1555fbadf0.azurecr.io/text-generation-inference + tags: | + type=semver,pattern={{version}}${{ env.LABEL }} + type=semver,pattern={{major}}.{{minor}}${{ env.LABEL }} + type=raw,value=latest${{ env.LABEL }},enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }}${{ env.LABEL }} + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v4 + with: + context: . + file: ${{ env.DOCKERFILE }} + push: true + platforms: 'linux/amd64' + build-args: | + GIT_SHA=${{ env.GITHUB_SHA }} + DOCKER_LABEL=sha-${{ env.GITHUB_SHA_SHORT }}${{ env.LABEL }} + tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }} + labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} + cache-from: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_ACCESS_KEY_ID }},secret_access_key=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_SECRET_ACCESS_KEY }},mode=min + cache-to: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_ACCESS_KEY_ID }},secret_access_key=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_SECRET_ACCESS_KEY }},mode=min + - name: Final + id: final + run: | + echo "docker_image=registry-us-east-1.prod.aws.ci.huggingface.tech/api-inference/community/text-generation-inference:sha-${{ env.GITHUB_SHA_SHORT}}${{ env.LABEL }}" >> "$GITHUB_OUTPUT" + echo "docker_devices=${{ env.DOCKER_DEVICES }}" >> "$GITHUB_OUTPUT" + echo "runs_on=${{ env.RUNS_ON }}" >> "$GITHUB_OUTPUT" + echo "label=${{ env.LABEL }}" >> "$GITHUB_OUTPUT" + integration_tests: + concurrency: + group: ${{ github.workflow }}-${{ github.job }}-${{ needs.build-and-push.outputs.label }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + needs: build-and-push + runs-on: + group: ${{ needs.build-and-push.outputs.runs_on }} + if: needs.build-and-push.outputs.runs_on != 'ubuntu-latest' env: PYTEST_FLAGS: ${{ (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || inputs.release-tests == true) && '--release' || '' }} steps: @@ -206,13 +177,14 @@ jobs: make install-integration-tests - name: Run tests run: | - export DOCKER_VOLUME=/tmp - export DOCKER_IMAGE=registry-us-east-1.prod.aws.ci.huggingface.tech/api-inference/community/text-generation-inference:sha-c55c43e + export DOCKER_VOLUME=/mnt/cache + export DOCKER_IMAGE=${{ needs.build-and-push.outputs.docker_image }} + export DOCKER_DEVICES=${{ needs.build-and-push.outputs.docker_devices }} export HF_TOKEN=${{ secrets.HF_TOKEN }} echo $DOCKER_IMAGE - docker pull $DOCKER_IMAGE - pytest -x -s -vv integration-tests ${PYTEST_FLAGS} + pytest -s -vv integration-tests ${PYTEST_FLAGS} - name: Setup tmate session if: ${{ failure() }} uses: mxschmitt/action-tmate@v3 timeout-minutes: 30 + diff --git a/integration-tests/pyproject.toml b/integration-tests/pyproject.toml index bf388bd3..88e9761a 100644 --- a/integration-tests/pyproject.toml +++ b/integration-tests/pyproject.toml @@ -11,4 +11,4 @@ syrupy = "4.0.1" text-generation = "^0.6.0" pytest = "^7.4.0" pytest-asyncio = "^0.21.1" -docker = "^7.1.0" +docker = "^6.1.3" diff --git a/integration-tests/requirements.txt b/integration-tests/requirements.txt index 3e6052a2..3c2ce11b 100644 --- a/integration-tests/requirements.txt +++ b/integration-tests/requirements.txt @@ -7,7 +7,7 @@ certifi==2023.7.22 ; python_version >= "3.9" and python_version < "3.13" charset-normalizer==3.2.0 ; python_version >= "3.9" and python_version < "3.13" colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.13" and (sys_platform == "win32" or platform_system == "Windows") colored==1.4.4 ; python_version >= "3.9" and python_version < "3.13" -docker==7.1.0 ; python_version >= "3.9" and python_version < "3.13" +docker==6.1.3 ; python_version >= "3.9" and python_version < "3.13" exceptiongroup==1.1.3 ; python_version >= "3.9" and python_version < "3.11" filelock==3.12.3 ; python_version >= "3.9" and python_version < "3.13" frozenlist==1.4.0 ; python_version >= "3.9" and python_version < "3.13"