From d915a9f258d0231527f09349f5a6953f4d928c07 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Tue, 1 Apr 2025 07:02:02 +0530 Subject: [PATCH 1/4] fix: allow workflow to run on all paths to keep it required Signed-off-by: Anupam Kumar --- .github/workflows/integration-test.yml | 76 +++++++++++++++++++------- 1 file changed, 55 insertions(+), 21 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 53b85c1..23611d5 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -1,31 +1,18 @@ -# SPDX-FileCopyrightText: Nextcloud contributors +# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: AGPL-3.0-or-later name: Integration test on: pull_request: - paths: - - main.py - - config.cpu.yaml - - config.gpu.yaml - - context_chat_backend/** - - appinfo/** - - example.env - - hwdetect.sh - - persistent_storage/** + branches: + - master push: branches: - master - paths: - - main.py - - config.cpu.yaml - - config.gpu.yaml - - context_chat_backend/** - - appinfo/** - - example.env - - hwdetect.sh - - persistent_storage/** + +permissions: + contents: read concurrency: group: integration-test-${{ github.head_ref || github.run_id }} @@ -33,9 +20,42 @@ concurrency: jobs: - transcription: + changes: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + + outputs: + src: ${{ steps.changes.outputs.src}} + + steps: + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changes + continue-on-error: true + with: + filters: | + src: + - 'main.py' + - 'main_em.py' + - 'config.cpu.yaml' + - 'config.gpu.yaml' + - 'context_chat_backend/**' + - 'appinfo/**' + - 'example.env' + - 'hwdetect.sh' + - 'persistent_storage/**' + - 'project.toml' + - 'requirements.txt' + - 'logger_config.yaml' + - '.github/workflows/integration-test.yml' + + integration: runs-on: ubuntu-22.04 + needs: changes + if: needs.changes.outputs.src != 'false' + strategy: # do not stop on another job's failure fail-fast: false @@ -238,4 +258,18 @@ jobs: cat context_chat_backend/backend_logs || echo "No backend logs" echo '--------------------------------------------------' tail -v -n +1 context_chat_backend/persistent_storage/logs/* || echo "No logs in logs directory" - + + summary: + permissions: + contents: none + runs-on: ubuntu-latest-low + needs: [changes, integration] + + if: always() + + # This is the summary, we just avoid to rename it so that branch protection rules still match + name: integration-test + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.integration.result != 'success' }}; then exit 1; fi From 01613b3b7358742a3df5b1d6df7b809f5fd4b07d Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Tue, 1 Apr 2025 07:06:03 +0530 Subject: [PATCH 2/4] fix: check for the presence of relevant text chunk Signed-off-by: Anupam Kumar --- .github/workflows/integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 23611d5..522b67a 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -216,8 +216,8 @@ jobs: run: | ./occ background-job:worker 'OC\TaskProcessing\SynchronousBackgroundJob' & ./occ background-job:worker 'OC\TaskProcessing\SynchronousBackgroundJob' & - ./occ context_chat:prompt admin "Which factors are taken into account for the Ethical AI Rating?" - ./occ context_chat:prompt admin "Welche Faktoren beeinflussen das Ethical AI Rating?" + ./occ context_chat:prompt admin "Which factors are taken into account for the Ethical AI Rating?" | grep -q "If all of these points are met, we give a Green label." || exit 1 + ./occ context_chat:prompt admin "Welche Faktoren beeinflussen das Ethical AI Rating?" | grep -q "If all of these points are met, we give a Green label." || exit 1 - name: Check python memory usage run: | From 3201e753b0ff53bb7a22b40d8f8ff3b9e75745c2 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Tue, 1 Apr 2025 07:37:38 +0530 Subject: [PATCH 3/4] print the prompt outputs Signed-off-by: Anupam Kumar --- .github/workflows/integration-test.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 522b67a..e89943c 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -216,8 +216,15 @@ jobs: run: | ./occ background-job:worker 'OC\TaskProcessing\SynchronousBackgroundJob' & ./occ background-job:worker 'OC\TaskProcessing\SynchronousBackgroundJob' & - ./occ context_chat:prompt admin "Which factors are taken into account for the Ethical AI Rating?" | grep -q "If all of these points are met, we give a Green label." || exit 1 - ./occ context_chat:prompt admin "Welche Faktoren beeinflussen das Ethical AI Rating?" | grep -q "If all of these points are met, we give a Green label." || exit 1 + + OUT1=$(./occ context_chat:prompt admin "Which factors are taken into account for the Ethical AI Rating?") + echo "$OUT1" + echo '--------------------------------------------------' + OUT2=$(./occ context_chat:prompt admin "Welche Faktoren beeinflussen das Ethical AI Rating?") + echo "$OUT2" + + echo "$OUT1" | grep -q "If all of these points are met, we give a Green label." || exit 1 + echo "$OUT2" | grep -q "If all of these points are met, we give a Green label." || exit 1 - name: Check python memory usage run: | From 3b504b2d2c31eaf0ac1879fddf956a91f1d07f89 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Tue, 1 Apr 2025 20:17:17 +0530 Subject: [PATCH 4/4] update license year Signed-off-by: Anupam Kumar --- .github/workflows/integration-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index e89943c..ed4fd56 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors # SPDX-License-Identifier: AGPL-3.0-or-later name: Integration test @@ -237,7 +237,7 @@ jobs: final_mem=$(cat after_scan_mem.txt | tr -d ' ') echo "Initial Memory Usage: $initial_mem%" echo "Memory Usage after scan: $final_mem%" - + if (( $(echo "$final_mem > $initial_mem" | bc -l) )); then echo "Memory usage has increased during scan. Possible memory leak detected!" else @@ -250,7 +250,7 @@ jobs: final_mem=$(cat after_prompt_mem.txt | tr -d ' ') echo "Initial Memory Usage: $initial_mem%" echo "Memory Usage after prompt: $final_mem%" - + if (( $(echo "$final_mem > $initial_mem" | bc -l) )); then echo "Memory usage has increased during prompt. Possible memory leak detected!" else