Skip to content

Commit 468877d

Browse files
authored
#302 [part 1] Add GitHub workflow to validate samples (#327)
#302 Add GitHub workflow to validate samples ## Motivation and Context <!-- Why is this change needed? What problem does it solve? --> ## How Has This Been Tested? <!-- Have you tested this in a real application? Which scenarios were tested? --> ## Breaking Changes <!-- Will users need to update their code or configurations? --> ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [ ] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed ## Additional context <!-- Add any other context, implementation notes, or design decisions -->
1 parent 79bfed0 commit 468877d

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/samples.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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 Sample: ${{ matrix.sample }}"
49+
working-directory: ./samples/${{ matrix.sample }}
50+
run: ./../../gradlew --no-daemon clean build
51+
52+
- name: Upload Reports
53+
if: ${{ !cancelled() }}
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: reports-${{ matrix.sample }}
57+
path: |
58+
**/build/reports/

0 commit comments

Comments
 (0)