From b7d9b8891fbf2b84ed9757de084be98020a9684c Mon Sep 17 00:00:00 2001 From: Michael Sekamanya Date: Thu, 4 Apr 2024 20:12:26 -0700 Subject: [PATCH] Add package workflow --- .github/workflows/package.yml | 86 +++++++++++++++++++++++++++++ .github/workflows/test_api.yml | 18 +++--- .github/workflows/test_frontend.yml | 16 +++--- .github/workflows/test_rag.yml | 18 +++--- 4 files changed, 111 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/package.yml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..ffbcec4 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,86 @@ +name: Package Nesis + +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch' + required: true + default: main + tag: + description: 'Tag' + required: true + default: latest + +jobs: + package_api: + name: API + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.branch }} + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + file: ./nesis/api/Dockerfile + tags: ametnes/nesis:${{ github.event.inputs.tag }}-api + + package_frontend: + name: Frontend + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.dockerfile_branch }} + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Build and push frontend Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + file: ./nesis/frontend/Dockerfile + tags: ametnes/nesis:${{ github.event.inputs.tag }}-frontend + build-args: | + PUBLIC_URL=/ + PROFILE=PROD + + package_rag: + name: RAG + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.dockerfile_branch }} + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Build and push RAG docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + file: ./nesis/rag/Dockerfile + tags: ametnes/nesis:${{ github.event.inputs.tag }}-rag diff --git a/.github/workflows/test_api.yml b/.github/workflows/test_api.yml index 27a11f6..03b024d 100644 --- a/.github/workflows/test_api.yml +++ b/.github/workflows/test_api.yml @@ -2,15 +2,15 @@ name: Test API on: push: -# paths: -# - "nesis/api/core/**" -# - "nesis/api/tests/**" -# - "nesis/api/core/requirements*" -# pull_request: -# paths: -# - "nesis/api/core/**" -# - "nesis/api/tests/**" -# - "nesis/api/core/requirements*" + paths: + - "nesis/api/core/**" + - "nesis/api/tests/**" + - "nesis/api/core/requirements*" + pull_request: + paths: + - "nesis/api/core/**" + - "nesis/api/tests/**" + - "nesis/api/core/requirements*" jobs: linter: diff --git a/.github/workflows/test_frontend.yml b/.github/workflows/test_frontend.yml index d352d47..b47d21f 100644 --- a/.github/workflows/test_frontend.yml +++ b/.github/workflows/test_frontend.yml @@ -2,15 +2,13 @@ name: Test Frontend on: push: -# paths: -# - "nesis/frontend/core/**" -# - "nesis/frontend/tests/**" -# - "nesis/frontend/core/requirements*" -# pull_request: -# paths: -# - "nesis/frontend/core/**" -# - "nesis/frontend/tests/**" -# - "nesis/frontend/core/requirements*" + paths: + - "nesis/frontend/client/**" + - "nesis/frontend/server/**" + pull_request: + paths: + - "nesis/frontend/client/**" + - "nesis/frontend/server/**" jobs: lint: diff --git a/.github/workflows/test_rag.yml b/.github/workflows/test_rag.yml index 346d782..09e9c66 100644 --- a/.github/workflows/test_rag.yml +++ b/.github/workflows/test_rag.yml @@ -2,15 +2,15 @@ name: Test Rag Engine on: push: -# paths: -# - "nesis/rag/core/**" -# - "nesis/rag/tests/**" -# - "nesis/rag/core/requirements*" -# pull_request: -# paths: -# - "nesis/rag/core/**" -# - "nesis/rag/tests/**" -# - "nesis/rag/core/requirements*" + paths: + - "nesis/rag/core/**" + - "nesis/rag/tests/**" + - "nesis/rag/core/requirements*" + pull_request: + paths: + - "nesis/rag/core/**" + - "nesis/rag/tests/**" + - "nesis/rag/core/requirements*" jobs: linter: