Skip to content

Commit 6667fe9

Browse files
runningcodeclaude
andcommitted
ci(samples): Run the Android sample's check in its own workflow
Instead of adding it to `make preMerge`, which the SDK's Build job runs, a new Samples workflow runs the Android sample build's `check` as its own job. A broken sample then fails its own check, it runs in parallel with the SDK build, and the Build job doesn't get longer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0da6737 commit 6667fe9

2 files changed

Lines changed: 78 additions & 6 deletions

File tree

‎.github/workflows/samples.yml‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 'Samples'
2+
# Runs `check` in each build the SDK build doesn't include, so a broken sample or
3+
# integration test fails its own job instead of the SDK's Build job.
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
check:
16+
name: Check ${{ matrix.name }}
17+
runs-on: ubuntu-latest
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- name: sentry-samples-android
24+
path: sentry-samples/sentry-samples-android
25+
26+
env:
27+
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
28+
29+
steps:
30+
- name: Checkout Repo
31+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
32+
with:
33+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
34+
submodules: 'recursive'
35+
36+
- name: Setup Java Version
37+
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
38+
with:
39+
distribution: 'temurin'
40+
java-version: '21'
41+
42+
# Workaround for https://github.com/gradle/actions/issues/21 to use config cache
43+
- name: Cache buildSrc
44+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
45+
with:
46+
path: buildSrc/build
47+
key: build-logic-${{ hashFiles('buildSrc/src/**', 'buildSrc/build.gradle.kts','buildSrc/settings.gradle.kts') }}
48+
49+
- name: Setup Gradle
50+
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
51+
with:
52+
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
53+
54+
- name: Run Tests and Lint
55+
run: ./gradlew -p ${{ matrix.path }} check
56+
57+
- name: Upload test results
58+
if: always()
59+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
60+
with:
61+
name: test-results-${{ matrix.name }}
62+
path: |
63+
**/build/reports/*
64+
65+
- name: Test Report
66+
uses: phoenix-actions/test-reporting@7317eea6e13c47348dd0bb318669485157c518d6 # pin@v16
67+
if: always()
68+
with:
69+
name: JUnit ${{ matrix.name }}
70+
list-suites: 'failed'
71+
list-tests: 'failed'
72+
path: |
73+
**/build/test-results/**/*.xml
74+
reporter: java-junit
75+
output-to: step-summary
76+
fail-on-error: false

‎Makefile‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check checkSampleAndroid preMerge publish
1+
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check preMerge publish
22

33
all: stop clean javadocs compile
44
assembleUiTests: assembleUiTestRelease
5-
preMerge: check checkSampleAndroid
5+
preMerge: check
66
publish: clean dryRelease
77

88
# deep clean
@@ -49,7 +49,3 @@ runUiTestCritical:
4949
# Run tests and lint
5050
check:
5151
./gradlew check
52-
53-
# The Android sample is a separate build, so the root `check` doesn't reach it
54-
checkSampleAndroid:
55-
./gradlew -p sentry-samples/sentry-samples-android check

0 commit comments

Comments
 (0)