461bf6fd40
CI / lint (3.11) (push) Has been cancelled
CI / lint (3.12) (push) Has been cancelled
CI / lint (3.13) (push) Has been cancelled
CI / shellcheck (push) Has been cancelled
CI / shfmt (push) Has been cancelled
CI / setup (3.11) (push) Has been cancelled
CI / setup (3.12) (push) Has been cancelled
CI / setup (3.13) (push) Has been cancelled
CI / check-licenses (3.12) (push) Has been cancelled
CI / test_unit (3.11) (push) Has been cancelled
CI / test_unit (3.12) (push) Has been cancelled
CI / test_unit (3.13) (push) Has been cancelled
CI / test_unit_no_extras (3.11) (push) Has been cancelled
CI / test_unit_no_extras (3.12) (push) Has been cancelled
CI / test_json_to_html (3.12) (push) Has been cancelled
CI / test_unit_no_extras (3.13) (push) Has been cancelled
CI / test_unit_dependency_extras (csv, 3.12, --extra csv) (push) Has been cancelled
CI / test_unit_dependency_extras (xlsx, 3.11, --extra xlsx) (push) Has been cancelled
CI / test_unit_dependency_extras (xlsx, 3.12, --extra xlsx) (push) Has been cancelled
CI / test_unit_dependency_extras (csv, 3.11, --extra csv) (push) Has been cancelled
CI / test_unit_dependency_extras (csv, 3.13, --extra csv) (push) Has been cancelled
CI / test_unit_dependency_extras (docx, 3.11, --extra docx) (push) Has been cancelled
CI / test_unit_dependency_extras (docx, 3.12, --extra docx) (push) Has been cancelled
CI / test_unit_dependency_extras (docx, 3.13, --extra docx) (push) Has been cancelled
CI / test_unit_dependency_extras (markdown, 3.11, --extra md) (push) Has been cancelled
CI / test_unit_dependency_extras (markdown, 3.12, --extra md) (push) Has been cancelled
CI / test_unit_dependency_extras (markdown, 3.13, --extra md) (push) Has been cancelled
CI / test_unit_dependency_extras (odt, 3.11, --extra odt) (push) Has been cancelled
CI / test_unit_dependency_extras (odt, 3.12, --extra odt) (push) Has been cancelled
CI / test_unit_dependency_extras (odt, 3.13, --extra odt) (push) Has been cancelled
CI / test_unit_dependency_extras (pdf-image, 3.11, --extra pdf --extra image --extra paddleocr) (push) Has been cancelled
CI / test_unit_dependency_extras (pdf-image, 3.12, --extra pdf --extra image --extra paddleocr) (push) Has been cancelled
CI / test_unit_dependency_extras (pdf-image, 3.13, --extra pdf --extra image --extra paddleocr) (push) Has been cancelled
CI / test_unit_dependency_extras (pptx, 3.11, --extra pptx) (push) Has been cancelled
CI / test_unit_dependency_extras (pptx, 3.12, --extra pptx) (push) Has been cancelled
CI / test_unit_dependency_extras (pptx, 3.13, --extra pptx) (push) Has been cancelled
CI / test_unit_dependency_extras (pypandoc, 3.11, --extra epub --extra org --extra rtf --extra rst) (push) Has been cancelled
CI / test_unit_dependency_extras (pypandoc, 3.12, --extra epub --extra org --extra rtf --extra rst) (push) Has been cancelled
CI / test_unit_dependency_extras (pypandoc, 3.13, --extra epub --extra org --extra rtf --extra rst) (push) Has been cancelled
Build And Push Docker Image / set-short-sha (push) Has been cancelled
Partition Benchmark / setup (push) Has been cancelled
Partition Benchmark / Measure and compare partition() runtime (push) Has been cancelled
CI / test_unit_dependency_extras (xlsx, 3.13, --extra xlsx) (push) Has been cancelled
CI / test_ingest_src (3.12) (push) Has been cancelled
CI / test_json_to_markdown (3.12) (push) Has been cancelled
CI / changelog (push) Has been cancelled
CI / test_dockerfile (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Build And Push Docker Image / build-images (linux/amd64, opensource-linux-8core) (push) Has been cancelled
Build And Push Docker Image / build-images (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Build And Push Docker Image / publish-images (push) Has been cancelled
108 lines
4.1 KiB
YAML
108 lines
4.1 KiB
YAML
name: Build And Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DOCKER_REPOSITORY: quay.io/unstructured-io/unstructured
|
|
DOCKER_BUILD_REPOSITORY: quay.io/unstructured-io/build-unstructured
|
|
|
|
jobs:
|
|
set-short-sha:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
short_sha: ${{ steps.set_short_sha.outputs.short_sha }}
|
|
steps:
|
|
- name: Set Short SHA
|
|
id: set_short_sha
|
|
run: echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
|
|
|
|
build-images:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- docker-platform: "linux/amd64"
|
|
runs-on: opensource-linux-8core
|
|
- docker-platform: "linux/arm64"
|
|
runs-on: ubuntu-24.04-arm
|
|
runs-on: ${{ matrix.runs-on }}
|
|
needs: set-short-sha
|
|
env:
|
|
SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }}
|
|
steps:
|
|
- name: Set up Docker
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver: docker
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Login to Quay.io
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: quay.io
|
|
username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }}
|
|
password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }}
|
|
- name: Build images
|
|
run: |
|
|
ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }})
|
|
DOCKER_BUILDKIT=1 docker buildx build --platform=${{ matrix.docker-platform }} --load \
|
|
-f Dockerfile \
|
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
|
--progress plain \
|
|
--cache-from $DOCKER_BUILD_REPOSITORY:$ARCH \
|
|
-t $DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA .
|
|
- name: Test images
|
|
run: |
|
|
echo "UNS_API_KEY=${{ secrets.UNS_API_KEY }}" > uns_test_env_file
|
|
echo "UNSTRUCTURED_HF_TOKEN=${{ secrets.HF_TOKEN }}" >> uns_test_env_file
|
|
ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }})
|
|
DOCKER_IMAGE="$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA" \
|
|
make docker-test CI=true TEST_FILE=test_unstructured/partition/test_text.py
|
|
DOCKER_IMAGE=$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA make docker-smoke-test
|
|
- name: Push images
|
|
run: |
|
|
# write to the build repository to cache for the publish-images job
|
|
ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }})
|
|
docker push "$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA"
|
|
publish-images:
|
|
runs-on: ubuntu-latest-m
|
|
needs: [set-short-sha, build-images]
|
|
env:
|
|
SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }}
|
|
steps:
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Login to Quay.io
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: quay.io
|
|
username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }}
|
|
password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }}
|
|
- name: Pull AMD image
|
|
run: |
|
|
docker pull $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA
|
|
- name: Pull ARM image
|
|
run: |
|
|
docker pull $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA
|
|
- name: Push latest build tags for AMD and ARM
|
|
run: |
|
|
# these are used to construct the final manifest but also cache-from in subsequent runs
|
|
docker tag $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64
|
|
docker push $DOCKER_BUILD_REPOSITORY:amd64
|
|
docker tag $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:arm64
|
|
docker push $DOCKER_BUILD_REPOSITORY:arm64
|
|
- name: Push multiarch manifest
|
|
run: |
|
|
docker manifest create ${DOCKER_REPOSITORY}:latest $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64
|
|
docker manifest push $DOCKER_REPOSITORY:latest
|
|
docker manifest create ${DOCKER_REPOSITORY}:$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64
|
|
docker manifest push $DOCKER_REPOSITORY:$SHORT_SHA
|
|
VERSION=$(grep -Po '(?<=__version__ = ")[^"]*' unstructured/__version__.py)
|
|
docker manifest create ${DOCKER_REPOSITORY}:$VERSION $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64
|
|
docker manifest push $DOCKER_REPOSITORY:$VERSION
|