File tree Expand file tree Collapse file tree 1 file changed +76
-0
lines changed Expand file tree Collapse file tree 1 file changed +76
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build Samples
2+
3+ on :
4+ workflow_dispatch :
5+ pull_request :
6+ branches : [ main ]
7+ paths :
8+ - ' samples/**'
9+ push :
10+ branches : [ main ]
11+ paths :
12+ - ' samples/**'
13+
14+ concurrency :
15+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+ # Cancel only when the run is NOT on `main` branch
17+ cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
18+
19+ jobs :
20+ build :
21+ runs-on : ubuntu-latest
22+ strategy :
23+ matrix :
24+ sample :
25+ - kotlin-mcp-client
26+ - kotlin-mcp-server
27+ - weather-stdio-server
28+
29+ name : Build Sample
30+ timeout-minutes : 10
31+ env :
32+ JAVA_OPTS : " -Xmx8g -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Dkotlin.daemon.jvm.options=-Xmx6g"
33+ steps :
34+ - uses : actions/checkout@v5
35+
36+ - name : Set up JDK 21
37+ uses : actions/setup-java@v5
38+ with :
39+ java-version : 21
40+ distribution : ' temurin'
41+
42+ - name : Setup Gradle
43+ uses : gradle/actions/setup-gradle@v5
44+ with :
45+ add-job-summary : ' always'
46+ cache-read-only : true
47+
48+ - name : Build with Gradle
49+ working-directory : matrix.sample
50+ run : |-
51+ ./../../gradlew --no-daemon --rerun-tasks \
52+ clean \
53+ ktlintCheck \
54+ build \
55+ koverLog koverHtmlReport \
56+ publishToMavenLocal
57+
58+ - name : " Build Sample: ${{ matrix.sample }}"
59+ working-directory : ./samples/${{ matrix.sample }}
60+ run : ./../../gradlew --no-daemon --rerun-tasks clean build
61+
62+ - name : Upload Reports
63+ if : ${{ !cancelled() }}
64+ uses : actions/upload-artifact@v4
65+ with :
66+ name : reports
67+ path : |
68+ **/build/reports/
69+
70+ - name : Disable Auto-Merge on Fail
71+ if : failure() && github.event_name == 'pull_request'
72+ run : gh pr merge --disable-auto "$PR_URL"
73+ env :
74+ PR_URL : ${{github.event.pull_request.html_url}}
75+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
76+
You can’t perform that action at this time.
0 commit comments