test(showcase): add integration tests for retries #4766
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
| permissions: | |
| contents: read | |
| name: sdk-platform-java Dependency Compatibility Test | |
| on: | |
| pull_request: | |
| branches: | |
| - 'main' | |
| workflow_dispatch: | |
| inputs: | |
| dependencies-list: | |
| description: 'Comma-separated list of dependencies to test (Example format: protobuf=4.31.0,guava=33.4.8-jre). | |
| Note: The name should be the maven property. Find this value in the <properties> section in the pom. | |
| Do not include the `-D` prefix or `.version` suffix. Those values will be appended when generating | |
| the command. No input (default) will run the the upper-bound dependencies file.' | |
| required: false | |
| default: '' | |
| env: | |
| BUILD_SUBDIR: sdk-platform-java | |
| jobs: | |
| filter: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| library: ${{ steps.filter.outputs.library }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| persist-credentials: false | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: filter | |
| with: | |
| filters: | | |
| library: | |
| - 'sdk-platform-java/**' | |
| - 'google-auth-library-java/**' | |
| - '.github/workflows/sdk-platform-java-dependency-compatibility-test.yaml' | |
| dependency-compatibility-test: | |
| needs: filter | |
| if: ${{ needs.filter.outputs.library == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout sdk-platform-java | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| persist-credentials: false | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| # The workflow_dispatch event is for team members who want to manually test certain dependencies + version combos | |
| # The normal workflow is not from `workflow_dispatch` and will use the default upper-bounds dependencies file | |
| - name: Determine Inputted Dependencies List | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dependencies-list != '' }} | |
| run: echo "DEPENDENCIES_LIST=${GITHUB_EVENT_INPUTS_DEPENDENCIES_LIST}" >> $GITHUB_ENV | |
| env: | |
| GITHUB_EVENT_INPUTS_DEPENDENCIES_LIST: ${{ github.event.inputs.dependencies-list }} | |
| - name: Install sdk-platform-java modules | |
| shell: bash | |
| run: .kokoro/build.sh | |
| env: | |
| BUILD_SUBDIR: sdk-platform-java | |
| JOB_TYPE: install | |
| # Run in the root module which should test for everything except for showcase | |
| - name: Perform Dependency Compatibility Unit Testing | |
| shell: bash | |
| run: | | |
| if [[ -n "${DEPENDENCIES_LIST}" ]]; then | |
| .github/scripts/test_dependency_compatibility.sh -l ${DEPENDENCIES_LIST} | |
| else | |
| .github/scripts/test_dependency_compatibility.sh | |
| fi | |
| working-directory: sdk-platform-java | |
| # Set up local showcase server to run the showcase ITs | |
| - name: Parse showcase version | |
| working-directory: java-showcase/gapic-showcase | |
| run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV" | |
| - name: Install showcase server | |
| run: | | |
| sudo mkdir -p /usr/src/showcase | |
| sudo chown -R ${USER} /usr/src/ | |
| curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz | |
| cd /usr/src/showcase/ | |
| tar -xf showcase-* | |
| # Start standard insecure showcase server on default port 7469 for standard integration tests | |
| ./gapic-showcase run & | |
| # Start secure TLS showcase server on port 7470 for PQC TLS integration tests | |
| ./gapic-showcase run --port 7470 --tls --ca-cert-output-file /tmp/showcase-ca.pem & | |
| # Wait deterministically for both background showcase servers to finish binding ports 7469/7470 | |
| # and writing /tmp/showcase-ca.pem. Starting TLS requires RSA key generation and disk I/O, | |
| # which can cause race conditions if tests start before /tmp/showcase-ca.pem is created. | |
| for i in $(seq 1 30); do | |
| if (echo > /dev/tcp/127.0.0.1/7469) 2>/dev/null && \ | |
| (echo > /dev/tcp/127.0.0.1/7470) 2>/dev/null && \ | |
| [ -f /tmp/showcase-ca.pem ]; then | |
| echo "Showcase servers (ports 7469, 7470) and CA cert ready in attempt $i." | |
| break | |
| fi | |
| sleep 0.2 | |
| done | |
| cd - | |
| working-directory: sdk-platform-java | |
| # Run Showcase's Integration Tests | |
| - name: Perform Dependency Compatibility Integration Testing (Showcase Tests) | |
| shell: bash | |
| # Need to cd out of the directory to get the scripts as this step is run inside the java-showcase directory | |
| run: | | |
| if [[ -n "${DEPENDENCIES_LIST}" ]]; then | |
| ../sdk-platform-java/.github/scripts/test_dependency_compatibility.sh -l ${DEPENDENCIES_LIST} | |
| else | |
| ../sdk-platform-java/.github/scripts/test_dependency_compatibility.sh -f ../sdk-platform-java/dependencies.txt | |
| fi | |
| working-directory: java-showcase |