|
| 1 | +name: Build, test, and publish Red Hat Distribution Containers |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - rhoai-v* |
| 8 | + types: |
| 9 | + - opened |
| 10 | + - synchronize |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + - rhoai-v* |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +env: |
| 21 | + REGISTRY: quay.io |
| 22 | + IMAGE_NAME: quay.io/opendatahub/llama-stack # tags for the image will be added dynamically |
| 23 | + |
| 24 | +jobs: |
| 25 | + build-test-push: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + platform: [linux/amd64] # TODO: enable other arch once all pip packages are available. |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 34 | + |
| 35 | + - name: Set up QEMU |
| 36 | + uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 |
| 37 | + |
| 38 | + - name: Set up Docker Buildx |
| 39 | + uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 |
| 40 | + |
| 41 | + - name: Build image |
| 42 | + id: build |
| 43 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 |
| 44 | + with: |
| 45 | + context: . |
| 46 | + file: distribution/Containerfile |
| 47 | + platforms: ${{ matrix.platform }} |
| 48 | + push: false |
| 49 | + tags: ${{ env.IMAGE_NAME }}:${{ github.sha }} |
| 50 | + load: true # needed to load for smoke test |
| 51 | + cache-from: type=gha |
| 52 | + cache-to: type=gha,mode=max |
| 53 | + |
| 54 | + - name: Setup vllm for image test |
| 55 | + id: vllm |
| 56 | + uses: ./.github/actions/setup-vllm |
| 57 | + |
| 58 | + - name: Smoke test image |
| 59 | + id: smoke-test |
| 60 | + shell: bash |
| 61 | + env: |
| 62 | + INFERENCE_MODEL: meta-llama/Llama-3.2-1B-Instruct |
| 63 | + VLLM_URL: http://localhost:8000/v1 |
| 64 | + run: ./tests/smoke.sh |
| 65 | + |
| 66 | + - name: Log in to Quay.io |
| 67 | + id: login |
| 68 | + if: github.event_name == 'push' |
| 69 | + uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 |
| 70 | + with: |
| 71 | + registry: ${{ env.REGISTRY }} |
| 72 | + username: ${{ secrets.QUAY_USERNAME }} |
| 73 | + password: ${{ secrets.QUAY_PASSWORD }} |
| 74 | + |
| 75 | + - name: Publish image to Quay.io |
| 76 | + id: publish |
| 77 | + if: github.event_name == 'push' |
| 78 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 |
| 79 | + with: |
| 80 | + context: . |
| 81 | + file: distribution/Containerfile |
| 82 | + platforms: ${{ matrix.platform }} |
| 83 | + push: true |
| 84 | + tags: ${{ env.IMAGE_NAME }}:${{ github.sha }}${{ github.ref == 'refs/heads/main' && format(',{0}:latest', env.IMAGE_NAME) || '' }} # only update 'latest' tag if push is to the 'main' branch |
| 85 | + cache-from: type=gha |
| 86 | + cache-to: type=gha,mode=max |
0 commit comments