Skip to content

Commit 81d21c3

Browse files
committed
fix: use ubuntu-latest for forks, add verbose logging
1 parent ca97c75 commit 81d21c3

1 file changed

Lines changed: 126 additions & 14 deletions

File tree

.github/workflows/sdk-diff-analyzer.yaml

Lines changed: 126 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ on:
1919
description: 'Ignore last-analyzed state and analyze N commits from HEAD'
2020
default: 'false'
2121
type: boolean
22+
debug:
23+
description: 'Enable verbose debug logging'
24+
default: 'true'
25+
type: boolean
2226

2327
env:
2428
# Tag in this repo that stores the last analyzed gdc-nas commit hash
@@ -28,18 +32,46 @@ env:
2832
jobs:
2933
analyze:
3034
name: Analyze gdc-nas changes
31-
runs-on:
32-
group: infra1-runners-arc
33-
labels: runners-small
35+
# Use self-hosted runners in production, GitHub-hosted for forks/testing
36+
runs-on: ${{ github.repository == 'gooddata/gooddata-python-sdk' && 'infra1-runners-arc' || 'ubuntu-latest' }}
3437
permissions:
3538
contents: write
3639
actions: write
3740
steps:
41+
- name: Debug - Show environment
42+
run: |
43+
echo "=== Environment Info ==="
44+
echo "Repository: ${{ github.repository }}"
45+
echo "Ref: ${{ github.ref }}"
46+
echo "SHA: ${{ github.sha }}"
47+
echo "Actor: ${{ github.actor }}"
48+
echo "Event: ${{ github.event_name }}"
49+
echo "Runner OS: ${{ runner.os }}"
50+
echo "Working directory: $(pwd)"
51+
echo ""
52+
echo "=== Inputs ==="
53+
echo "commits_to_analyze: ${{ inputs.commits_to_analyze || '50' }}"
54+
echo "force_full_scan: ${{ inputs.force_full_scan || 'false' }}"
55+
echo "debug: ${{ inputs.debug || 'true' }}"
56+
3857
- name: Checkout SDK repository
3958
uses: actions/checkout@v4
4059
with:
4160
fetch-depth: 0 # Need full history for tag operations
4261

62+
- name: Debug - SDK repo info
63+
run: |
64+
echo "=== SDK Repository ==="
65+
echo "Current directory: $(pwd)"
66+
echo "Git status:"
67+
git status
68+
echo ""
69+
echo "Recent tags:"
70+
git tag -l | tail -10 || echo "No tags found"
71+
echo ""
72+
echo "Looking for state tag '${{ env.STATE_TAG }}':"
73+
git show-ref --tags "${{ env.STATE_TAG }}" || echo "State tag not found"
74+
4375
- name: Clone gdc-nas repository
4476
uses: actions/checkout@v4
4577
with:
@@ -48,17 +80,50 @@ jobs:
4880
fetch-depth: 0 # Full history needed for diff analysis
4981
token: ${{ secrets.GDC_NAS_READ_TOKEN || secrets.GITHUB_TOKEN }}
5082

83+
- name: Debug - gdc-nas repo info
84+
run: |
85+
echo "=== gdc-nas Repository ==="
86+
echo "Directory contents:"
87+
ls -la gdc-nas/ | head -20
88+
echo ""
89+
echo "Git log (last 5 commits):"
90+
git -C gdc-nas log --oneline -5
91+
echo ""
92+
echo "Current HEAD:"
93+
git -C gdc-nas rev-parse HEAD
94+
echo ""
95+
echo "Total commits in repo:"
96+
git -C gdc-nas rev-list --count HEAD
97+
5198
- name: Setup Python
5299
uses: actions/setup-python@v5
53100
with:
54101
python-version: '3.12'
55102

