Fix duplicate plugin application, simplify CI to use JDK 11, and fix DTS emulator connectivity #617
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
| name: Build Validation | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'microsoft' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| - name: Build with Gradle | |
| run: ./gradlew build -x test | |
| - name: Run SpotBugs | |
| run: ./gradlew spotbugsMain spotbugsTest | |
| continue-on-error: false | |
| - name: Upload SpotBugs reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: SpotBugs Reports | |
| path: '**/build/reports/spotbugs' | |
| if-no-files-found: ignore | |
| - name: Run Unit Tests with Gradle | |
| run: ./gradlew clean test || echo "UNIT_TEST_FAILED=true" >> $GITHUB_ENV | |
| continue-on-error: true | |
| - name: Upload test reports if tests failed | |
| if: env.UNIT_TEST_FAILED == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Unit Test Reports | |
| path: '**/build/reports/tests/test' | |
| if-no-files-found: ignore # Prevents errors if no reports exist | |
| - name: Fail the job if unit tests failed | |
| if: env.UNIT_TEST_FAILED == 'true' | |
| run: exit 1 | |
| - name: Initialize Durable Task Emulator | |
| run: docker run --name durabletask-emulator -p 4001:8080 -d mcr.microsoft.com/dts/dts-emulator:latest | |
| - name: Display Durable Task Emulator Logs | |
| run: nohup docker logs -f durabletask-emulator > durabletask-emulator.log 2>&1 & | |
| - name: Wait for Durable Task Emulator to be ready | |
| run: | | |
| echo "Waiting for Durable Task Emulator to be ready on port 4001..." | |
| # Maximum wait time of 60 seconds for emulator startup | |
| MAX_WAIT_SECONDS=60 | |
| attempt=0 | |
| # Use bash's /dev/tcp for portability instead of nc | |
| while ! (echo > /dev/tcp/localhost/4001) 2>/dev/null; do | |
| attempt=$((attempt + 1)) | |
| if [ $attempt -ge $MAX_WAIT_SECONDS ]; then | |
| echo "ERROR: Emulator not ready after $MAX_WAIT_SECONDS seconds" | |
| echo "Docker container status:" | |
| docker ps -a | |
| echo "Container logs:" | |
| docker logs durabletask-emulator 2>&1 | tail -50 | |
| exit 1 | |
| fi | |
| echo "Attempt $attempt/$MAX_WAIT_SECONDS - waiting for emulator..." | |
| sleep 1 | |
| done | |
| echo "Durable Task Emulator is ready on port 4001" | |
| # Give additional time for gRPC service to fully initialize after port is open | |
| sleep 5 | |
| - name: Integration Tests with Gradle | |
| run: ./gradlew integrationTest || echo "TEST_FAILED=true" >> $GITHUB_ENV | |
| continue-on-error: true | |
| - name: Kill Durable Task Emulator | |
| run: docker kill durabletask-emulator | |
| - name: Upload Durable Task Emulator Logs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Durable Task Emulator Logs | |
| path: durabletask-emulator.log | |
| - name: Archive test report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Integration test report | |
| path: client/build/reports/tests/integrationTest | |
| - name: Upload JAR output | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Package | |
| path: client/build/libs | |
| - name: Fail the job if tests failed | |
| if: env.TEST_FAILED == 'true' | |
| run: exit 1 | |
| functions-e2e-tests: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'microsoft' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| - name: Publish to local | |
| run: ./gradlew publishToMavenLocal -PskipSigning | |
| - name: Build azure functions sample | |
| run: ./gradlew azureFunctionsPackage | |
| continue-on-error: true | |
| - name: Setup azure functions runtime | |
| run: endtoendtests/e2e-test-setup.ps1 -DockerfilePath endtoendtests/Dockerfile | |
| shell: pwsh | |
| - name: End to End Tests with Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| with: | |
| arguments: endToEndTest | |
| - name: Archive test report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Integration test report | |
| path: client/build/reports/tests/endToEndTest | |
| functions-sample-tests: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'microsoft' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| - name: Publish to local | |
| run: ./gradlew publishToMavenLocal -PskipSigning | |
| - name: Build azure functions sample | |
| run: ./gradlew azureFunctionsPackage | |
| continue-on-error: true | |
| - name: Setup azure functions runtime | |
| run: samples-azure-functions/e2e-test-setup.ps1 -DockerfilePath samples-azure-functions/Dockerfile | |
| shell: pwsh | |
| - name: Sample Tests with Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| with: | |
| arguments: sampleTest | |
| - name: Archive test report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Integration test report | |
| path: client/build/reports/tests/endToEndTest |