From b4fc5678d72615965db1ab53e9cb57847fa2b124 Mon Sep 17 00:00:00 2001 From: Josh XT Date: Mon, 5 Feb 2024 12:17:10 -0500 Subject: [PATCH] Workflow split --- ...ker-dev.yml => publish-docker-cpu-dev.yml} | 8 +-- .github/workflows/publish-docker-cuda-dev.yml | 52 +++++++++++++++++++ 2 files changed, 54 insertions(+), 6 deletions(-) rename .github/workflows/{publish-docker-dev.yml => publish-docker-cpu-dev.yml} (91%) create mode 100644 .github/workflows/publish-docker-cuda-dev.yml diff --git a/.github/workflows/publish-docker-dev.yml b/.github/workflows/publish-docker-cpu-dev.yml similarity index 91% rename from .github/workflows/publish-docker-dev.yml rename to .github/workflows/publish-docker-cpu-dev.yml index bf8eff4..eb62b10 100644 --- a/.github/workflows/publish-docker-dev.yml +++ b/.github/workflows/publish-docker-cpu-dev.yml @@ -1,4 +1,4 @@ -name: Dev - Build and Test +name: Dev - CPU Build and Test on: push: @@ -8,7 +8,7 @@ on: jobs: build-local-llm: - runs-on: self-hosted + runs-on: ubuntu-latest strategy: matrix: include: @@ -16,10 +16,6 @@ jobs: dockerfile: "Dockerfile" platforms: "linux/amd64" tag_name: "cpu-dev" - - name: "CUDA" - dockerfile: "cuda.Dockerfile" - platforms: "linux/amd64" - tag_name: "cuda-dev" steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/publish-docker-cuda-dev.yml b/.github/workflows/publish-docker-cuda-dev.yml new file mode 100644 index 0000000..93dca4c --- /dev/null +++ b/.github/workflows/publish-docker-cuda-dev.yml @@ -0,0 +1,52 @@ +name: Dev - Cuda Build + +on: + push: + branches-ignore: + - main + workflow_dispatch: + +jobs: + build-local-llm: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: "CUDA" + dockerfile: "cuda.Dockerfile" + platforms: "linux/amd64" + tag_name: "cuda-dev" + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Extract GitHub info + run: | + echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/[^a-zA-Z0-9._-]/-/g')" >> $GITHUB_ENV + echo "GITHUB_USER=$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f 2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + id: extract_branch + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ env.GITHUB_USER }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./${{ matrix.dockerfile }} + platforms: ${{ matrix.platforms }} + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: | + ghcr.io/agixt/${{ env.REPO_NAME }}:${{ matrix.tag_name }} + ghcr.io/agixt/${{ env.REPO_NAME }}:${{ matrix.tag_name }}-${{ env.BRANCH_NAME }} + ghcr.io/agixt/${{ env.REPO_NAME }}:${{ matrix.tag_name }}-${{ env.BRANCH_NAME }}-${{ github.sha }}