Skip to content

Commit 2441048

Browse files
authored
ci: Bedrock - improve worfklow; skip tests from CI (#1773)
1 parent 6939994 commit 2441048

File tree

3 files changed

+5
-26
lines changed

3 files changed

+5
-26
lines changed

.github/workflows/amazon_bedrock.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ env:
2727
PYTHONUNBUFFERED: "1"
2828
FORCE_COLOR: "1"
2929
AWS_REGION: us-east-1
30-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
3130

3231
jobs:
3332
run:
@@ -68,15 +67,15 @@ jobs:
6867

6968
# Do not authenticate on pull requests from forks
7069
- name: AWS authentication
70+
id: aws-auth
7171
if: github.event.pull_request.head.repo.full_name == github.repository
7272
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df
7373
with:
7474
aws-region: ${{ env.AWS_REGION }}
7575
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
7676

77-
# Do not run integration tests on pull requests from forks
7877
- name: Run integration tests
79-
if: github.event.pull_request.head.repo.full_name == github.repository
78+
if: success() && steps.aws-auth.outcome == 'success'
8079
run: hatch run cov-retry -m "integration"
8180

8281
- name: Nightly - run unit tests with Haystack main branch

integrations/amazon_bedrock/tests/test_chat_generator.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
from typing import Any, Dict, Optional
32

43
import pytest
@@ -265,14 +264,8 @@ def test_prepare_request_params_tool_config(self, top_song_tool_config, mock_bot
265264
assert request_params["toolConfig"] == top_song_tool_config
266265

267266

267+
# In the CI, those tests are skipped if AWS Authentication fails
268268
@pytest.mark.integration
269-
@pytest.mark.skipif(
270-
not os.environ.get("AWS_CI_ROLE_ARN", None) and not os.environ.get("AWS_REGION", None),
271-
reason=(
272-
"Skipping test because AWS_CI_ROLE_ARN and AWS_REGION environment variables are not set. "
273-
"This test requires AWS credentials to run."
274-
),
275-
)
276269
class TestAmazonBedrockChatGeneratorInference:
277270
@pytest.mark.parametrize("model_name", MODELS_TO_TEST)
278271
def test_default_inference_params(self, model_name, chat_messages):
@@ -437,14 +430,8 @@ def test_pipeline_with_amazon_bedrock_chat_generator(self, model_name, tools):
437430
)
438431

439432

433+
# In the CI, those tests are skipped if AWS Authentication fails
440434
@pytest.mark.integration
441-
@pytest.mark.skipif(
442-
not os.environ.get("AWS_CI_ROLE_ARN", None) and not os.environ.get("AWS_REGION", None),
443-
reason=(
444-
"Skipping test because AWS_CI_ROLE_ARN and AWS_REGION environment variables are not set. "
445-
"This test requires AWS credentials to run."
446-
),
447-
)
448435
class TestAmazonBedrockChatGeneratorAsyncInference:
449436
"""
450437
Test class for async inference functionality of AmazonBedrockChatGenerator

integrations/amazon_bedrock/tests/test_ranker.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
from unittest.mock import MagicMock, patch
32

43
import pytest
@@ -52,14 +51,8 @@ def test_bedrock_ranker_run(mock_aws_session):
5251
assert result["documents"][1].score == 0.7
5352

5453

54+
# In the CI, those tests are skipped if AWS Authentication fails
5555
@pytest.mark.integration
56-
@pytest.mark.skipif(
57-
not os.environ.get("AWS_CI_ROLE_ARN", None) and not os.environ.get("AWS_REGION", None),
58-
reason=(
59-
"Skipping test because AWS_CI_ROLE_ARN and AWS_REGION environment variables are not set. "
60-
"This test requires AWS credentials to run."
61-
),
62-
)
6356
def test_amazon_bedrock_ranker_live_run():
6457
ranker = AmazonBedrockRanker(
6558
model="cohere.rerank-v3-5:0",

0 commit comments

Comments
 (0)