|
| 1 | +name: Telemetry Conformance Tests |
| 2 | + |
| 3 | +# SDK handlers and builds live here. The shared workflow deploys and validates them. |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + # Include the parent PR branch while this change is stacked on PR #822. |
| 8 | + # Remove that branch filter when retargeting this PR to main. |
| 9 | + branches: [main, feat/conformance-tests-telemetry] |
| 10 | + paths: |
| 11 | + - "sdk/**" |
| 12 | + - "telemetry-exporter/**" |
| 13 | + - "conformance-tests-telemetry/**" |
| 14 | + - "pom.xml" |
| 15 | + - ".github/workflows/telemetry-conformance-tests.yml" |
| 16 | + push: |
| 17 | + branches: [main] |
| 18 | + paths: |
| 19 | + - "sdk/**" |
| 20 | + - "telemetry-exporter/**" |
| 21 | + - "conformance-tests-telemetry/**" |
| 22 | + - "pom.xml" |
| 23 | + - ".github/workflows/telemetry-conformance-tests.yml" |
| 24 | + workflow_dispatch: |
| 25 | + inputs: |
| 26 | + aws_region: |
| 27 | + description: AWS region |
| 28 | + required: true |
| 29 | + default: us-west-2 |
| 30 | + type: string |
| 31 | + conformance_test_ref: |
| 32 | + description: Optional conformance test commit SHA or branch name. Empty uses the shared workflow commit. |
| 33 | + required: false |
| 34 | + type: string |
| 35 | + default: "" |
| 36 | + |
| 37 | +permissions: {} |
| 38 | + |
| 39 | +jobs: |
| 40 | + telemetry: |
| 41 | + # 1. Run for non-PR events, such as pushes and manual invocations. |
| 42 | + # 2. For PRs, run only same-repo branches from non-Dependabot actors. Forked PRs and Dependabot cannot read secrets. |
| 43 | + if: github.event_name != 'pull_request' || (github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository) |
| 44 | + permissions: |
| 45 | + contents: read |
| 46 | + id-token: write |
| 47 | + # The pinned SHA also selects the runner and telemetry-extension revision the shared |
| 48 | + # workflow installs, so it must be reachable from a branch. It is the head of |
| 49 | + # aws-durable-execution-conformance-tests PR #150; re-pin to that PR's merge commit once it lands. |
| 50 | + uses: aws/aws-durable-execution-conformance-tests/.github/workflows/telemetry-suite.yml@3e4fdaf0dda35ed8f64fb0d18365ef05a6a447fe |
| 51 | + with: |
| 52 | + language: java |
| 53 | + resource_prefix: java |
| 54 | + sdk_repository: aws/aws-durable-execution-sdk-java |
| 55 | + sdk_ref: ${{ github.event.pull_request.head.sha || github.sha }} |
| 56 | + # Path relative to the conformance workspace, where this repo is checked out at .build/durable-sdk. |
| 57 | + examples_dir: .build/durable-sdk/conformance-tests-telemetry |
| 58 | + conformance_test_ref: ${{ inputs.conformance_test_ref }} |
| 59 | + aws_region: ${{ inputs.aws_region || 'us-west-2' }} |
| 60 | + runs_on: codebuild-github-actions-runner-${{ github.run_id }}-${{ github.run_attempt }} |
| 61 | + timeout_minutes: 30 |
| 62 | + setup_command: | |
| 63 | + set -euo pipefail |
| 64 | + if [ -n "${JAVA_HOME_21_X64:-}" ]; then |
| 65 | + export JAVA_HOME="$JAVA_HOME_21_X64" |
| 66 | + elif [ -x /usr/lib/jvm/java-21-amazon-corretto/bin/java ]; then |
| 67 | + export JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto |
| 68 | + elif [ -z "${JAVA_HOME:-}" ]; then |
| 69 | + export JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v java)")")")" |
| 70 | + fi |
| 71 | + if [ ! -x "$JAVA_HOME/bin/java" ] || [ ! -x "$JAVA_HOME/bin/javac" ]; then |
| 72 | + echo "Selected JAVA_HOME=$JAVA_HOME is not a complete JDK" |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | + export PATH="$JAVA_HOME/bin:$PATH" |
| 76 | + java_spec=$(java -XshowSettings:properties -version 2>&1 | awk '$1 == "java.specification.version" {print $3}') |
| 77 | + if [ "$java_spec" != "21" ]; then |
| 78 | + echo "Java 21 is required; selected JAVA_HOME=$JAVA_HOME reports specification version $java_spec" |
| 79 | + exit 1 |
| 80 | + fi |
| 81 | + javac_version=$(javac -version 2>&1) |
| 82 | + if [[ ! "$javac_version" =~ ^javac[[:space:]]21([.]|[[:space:]]|$) ]]; then |
| 83 | + echo "Java 21 javac is required; selected compiler reports $javac_version" |
| 84 | + exit 1 |
| 85 | + fi |
| 86 | + java -version |
| 87 | + javac -version |
| 88 | + if [ -n "${GITHUB_ENV:-}" ]; then |
| 89 | + echo "JAVA_HOME=$JAVA_HOME" >> "$GITHUB_ENV" |
| 90 | + fi |
| 91 | + if [ -n "${GITHUB_PATH:-}" ]; then |
| 92 | + echo "$JAVA_HOME/bin" >> "$GITHUB_PATH" |
| 93 | + fi |
| 94 | + prepare_command: | |
| 95 | + JAVA_SDK_VERSION=$( |
| 96 | + mvn -B -q \ |
| 97 | + --file "$SDK_CHECKOUT/pom.xml" \ |
| 98 | + -Dstyle.color=never \ |
| 99 | + -Dexpression=project.version \ |
| 100 | + -DforceStdout \ |
| 101 | + help:evaluate |
| 102 | + ) |
| 103 | + mvn -B -q \ |
| 104 | + --file "$SDK_CHECKOUT/pom.xml" \ |
| 105 | + --projects sdk,telemetry-exporter \ |
| 106 | + --also-make \ |
| 107 | + -DskipTests \ |
| 108 | + install |
| 109 | + echo "Using Java SDK version $JAVA_SDK_VERSION" |
| 110 | + # The runner's sam build runs in a later step. Only GITHUB_ENV carries the version to it. |
| 111 | + echo "JAVA_SDK_VERSION=$JAVA_SDK_VERSION" >> "$GITHUB_ENV" |
| 112 | + mvn -B -q -DskipTests package \ |
| 113 | + -Ddurable.sdk.version="$JAVA_SDK_VERSION" \ |
| 114 | + --file "$EXAMPLES_DIR/pom.xml" |
| 115 | + secrets: |
| 116 | + CONFORMANCE_TEST_ROLE_ARN: ${{ secrets.TEST_ROLE_ARN }} |
| 117 | + CONFORMANCE_TEST_ACCOUNT_ID: ${{ secrets.TEST_ACCOUNT_ID }} |
| 118 | + CONFORMANCE_TEST_LAMBDA_EXECUTION_ROLE_ARN: ${{ secrets.TEST_LAMBDA_EXECUTION_ROLE_ARN }} |
0 commit comments