103+
- name: Debug - Python info
104+
run: |
105+
echo "=== Python Environment ==="
106+
python3 --version
107+
which python3
108+
echo ""
109+
echo "Analyzer script exists:"
110+
ls -la scripts/gdc_nas_diff_analyzer.py || echo "SCRIPT NOT FOUND!"
111+
echo ""
112+
echo "Script is executable:"
113+
head -5 scripts/gdc_nas_diff_analyzer.py
114+
56115
- name: Get last analyzed commit
57116
id: state
58117
run: |
118+
set -x # Enable command tracing
119+
59120
COMMITS_TO_ANALYZE="${{ inputs.commits_to_analyze || '50' }}"
60121
FORCE_FULL="${{ inputs.force_full_scan || 'false' }}"
61122
123+
echo "=== Determining analysis range ==="
124+
echo "COMMITS_TO_ANALYZE: $COMMITS_TO_ANALYZE"
125+
echo "FORCE_FULL: $FORCE_FULL"
126+
62127
# Get current gdc-nas HEAD
63128
GDC_NAS_HEAD=$(git -C gdc-nas rev-parse HEAD)
64129
echo "gdc_nas_head=$GDC_NAS_HEAD" >> $GITHUB_OUTPUT
@@ -70,11 +135,13 @@ jobs:
70135
echo "mode=force" >> $GITHUB_OUTPUT
71136
elif git show-ref --tags --quiet "$STATE_TAG"; then
72137
# Tag exists - get the stored gdc-nas commit from tag message
138+
echo "State tag found, reading contents..."
73139
LAST_COMMIT=$(git tag -l --format='%(contents)' "$STATE_TAG" | head -1)
74140
echo "Found state tag with gdc-nas commit: $LAST_COMMIT"
75141
76142
# Verify this commit exists in gdc-nas
77143
if git -C gdc-nas rev-parse "$LAST_COMMIT" >/dev/null 2>&1; then
144+
echo "Commit verified in gdc-nas"
78145
echo "since=$LAST_COMMIT" >> $GITHUB_OUTPUT
79146
echo "mode=incremental" >> $GITHUB_OUTPUT
80147
else
@@ -88,50 +155,72 @@ jobs:
88155
echo "mode=initial" >> $GITHUB_OUTPUT
89156
fi
90157
158+
set +x
159+
91160
- name: Check for new commits
92161
id: check
93162
working-directory: gdc-nas
94163
run: |
164+
set -x
95165
SINCE="${{ steps.state.outputs.since }}"
96166
167+
echo "=== Checking commits ==="
168+
echo "SINCE: $SINCE"
169+
97170
# Count commits to analyze
98171
if [[ "$SINCE" == HEAD~* ]]; then
99172
NUM="${SINCE#HEAD~}"
100173
COMMIT_COUNT=$NUM
174+
echo "Using HEAD~N format, will analyze $NUM commits"
101175
else
102176
COMMIT_COUNT=$(git rev-list --count "${SINCE}..HEAD" 2>/dev/null || echo "0")
177+
echo "Counting commits from $SINCE to HEAD: $COMMIT_COUNT"
103178
fi
104179
105-
echo "Commits to analyze: $COMMIT_COUNT"
106180
echo "commit_count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
107181
108182
if [ "$COMMIT_COUNT" -eq 0 ]; then
109183
echo "No new commits to analyze"
110184
echo "skip=true" >> $GITHUB_OUTPUT
111185
else
186+
echo "Will analyze $COMMIT_COUNT commits"
112187
echo "skip=false" >> $GITHUB_OUTPUT
113188
fi
189+
set +x
114190
115191
- name: Run SDK diff analyzer
116192
if: steps.check.outputs.skip != 'true'
117193
run: |
194+
set -x
118195
mkdir -p reports
119196
120-
echo "Running analyzer with --since ${{ steps.state.outputs.since }}"
197+
echo "=== Running Analyzer ==="
198+
echo "Since: ${{ steps.state.outputs.since }}"
199+
echo "Mode: ${{ steps.state.outputs.mode }}"
200+
echo "Commit count: ${{ steps.check.outputs.commit_count }}"
121201
202+
# Run with verbose output
122203
python3 scripts/gdc_nas_diff_analyzer.py \
123204
--since "${{ steps.state.outputs.since }}" \
124205
--sdk-details \
125206
--output-dir ./reports \
126-
--repo-path ./gdc-nas
207+
--repo-path ./gdc-nas \
208+
2>&1 | tee analyzer_output.log
209+
210+
ANALYZER_EXIT_CODE=${PIPESTATUS[0]}
211+
echo "Analyzer exit code: $ANALYZER_EXIT_CODE"
212+
213+
echo ""
214+
echo "=== Reports directory ==="
215+
ls -la reports/ || echo "Reports directory empty or missing"
127216
128217
# Check if any reports were generated
129218
if [ -f reports/00-summary.md ]; then
130-
echo "SDK-relevant changes found"
219+
echo ""
220+
echo "=== Summary report content ==="
131221
cat reports/00-summary.md
132222
else
133-
echo "No SDK-relevant changes detected"
134-
# Create a minimal summary for record-keeping
223+
echo "No SDK-relevant changes detected, creating minimal summary"
135224
cat > reports/00-summary.md << EOF
136225
# SDK Diff Analysis - No Changes
137226
@@ -144,6 +233,7 @@ jobs:
144233
*No SDK-relevant changes detected in the analyzed commits.*
145234
EOF
146235
fi
236+
set +x
147237
148238
- name: Upload analysis reports
149239
if: steps.check.outputs.skip != 'true'
@@ -153,32 +243,54 @@ jobs:
153243
path: reports/
154244
retention-days: 30
155245

