diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21c800f8a..d92488913 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,80 +1,26 @@ -name: Release model-runner images for CE -run-name: Release model-runner images for CE, version ${{ inputs.releaseTag }} +name: CI on: - workflow_dispatch: - inputs: - pushLatest: - description: 'Tag images produced by this job as latest' - required: false - type: boolean - default: false - releaseTag: - description: 'Release tag' - required: false - type: string - default: "test" + pull_request: + branches: [ main ] + push: + branches: [ main ] jobs: - build: + test: runs-on: ubuntu-latest steps: - - name: Checkout repo + - name: Checkout code uses: actions/checkout@v4 - - name: Format tags - id: tags - shell: bash - run: | - echo "cpu<> "$GITHUB_OUTPUT" - echo "docker/model-runner:${{ inputs.releaseTag }}" >> "$GITHUB_OUTPUT" - if [ "${{ inputs.pushLatest }}" == "true" ]; then - echo "docker/model-runner:latest" >> "$GITHUB_OUTPUT" - fi - echo 'EOF' >> "$GITHUB_OUTPUT" - echo "cuda<> "$GITHUB_OUTPUT" - echo "docker/model-runner:${{ inputs.releaseTag }}-cuda" >> "$GITHUB_OUTPUT" - if [ "${{ inputs.pushLatest }}" == "true" ]; then - echo "docker/model-runner:latest-cuda" >> "$GITHUB_OUTPUT" - fi - echo 'EOF' >> "$GITHUB_OUTPUT" - - - name: Log in to DockerHub - uses: docker/login-action@v3 + - name: Set up Go + uses: actions/setup-go@v5 with: - username: "docker" - password: ${{ secrets.ORG_ACCESS_TOKEN }} + go-version: 1.24.2 + cache: true - - name: Set up Buildx - uses: docker/setup-buildx-action@v3 - with: - version: "lab:latest" - driver: cloud - endpoint: "docker/make-product-smarter" - install: true + - name: Run tests + run: go test -v ./... - - name: Build CPU image - uses: docker/build-push-action@v5 - with: - file: Dockerfile - platforms: linux/amd64, linux/arm64 - build-args: | - "LLAMA_SERVER_VERSION=latest" - push: true - sbom: true - provenance: mode=max - tags: ${{ steps.tags.outputs.cpu }} - - - name: Build CUDA image - uses: docker/build-push-action@v5 - with: - file: Dockerfile - platforms: linux/amd64, linux/arm64 - build-args: | - "LLAMA_SERVER_VERSION=latest" - "LLAMA_SERVER_VARIANT=cuda" - "BASE_IMAGE=nvidia/cuda:12.9.0-cudnn-runtime-ubuntu24.04" - push: true - sbom: true - provenance: mode=max - tags: ${{ steps.tags.outputs.cuda }} + - name: Run tests with race detection + run: go test -race ./... \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..6ca0bc548 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,96 @@ +name: Release model-runner images for CE +run-name: Release model-runner images for CE, version ${{ inputs.releaseTag }} + +on: + workflow_dispatch: + inputs: + pushLatest: + description: 'Tag images produced by this job as latest' + required: false + type: boolean + default: false + releaseTag: + description: 'Release tag' + required: false + type: string + default: "test" + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.24.2 + cache: true + + - name: Run tests + run: go test ./... + + build: + needs: test + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Format tags + id: tags + shell: bash + run: | + echo "cpu<> "$GITHUB_OUTPUT" + echo "docker/model-runner:${{ inputs.releaseTag }}" >> "$GITHUB_OUTPUT" + if [ "${{ inputs.pushLatest }}" == "true" ]; then + echo "docker/model-runner:latest" >> "$GITHUB_OUTPUT" + fi + echo 'EOF' >> "$GITHUB_OUTPUT" + echo "cuda<> "$GITHUB_OUTPUT" + echo "docker/model-runner:${{ inputs.releaseTag }}-cuda" >> "$GITHUB_OUTPUT" + if [ "${{ inputs.pushLatest }}" == "true" ]; then + echo "docker/model-runner:latest-cuda" >> "$GITHUB_OUTPUT" + fi + echo 'EOF' >> "$GITHUB_OUTPUT" + + - name: Log in to DockerHub + uses: docker/login-action@v3 + with: + username: "docker" + password: ${{ secrets.ORG_ACCESS_TOKEN }} + + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + with: + version: "lab:latest" + driver: cloud + endpoint: "docker/make-product-smarter" + install: true + + - name: Build CPU image + uses: docker/build-push-action@v5 + with: + file: Dockerfile + platforms: linux/amd64, linux/arm64 + build-args: | + "LLAMA_SERVER_VERSION=latest" + push: true + sbom: true + provenance: mode=max + tags: ${{ steps.tags.outputs.cpu }} + + - name: Build CUDA image + uses: docker/build-push-action@v5 + with: + file: Dockerfile + platforms: linux/amd64, linux/arm64 + build-args: | + "LLAMA_SERVER_VERSION=latest" + "LLAMA_SERVER_VARIANT=cuda" + "BASE_IMAGE=nvidia/cuda:12.9.0-cudnn-runtime-ubuntu24.04" + push: true + sbom: true + provenance: mode=max + tags: ${{ steps.tags.outputs.cuda }} diff --git a/pkg/inference/models/manager_test.go b/pkg/inference/models/manager_test.go index 51759375e..62ae16ba8 100644 --- a/pkg/inference/models/manager_test.go +++ b/pkg/inference/models/manager_test.go @@ -2,7 +2,6 @@ package models import ( "context" - "github.com/google/go-containerregistry/pkg/registry" "net/http/httptest" "net/url" "os" @@ -10,6 +9,8 @@ import ( "strings" "testing" + "github.com/google/go-containerregistry/pkg/registry" + "github.com/docker/model-distribution/builder" reg "github.com/docker/model-distribution/registry" @@ -108,7 +109,7 @@ func TestPullModel(t *testing.T) { m := NewManager(log, ClientConfig{ StoreRootPath: tempDir, Logger: log.WithFields(logrus.Fields{"component": "model-manager"}), - }) + }, nil) r := httptest.NewRequest("POST", "/models/create", strings.NewReader(`{"from": "`+tag+`"}`)) if tt.acceptHeader != "" {