1010 - " integrations/amazon_bedrock/**"
1111 - " !integrations/amazon_bedrock/*.md"
1212 - " .github/workflows/amazon_bedrock.yml"
13+ push :
14+ branches :
15+ - main
16+ paths :
17+ - " integrations/amazon_bedrock/**"
18+ - " !integrations/amazon_bedrock/*.md"
19+ - " .github/workflows/amazon_bedrock.yml"
1320
1421defaults :
1522 run :
1623 working-directory : integrations/amazon_bedrock
1724
1825concurrency :
19- group : amazon-bedrock-${{ github.head_ref }}
26+ group : amazon-bedrock-${{ github.head_ref || github.sha }}
2027 cancel-in-progress : true
2128
2229permissions :
@@ -26,6 +33,8 @@ permissions:
2633env :
2734 PYTHONUNBUFFERED : " 1"
2835 FORCE_COLOR : " 1"
36+ TEST_MATRIX_OS : ' ["ubuntu-latest", "windows-latest", "macos-latest"]'
37+ TEST_MATRIX_PYTHON : ' ["3.10", "3.14"]'
2938
3039 AWS_REGION : " us-east-1"
3140 AWS_BEDROCK_GUARDRAIL_ID : ${{ secrets.AWS_BEDROCK_GUARDRAIL_ID }}
3443
3544
3645jobs :
46+ compute-test-matrix :
47+ runs-on : ubuntu-slim
48+ defaults :
49+ run :
50+ working-directory : .
51+ outputs :
52+ os : ${{ steps.set.outputs.os }}
53+ python-version : ${{ steps.set.outputs.python-version }}
54+ steps :
55+ - id : set
56+ run : |
57+ echo 'os=${{ github.event_name == 'push' && '["ubuntu-latest"]' || env.TEST_MATRIX_OS }}' >> $GITHUB_OUTPUT
58+ echo 'python-version=${{ github.event_name == 'push' && '["3.10"]' || env.TEST_MATRIX_PYTHON }}' >> $GITHUB_OUTPUT
59+
3760 run :
3861 name : Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
62+ needs : compute-test-matrix
63+ permissions :
64+ id-token : write
65+ contents : write
66+ pull-requests : write
3967 runs-on : ${{ matrix.os }}
4068 strategy :
4169 fail-fast : false
4270 matrix :
43- os : [ubuntu-latest, windows-latest, macos-latest]
44- python-version : ["3.10", "3.14"]
71+ os : ${{ fromJSON(needs.compute-test-matrix.outputs.os) }}
72+ python-version : ${{ fromJSON(needs.compute-test-matrix.outputs.python-version) }}
4573
4674 steps :
4775 - name : Support longpaths
6492 run : hatch run fmt-check && hatch run test:types
6593
6694 - name : Run unit tests
67- run : hatch run test:unit
95+ run : hatch run test:unit-cov-retry
96+
97+ # On PR: generates coverage comment artifact. On push to main: stores coverage baseline on data branch.
98+ - name : Store unit tests coverage
99+ if : matrix.python-version == '3.10' && runner.os == 'Linux' && github.event_name != 'schedule'
100+ uses : py-cov-action/python-coverage-comment-action@7188638f871f721a365d644f505d1ff3df20d683 # v3.40
101+ with :
102+ GITHUB_TOKEN : ${{ github.token }}
103+ COVERAGE_PATH : integrations/amazon_bedrock
104+ SUBPROJECT_ID : amazon_bedrock
105+ COMMENT_ARTIFACT_NAME : coverage-comment-amazon_bedrock
68106
69107 # Do not authenticate on PRs from forks and on PRs created by dependabot
70108 - name : AWS authentication
@@ -77,9 +115,19 @@ jobs:
77115
78116 - name : Run integration tests
79117 if : success() && steps.aws-auth.outcome == 'success'
80- run : hatch run test:cov-retry -m "integration"
118+ run : hatch run test:integration-cov-append-retry
119+
120+ - name : Store combined coverage
121+ if : github.event_name == 'push'
122+ uses : py-cov-action/python-coverage-comment-action@7188638f871f721a365d644f505d1ff3df20d683 # v3.40
123+ with :
124+ GITHUB_TOKEN : ${{ github.token }}
125+ COVERAGE_PATH : integrations/amazon_bedrock
126+ SUBPROJECT_ID : amazon_bedrock-combined
127+ COMMENT_ARTIFACT_NAME : coverage-comment-amazon_bedrock-combined
81128
82129 - name : Run unit tests with lowest direct dependencies
130+ if : github.event_name != 'push'
83131 run : |
84132 hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt
85133 hatch -e test env run -- uv pip install -r requirements_lowest_direct.txt
0 commit comments