246+
- name: Upload analyzer log
247+
if: always()
248+
uses: actions/upload-artifact@v4
249+
with:
250+
name: analyzer-log-${{ github.run_number }}
251+
path: analyzer_output.log
252+
retention-days: 7
253+
if-no-files-found: ignore
254+
156255
- name: Update state tag
157256
if: steps.check.outputs.skip != 'true'
158257
run: |
258+
set -x
159259
GDC_NAS_HEAD="${{ steps.state.outputs.gdc_nas_head }}"
160260
261+
echo "=== Updating state tag ==="
262+
echo "Will store gdc-nas commit: $GDC_NAS_HEAD"
263+
161264
# Configure git for tagging
162265
git config user.name "github-actions[bot]"
163266
git config user.email "github-actions[bot]@users.noreply.github.com"
164267
165268
# Create/update annotated tag with gdc-nas commit in message
166269
git tag -f -a "$STATE_TAG" -m "$GDC_NAS_HEAD"
270+
271+
echo "Pushing tag to origin..."
167272
git push -f origin "$STATE_TAG"
168273
169274
echo "Updated $STATE_TAG to track gdc-nas commit: $GDC_NAS_HEAD"
170275
276+
# Verify
277+
echo "Verifying tag:"
278+
git show-ref --tags "$STATE_TAG"
279+
set +x
280+
171281
- name: Job summary
172282
if: always()
173283
run: |
174284
cat >> $GITHUB_STEP_SUMMARY << EOF
175285
## SDK Diff Analyzer Results
176286
177-
- **Mode:** ${{ steps.state.outputs.mode }}
178-
- **Since:** \`${{ steps.state.outputs.since }}\`
179-
- **gdc-nas HEAD:** \`${{ steps.state.outputs.gdc_nas_head }}\`
180-
- **Commits analyzed:** ${{ steps.check.outputs.commit_count }}
181-
- **Skipped:** ${{ steps.check.outputs.skip }}
287+
| Parameter | Value |
288+
|-----------|-------|
289+
| Mode | ${{ steps.state.outputs.mode }} |
290+
| Since | \`${{ steps.state.outputs.since }}\` |
291+
| gdc-nas HEAD | \`${{ steps.state.outputs.gdc_nas_head }}\` |
292+
| Commits analyzed | ${{ steps.check.outputs.commit_count }} |
293+
| Skipped | ${{ steps.check.outputs.skip }} |
182294
183295
EOF
184296

0 commit comments

Comments
 (0)