Skip to content

Commit 4a3f2c1

Browse files
authored
Merge branch 'main' into release-please--branches--main
2 parents 09cf98c + 59f5a44 commit 4a3f2c1

File tree

1 file changed

+64
-49
lines changed

1 file changed

+64
-49
lines changed

.github/workflows/test.yml

Lines changed: 64 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ jobs:
7272
test:
7373
name: Test Python on ${{ matrix.os }}
7474
needs: status-check
75-
if: needs.status-check.outputs.should-test == 'true'
7675
runs-on: ${{ matrix.os }}
7776

7877
strategy:
@@ -81,35 +80,47 @@ jobs:
8180
os: [ubuntu-latest, windows-latest, macos-latest]
8281

8382
steps:
83+
# Skip all steps for release-please PRs
84+
- name: Skip for release-please
85+
if: ${{ startsWith(github.head_ref, 'release-please--branches--') }}
86+
run: |
87+
echo "Skipping tests for release-please PR"
88+
echo "This job will complete quickly to satisfy branch protection"
89+
8490
- name: Checkout code
91+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
8592
uses: actions/checkout@v4
8693

8794
- name: Set up Python
95+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
8896
uses: actions/setup-python@v5
8997
with:
9098
python-version-file: pyproject.toml
9199

92100
- name: Install uv
101+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
93102
uses: astral-sh/setup-uv@v4
94103
with:
95104
enable-cache: true
96105
cache-dependency-glob: "pyproject.toml"
97106

98107
- name: Install dependencies
108+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
99109
run: uv sync --all-extras --dev
100110

101111
- name: Run pytest with coverage
112+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
102113
run: uv run pytest -v --cov=scripts --cov-report=term-missing --cov-report=xml --cov-report=html --junit-xml=test-results.xml tests/
103114

104115
- name: Upload test results
105-
if: always()
116+
if: ${{ always() && ! startsWith(github.head_ref, 'release-please--branches--') }}
106117
uses: actions/upload-artifact@v4
107118
with:
108119
name: test-results-${{ matrix.os }}
109120
path: test-results.xml
110121

111122
- name: Upload coverage reports
112-
if: matrix.os == 'ubuntu-latest'
123+
if: ${{ matrix.os == 'ubuntu-latest' && ! startsWith(github.head_ref, 'release-please--branches--') }}
113124
uses: actions/upload-artifact@v4
114125
with:
115126
name: coverage-report
@@ -118,7 +129,7 @@ jobs:
118129
htmlcov/
119130
120131
- name: Surface test results
121-
if: always()
132+
if: ${{ always() && ! startsWith(github.head_ref, 'release-please--branches--') }}
122133
uses: pmeier/pytest-results-action@main
123134
with:
124135
path: test-results.xml
@@ -127,7 +138,7 @@ jobs:
127138
fail-on-empty: true
128139

129140
- name: Coverage comment
130-
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
141+
if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && ! startsWith(github.head_ref, 'release-please--branches--') }}
131142
uses: py-cov-action/python-coverage-comment-action@v3
132143
with:
133144
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -137,36 +148,47 @@ jobs:
137148
test-validation:
138149
name: Test Environment Validation
139150
needs: status-check
140-
if: needs.status-check.outputs.should-test == 'true'
141151
runs-on: ubuntu-latest
142152

143153
steps:
154+
# Skip all steps for release-please PRs
155+
- name: Skip for release-please
156+
if: ${{ startsWith(github.head_ref, 'release-please--branches--') }}
157+
run: |
158+
echo "Skipping validation for release-please PR"
159+
echo "This job will complete quickly to satisfy branch protection"
160+
144161
- name: Checkout code
162+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
145163
uses: actions/checkout@v4
146164

147165
- name: Set up Python
166+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
148167
uses: actions/setup-python@v5
149168
with:
150169
python-version-file: pyproject.toml
151170

152171
- name: Install uv
172+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
153173
uses: astral-sh/setup-uv@v4
154174

155175
- name: Install dependencies
176+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
156177
run: uv sync
157178

158179
- name: Validate all environment configs
180+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
159181
run: |
160182
uv run python scripts/validate_environment_config.py environments/library/
161183
162184
- name: Test entity counting
185+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
163186
run: |
164187
uv run python scripts/count_entities.py
165188
166189
test-install-scripts:
167190
name: Test Install Scripts
168191
needs: status-check
169-
if: needs.status-check.outputs.should-test == 'true'
170192
runs-on: ${{ matrix.os }}
171193

172194
strategy:
@@ -175,86 +197,79 @@ jobs:
175197
os: [ubuntu-latest, windows-latest, macos-latest]
176198

177199
steps:
200+
# Skip all steps for release-please PRs
201+
- name: Skip for release-please
202+
if: ${{ startsWith(github.head_ref, 'release-please--branches--') }}
203+
run: |
204+
echo "Skipping install tests for release-please PR"
205+
echo "This job will complete quickly to satisfy branch protection"
206+
178207
- name: Checkout code
208+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
179209
uses: actions/checkout@v4
180210

181211
- name: Set up Python
212+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
182213
uses: actions/setup-python@v5
183214
with:
184215
python-version-file: pyproject.toml
185216

186217
- name: Install uv
218+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
187219
uses: astral-sh/setup-uv@v4
188220

189221
- name: Install dependencies
222+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
190223
run: uv sync
191224

