name: "Build & Test" env: COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} on: schedule: # Run once a day at 00:00 UTC - cron: '0 0 * * *' push: branches: [main] pull_request: workflow_dispatch: merge_group: permissions: contents: read 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: # Set CI=false to bypass a JSON parsing bug in the upstream SDK test harness # (replayingCapiProxy.ts:260-266 emitNoMatchingRequestWarning with empty body) # This can be removed once the upstream issue is fixed. CI: "false" COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.path }} run: mvn verify