From 327815069b916e86b8355196e5e69e4cc3b62daf Mon Sep 17 00:00:00 2001 From: Andreas Klos Date: Mon, 20 Jan 2025 13:25:10 +0100 Subject: [PATCH 1/3] chore: update subproject references and add lint and test workflow --- .github/workflows/build-and-test.yml | 60 ++++++++++++++++++++++++++++ rag-core-library | 2 +- rag-infrastructure | 2 +- 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 00000000..d5a4fd45 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,60 @@ +name: Lint and test workflow + +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + SanitizeBranchName: + runs-on: ubuntu-latest + outputs: + sanitized_ref: ${{ steps.sanitize.outputs.sanitized_ref }} + steps: + - name: Sanitize Branch Name + id: sanitize + run: | + SANITIZED_REF=$(echo "${GITHUB_HEAD_REF}" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9' '-') + SANITIZED_REF=${SANITIZED_REF#-} + SANITIZED_REF=${SANITIZED_REF%-} + SANITIZED_REF=${SANITIZED_REF:0:63} + if [[ -z "$SANITIZED_REF" || "$SANITIZED_REF" =~ ^-+$ ]]; then + SANITIZED_REF="tmp-branch" + fi + echo "::set-output name=sanitized_ref::${SANITIZED_REF}" + shell: bash + env: + GITHUB_HEAD_REF: ${{ github.head_ref }} + + BuildAndLint: + name: Build and Lint + runs-on: ubuntu-latest + needs: [SanitizeBranchName] + strategy: + fail-fast: true + matrix: + service: [ "admin-backend", "document-extractor", "rag-backend"] + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + repository: stackitcloud/rag-template + submodules: 'true' + - name: Set Docker Image Name + run: | + echo "IMAGE_NAME=${{ matrix.service }}:${{ needs.SanitizeBranchName.outputs.sanitized_ref }}-${{ github.run_number }}" >> $GITHUB_ENV + shell: bash + + - name: Build lint image + run: | + docker build -t $IMAGE_NAME --build-arg dev=1 --build-arg TAG=debug -f ${{ matrix.service }}/Dockerfile . + + - name: Generate lint report + run: | + docker run --rm --entrypoint make "$IMAGE_NAME" lint + + - name: Run tests + run: | + docker run --rm --entrypoint make "$IMAGE_NAME" test diff --git a/rag-core-library b/rag-core-library index 18e4fa96..2bfa7867 160000 --- a/rag-core-library +++ b/rag-core-library @@ -1 +1 @@ -Subproject commit 18e4fa961c30d231471fb69697646b8410a3a7d7 +Subproject commit 2bfa78675a41f00cb69b51e83281aeb23a3a29cc diff --git a/rag-infrastructure b/rag-infrastructure index 026bf42f..43736e15 160000 --- a/rag-infrastructure +++ b/rag-infrastructure @@ -1 +1 @@ -Subproject commit 026bf42f1826807451cd3660b402ba7f7cee4b0d +Subproject commit 43736e1589f178d8d837bfbf0b720ba373ae196e From 5eed046ddd8ac181fe88ed6d9a8afc19f22adc3a Mon Sep 17 00:00:00 2001 From: Andreas Klos Date: Mon, 20 Jan 2025 13:32:06 +0100 Subject: [PATCH 2/3] chore: update subproject commits for rag-core-library and rag-infrastructure --- rag-core-library | 2 +- rag-infrastructure | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rag-core-library b/rag-core-library index 2bfa7867..d4ce7407 160000 --- a/rag-core-library +++ b/rag-core-library @@ -1 +1 @@ -Subproject commit 2bfa78675a41f00cb69b51e83281aeb23a3a29cc +Subproject commit d4ce7407dffc58e25db88928caba93c01183db4f diff --git a/rag-infrastructure b/rag-infrastructure index 43736e15..79e0f2cc 160000 --- a/rag-infrastructure +++ b/rag-infrastructure @@ -1 +1 @@ -Subproject commit 43736e1589f178d8d837bfbf0b720ba373ae196e +Subproject commit 79e0f2ccb1f871dfd5d11efc97d4246964c46a1f From f439c7b0d474864f87ff69d1eb6222c112b8f251 Mon Sep 17 00:00:00 2001 From: Andreas Klos Date: Mon, 20 Jan 2025 13:52:18 +0100 Subject: [PATCH 3/3] rename gha --- .github/workflows/{build-and-test.yml => lint-and-test.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{build-and-test.yml => lint-and-test.yml} (100%) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/lint-and-test.yml similarity index 100% rename from .github/workflows/build-and-test.yml rename to .github/workflows/lint-and-test.yml