192225
- name: Test setup_environment.py imports
226+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
193227
run: |
194228
uv run python -c "import sys; sys.path.insert(0, 'scripts'); import setup_environment"
195229
196230
- name: Test install_claude.py imports
231+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }}
197232
run: |
198233
uv run python -c "import sys; sys.path.insert(0, 'scripts'); import install_claude"
199234
200235
- name: Test setup with dry run (Unix)
201-
if: runner.os != 'Windows'
236+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') && runner.os != 'Windows' }}
202237
run: |
203238
uv run python scripts/setup_environment.py python --skip-install || true
204239
205240
- name: Test setup with dry run (Windows)
206-
if: runner.os == 'Windows'
241+
if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') && runner.os == 'Windows' }}
207242
run: |
208243
uv run python scripts/setup_environment.py python --skip-install
209244
continue-on-error: true
210245

211-
# Summary for when tests are skipped
212-
summary-skip:
213-
name: Test Summary (Skipped)
214-
runs-on: ubuntu-latest
215-
needs: [status-check]
216-
if: needs.status-check.outputs.should-test != 'true'
217-
218-
steps:
219-
- name: Summary
220-
run: |
221-
echo "## Test Summary" >> $GITHUB_STEP_SUMMARY
222-
echo "" >> $GITHUB_STEP_SUMMARY
223-
echo "ℹ️ Tests were skipped for this PR" >> $GITHUB_STEP_SUMMARY
224-
echo "" >> $GITHUB_STEP_SUMMARY
225-
echo "### Reason" >> $GITHUB_STEP_SUMMARY
226-
if [[ "${{ github.head_ref }}" == release-please--branches--* ]]; then
227-
echo "This is a release-please PR - tests are not required" >> $GITHUB_STEP_SUMMARY
228-
else
229-
echo "No test-relevant files were modified in this PR" >> $GITHUB_STEP_SUMMARY
230-
echo "" >> $GITHUB_STEP_SUMMARY
231-
echo "Test-relevant paths:" >> $GITHUB_STEP_SUMMARY
232-
echo "- \`scripts/**\`" >> $GITHUB_STEP_SUMMARY
233-
echo "- \`tests/**\`" >> $GITHUB_STEP_SUMMARY
234-
echo "- \`pyproject.toml\`" >> $GITHUB_STEP_SUMMARY
235-
echo "- \`.github/workflows/test.yml\`" >> $GITHUB_STEP_SUMMARY
236-
fi
237-
238-
# Summary for when tests run
246+
# Summary job that always runs
239247
summary-run:
240248
name: Test Summary
241249
runs-on: ubuntu-latest
242250
needs: [status-check, test, test-validation, test-install-scripts]
243-
if: needs.status-check.outputs.should-test == 'true'
251+
if: always()
244252

245253
steps:
246254
- name: Summary
247255
run: |
248256
echo "## Test Summary" >> $GITHUB_STEP_SUMMARY
249257
echo "" >> $GITHUB_STEP_SUMMARY
250-
echo "✅ All tests completed successfully!" >> $GITHUB_STEP_SUMMARY
251-
echo "" >> $GITHUB_STEP_SUMMARY
252-
echo "### Test Matrix" >> $GITHUB_STEP_SUMMARY
253-
echo "- ✅ Ubuntu + Python 3.12" >> $GITHUB_STEP_SUMMARY
254-
echo "- ✅ Windows + Python 3.12" >> $GITHUB_STEP_SUMMARY
255-
echo "- ✅ macOS + Python 3.12" >> $GITHUB_STEP_SUMMARY
256-
echo "" >> $GITHUB_STEP_SUMMARY
257-
echo "### Validation Tests" >> $GITHUB_STEP_SUMMARY
258-
echo "- ✅ Environment configurations validated" >> $GITHUB_STEP_SUMMARY
259-
echo "- ✅ Entity counting tested" >> $GITHUB_STEP_SUMMARY
260-
echo "- ✅ Install scripts tested" >> $GITHUB_STEP_SUMMARY
258+
259+
if [[ "${{ github.head_ref }}" == release-please--branches--* ]]; then
260+
echo "ℹ️ Release Please PR - tests skipped as expected" >> $GITHUB_STEP_SUMMARY
261+
elif [[ "${{ needs.status-check.outputs.should-test }}" == "true" ]]; then
262+
echo "✅ All tests completed successfully!" >> $GITHUB_STEP_SUMMARY
263+
echo "" >> $GITHUB_STEP_SUMMARY
264+
echo "### Test Matrix" >> $GITHUB_STEP_SUMMARY
265+
echo "- ✅ Ubuntu + Python" >> $GITHUB_STEP_SUMMARY
266+
echo "- ✅ Windows + Python" >> $GITHUB_STEP_SUMMARY
267+
echo "- ✅ macOS + Python" >> $GITHUB_STEP_SUMMARY
268+
echo "" >> $GITHUB_STEP_SUMMARY
269+
echo "### Validation Tests" >> $GITHUB_STEP_SUMMARY
270+
echo "- ✅ Environment configurations validated" >> $GITHUB_STEP_SUMMARY
271+
echo "- ✅ Entity counting tested" >> $GITHUB_STEP_SUMMARY
272+
echo "- ✅ Install scripts tested" >> $GITHUB_STEP_SUMMARY
273+
else
274+
echo "ℹ️ Tests skipped - no relevant files changed" >> $GITHUB_STEP_SUMMARY
275+
fi

0 commit comments

Comments
 (0)