-
Notifications
You must be signed in to change notification settings - Fork 3
105 lines (90 loc) · 2.87 KB
/
build-test.yml
File metadata and controls
105 lines (90 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: "Build & Test"
on:
schedule:
# Run once a week on Sundays at 00:00 UTC
- cron: '0 0 * * 0'
push:
branches: [main]
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.github/**'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.github/**'
workflow_dispatch:
merge_group:
permissions:
contents: write
checks: write
jobs:
java-sdk:
name: "Java SDK Tests"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
- uses: actions/setup-java@v5
with:
java-version: "17"
distribution: "temurin"
cache: "maven"
- name: Run spotless check
run: |
mvn spotless:check
if [ $? -ne 0 ]; then
echo "❌ spotless:check failed. Please run 'mvn spotless:apply' in java"
exit 1
fi
echo "✅ spotless:check passed"
- name: Build SDK and clone test harness
run: mvn test-compile
- name: Verify Javadoc generation
run: mvn javadoc:javadoc -q
- name: Install Copilot CLI from cloned SDK
id: setup-copilot
run: |
# Install dependencies in the cloned SDK's nodejs directory
# This ensures we use the same CLI version as the test harness expects
cd target/copilot-sdk/nodejs
npm ci --ignore-scripts
echo "path=$(pwd)/node_modules/@github/copilot/index.js" >> $GITHUB_OUTPUT
- name: Verify CLI works
run: node ${{ steps.setup-copilot.outputs.path }} --version
- name: Run Java SDK tests
env:
CI: "true"
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.path }}
run: mvn verify
- name: Upload test results for site generation
if: success() && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v6
with:
name: test-results-for-site
path: |
target/jacoco-test-results/sdk-tests.exec
target/surefire-reports/
retention-days: 1
- name: Generate and commit JaCoCo badge
if: success() && github.ref == 'refs/heads/main'
run: |
.github/scripts/generate-coverage-badge.sh
# Commit if changed
if [[ $(git status --porcelain .github/badges/) ]]; then
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add .github/badges/
git commit -m "Update JaCoCo coverage badge"
git push
fi
- name: Generate Test Report Summary
if: always()
uses: ./.github/actions/test-report