Skip to content

chore(deps): bump the pip group across 5 directories with 10 updates #273

chore(deps): bump the pip group across 5 directories with 10 updates

chore(deps): bump the pip group across 5 directories with 10 updates #273

name: PR - SageMaker XGBoost 3.2.0
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
paths:
- "docker/xgboost/Dockerfile"
- "docker/xgboost/pyproject.toml"
- "docker/xgboost/uv.lock"
- "docker/xgboost/resources/**"
- ".github/config/image/sagemaker-xgboost.yml"
- ".github/workflows/pr-sagemaker-xgboost.yml"
- "test/security/data/ecr_scan_allowlist/xgboost/framework_allowlist.json"
- "test/security/data/ecr_scan_allowlist/xgboost/xgboost-3.2.0.json"
- "!docs/**"
permissions:
contents: read
pull-requests: read
env:
FORCE_COLOR: "1"
CONFIG_FILE: ".github/config/image/sagemaker-xgboost.yml"
XGBOOST_CONTAINER_REPO: "https://github.com/aws/sagemaker-xgboost-container.git"
XGBOOST_CONTAINER_BRANCH: "master"
jobs:
gatekeeper:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-gate-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- name: Checkout base branch (safe)
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.base.sha }}
fetch-depth: 1
- name: Run permission gate (from base)
uses: ./.github/actions/pr-permission-gate
load-config:
needs: [gatekeeper]
if: success()
runs-on: ubuntu-latest
outputs:
framework: ${{ steps.parse.outputs.framework }}
framework-version: ${{ steps.parse.outputs.framework-version }}
python-version: ${{ steps.parse.outputs.python-version }}
cuda-version: ${{ steps.parse.outputs.cuda-version }}
os-version: ${{ steps.parse.outputs.os-version }}
container-type: ${{ steps.parse.outputs.container-type }}
device-type: ${{ steps.parse.outputs.device-type }}
arch-type: ${{ steps.parse.outputs.arch-type }}
contributor: ${{ steps.parse.outputs.contributor }}
customer-type: ${{ steps.parse.outputs.customer-type }}
prod-image: ${{ steps.parse.outputs.prod-image }}
ci-tag: ${{ steps.parse.outputs.ci-tag }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Load configuration
id: load
uses: ./.github/actions/load-config
with:
config-file: ${{ env.CONFIG_FILE }}
- name: Parse configuration
id: parse
run: |
echo '${{ steps.load.outputs.config }}' > config.json
echo "framework=$(jq -r '.common.framework' config.json)" >> $GITHUB_OUTPUT
echo "framework-version=$(jq -r '.common.framework_version' config.json)" >> $GITHUB_OUTPUT
echo "python-version=$(jq -r '.common.python_version' config.json)" >> $GITHUB_OUTPUT
echo "cuda-version=$(jq -r '.common.cuda_version' config.json)" >> $GITHUB_OUTPUT
echo "os-version=$(jq -r '.common.os_version' config.json)" >> $GITHUB_OUTPUT
echo "container-type=$(jq -r '.common.job_type' config.json)" >> $GITHUB_OUTPUT
echo "device-type=$(jq -r '.common.device_type // "cpu"' config.json)" >> $GITHUB_OUTPUT
echo "arch-type=$(jq -r '.common.arch_type // "x86"' config.json)" >> $GITHUB_OUTPUT
echo "contributor=$(jq -r '.common.contributor // "None"' config.json)" >> $GITHUB_OUTPUT
echo "customer-type=$(jq -r '.common.customer_type // ""' config.json)" >> $GITHUB_OUTPUT
echo "prod-image=$(jq -r '.common.prod_image' config.json)" >> $GITHUB_OUTPUT
FW=$(jq -r '.common.framework' config.json)
FV=$(jq -r '.common.framework_version' config.json)
DT=$(jq -r '.common.device_type // "cpu"' config.json)
PY=$(jq -r '.common.python_version' config.json)
echo "ci-tag=${FW}-${FV}-${DT}-${PY}-pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
check-changes:
needs: [gatekeeper]
if: success()
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-check-changes-${{ github.event.pull_request.number }}
cancel-in-progress: true
outputs:
build-change: ${{ steps.changes.outputs.build-change }}
steps:
- name: Checkout DLC source
uses: actions/checkout@v5
- name: Setup python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
- name: Detect file changes
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
build-change:
- "docker/xgboost/Dockerfile"
- "docker/xgboost/pyproject.toml"
- "docker/xgboost/uv.lock"
- "docker/xgboost/resources/**"
- ".github/config/image/sagemaker-xgboost.yml"
- "test/security/data/ecr_scan_allowlist/xgboost/framework_allowlist.json"
- "test/security/data/ecr_scan_allowlist/xgboost/xgboost-3.2.0.json"
build-wheel:
needs: [check-changes, load-config]
if: needs.check-changes.outputs.build-change == 'true'
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-build-wheel-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- name: Clone sagemaker-xgboost-container
run: git clone --depth 1 --branch ${{ env.XGBOOST_CONTAINER_BRANCH }} ${{ env.XGBOOST_CONTAINER_REPO }} /tmp/xgboost-wheel
- name: Build wheel
run: |
cd /tmp/xgboost-wheel
pip install setuptools wheel
python setup.py bdist_wheel --universal
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: xgboost-container-wheel
path: /tmp/xgboost-wheel/dist/*.whl
retention-days: 1
build-image:
needs: [check-changes, load-config, build-wheel]
if: needs.check-changes.outputs.build-change == 'true'
runs-on:
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
fleet:x86-build-runner
buildspec-override:true
concurrency:
group: ${{ github.workflow }}-build-image-${{ github.event.pull_request.number }}
cancel-in-progress: true
outputs:
ci-image: ${{ steps.build.outputs.image-uri }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Download prebuilt wheel
uses: actions/download-artifact@v4
with:
name: xgboost-container-wheel
path: /tmp/wheel
- name: Place wheel in build context
run: cp /tmp/wheel/*.whl docker/xgboost/prebuilt.whl
- name: Build image
id: build
uses: ./.github/actions/build-image
with:
framework: ${{ needs.load-config.outputs.framework }}
target: xgboost-sagemaker
base-image: nvidia/cuda:12.9.1-base-amzn2023
framework-version: ${{ needs.load-config.outputs.framework-version }}
container-type: ${{ needs.load-config.outputs.container-type }}
aws-account-id: ${{ vars.CI_AWS_ACCOUNT_ID }}
aws-region: ${{ vars.AWS_REGION }}
tag-pr: ${{ needs.load-config.outputs.ci-tag }}
dockerfile-path: docker/xgboost/Dockerfile
arch-type: ${{ needs.load-config.outputs.arch-type }}
device-type: ${{ needs.load-config.outputs.device-type }}
cuda-version: ${{ needs.load-config.outputs.cuda-version }}
python-version: ${{ needs.load-config.outputs.python-version }}
os-version: ${{ needs.load-config.outputs.os-version }}
contributor: ${{ needs.load-config.outputs.contributor }}
customer-type: ${{ needs.load-config.outputs.customer-type }}
env:
EXTRA_BUILD_ARGS: "XGBOOST_CONTAINER_BRANCH"
XGBOOST_CONTAINER_BRANCH: ${{ env.XGBOOST_CONTAINER_BRANCH }}
unit-test:
needs: [build-image, load-config]
if: success()
timeout-minutes: 15
runs-on:
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
fleet:default-runner
buildspec-override:true
concurrency:
group: ${{ github.workflow }}-unit-test-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- name: Checkout DLC source
uses: actions/checkout@v5
- name: Clone sagemaker-xgboost-container (tests + source)
run: rm -rf /tmp/xgboost-unit && git clone --depth 1 --branch ${{ env.XGBOOST_CONTAINER_BRANCH }} ${{ env.XGBOOST_CONTAINER_REPO }} /tmp/xgboost-unit
- name: ECR login
uses: ./.github/actions/ecr-authenticate
with:
aws-account-id: ${{ vars.CI_AWS_ACCOUNT_ID }}
aws-region: ${{ vars.AWS_REGION }}
image-uri: ${{ needs.build-image.outputs.ci-image }}
- name: Build test image
run: |
CI_IMAGE_URI="${{ needs.build-image.outputs.ci-image }}"
cd /tmp/xgboost-unit
printf "FROM ${CI_IMAGE_URI}\nADD . /app\nWORKDIR /app\nRUN pip install --no-deps -e . && pip install black coverage docker flake8 isort mock pytest pytest-cov pytest-xdist 'sagemaker>=2.0,<3.0' 'protobuf>=3.20.0,<=3.20.3' tox setuptools" > Dockerfile.test
docker build -t test-xgboost -f Dockerfile.test .
- name: Run unit tests
run: |
docker run --rm test-xgboost sh -c \
'python3 -m pytest --cov=sagemaker_xgboost_container --cov-fail-under=60 test/unit'
- name: Run flake8
run: |
docker run --rm test-xgboost sh -c 'python3 -m flake8 setup.py src test'
security-test:
needs: [build-image, load-config]
if: success()
concurrency:
group: ${{ github.workflow }}-security-test-${{ github.event.pull_request.number }}
cancel-in-progress: true
uses: ./.github/workflows/reusable-security-tests.yml
with:
image-uri: ${{ needs.build-image.result == 'success' && needs.build-image.outputs.ci-image || format('{0}.dkr.ecr.{1}.amazonaws.com/{2}', vars.PROD_AWS_ACCOUNT_ID, vars.AWS_REGION, needs.load-config.outputs.prod-image) }}
aws-account-id: ${{ needs.build-image.result == 'success' && vars.CI_AWS_ACCOUNT_ID || vars.PROD_AWS_ACCOUNT_ID }}
aws-region: ${{ vars.AWS_REGION }}
framework: ${{ needs.load-config.outputs.framework }}
framework-version: ${{ needs.load-config.outputs.framework-version }}
integration-test:
needs: [build-image, load-config]
if: success()
timeout-minutes: 30
runs-on:
- codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }}
fleet:default-runner
buildspec-override:true
concurrency:
group: ${{ github.workflow }}-integration-test-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
FRAMEWORK_VERSION: ${{ needs.load-config.outputs.framework-version }}
steps:
- name: Checkout DLC source
uses: actions/checkout@v5
- name: Clone sagemaker-xgboost-container (tests + source)
run: rm -rf /tmp/xgboost-integ && git clone --depth 1 --branch ${{ env.XGBOOST_CONTAINER_BRANCH }} ${{ env.XGBOOST_CONTAINER_REPO }} /tmp/xgboost-integ
- name: ECR login
uses: ./.github/actions/ecr-authenticate
with:
aws-account-id: ${{ vars.CI_AWS_ACCOUNT_ID }}
aws-region: ${{ vars.AWS_REGION }}
image-uri: ${{ needs.build-image.outputs.ci-image }}
- name: Setup test environment
run: |
cd /tmp/xgboost-integ
python3.12 -m venv /tmp/xgboost-integ/.venv
. /tmp/xgboost-integ/.venv/bin/activate
pip install --upgrade pip setuptools
pip install --no-deps -e .
pip install "sagemaker>=2.0,<3.0" boto3 botocore docker pytest pytest-cov pytest-xdist pyyaml
docker compose version || (curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose)
- name: Run integration tests
env:
CI_IMAGE_URI: ${{ needs.build-image.outputs.ci-image }}
run: |
. /tmp/xgboost-integ/.venv/bin/activate
cd /tmp/xgboost-integ
pytest test/integration/local \
--ignore=test/integration/local/test_multiple_model_endpoint.py \
--docker-base-name "${CI_IMAGE_URI%:*}" \
--tag "${CI_IMAGE_URI##*:}" \
--py-version 3 \
--framework-version ${FRAMEWORK_VERSION}