diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 2a7c0cf3a..88cebb455 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -8,7 +8,9 @@ on: pull_request: workflow_dispatch: -permissions: { } +permissions: + id-token: write + contents: read # Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed concurrency: @@ -33,6 +35,9 @@ jobs: - 17 - 21 steps: + - name: Set start timestamp + id: start + run: printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT" - name: Checkout sources uses: actions/checkout@v4 - name: Configure JDK @@ -41,12 +46,38 @@ jobs: distribution: 'corretto' java-version: 17 cache: 'gradle' + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} + aws-region: us-west-2 + - name: Setup kat + uses: aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main - name: Configure Gradle uses: aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main - name: Test shell: bash run: | ./gradlew -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace + - name: Calculate duration + id: end + if: always() + run: | + printf -v now '%(%s)T' + duration=$(( now - ${{ steps.start.outputs.timestamp }} )) + echo "duration=$duration" >> "$GITHUB_OUTPUT" + - name: Emit metrics + if: always() # run this step even if previous steps failed or the job is canceled + uses: aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main + with: + namespace: CI Metrics + dimensions: | + Product=smithy-kotlin + JobName=${{ github.job }}(${{ matrix.java-version }}) + Branch=${{ github.base_ref || github.ref_name }} + metrics: | + WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count + WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds all-platforms: runs-on: ${{ matrix.os }} @@ -55,6 +86,10 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] steps: + - name: Set start timestamp + id: start + shell: bash + run: echo "timestamp=$(date +%s)" >> "$GITHUB_OUTPUT" - name: Checkout sources uses: actions/checkout@v4 - name: Configure JDK @@ -63,6 +98,13 @@ jobs: distribution: 'corretto' java-version: 17 cache: 'gradle' + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} + aws-region: us-west-2 + - name: Setup kat + uses: aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main - name: Configure Gradle uses: aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main - name: Test @@ -71,6 +113,26 @@ jobs: echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties ./gradlew apiCheck ./gradlew test jvmTest + - name: Calculate duration + id: end + if: always() + shell: bash + run: | + now=$(date +%s) + duration=$(( now - ${{ steps.start.outputs.timestamp }} )) + echo "duration=$duration" >> "$GITHUB_OUTPUT" + - name: Emit metrics + if: always() # run this step even if previous steps failed or the job is canceled + uses: aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main + with: + namespace: CI Metrics + dimensions: | + Product=smithy-kotlin + JobName=${{ github.job }}(${{ matrix.os }}) + Branch=${{ github.base_ref || github.ref_name }} + metrics: | + WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count + WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds - name: Save Test Reports if: failure() uses: actions/upload-artifact@v4 @@ -81,6 +143,9 @@ jobs: protocol-tests: runs-on: ubuntu-latest steps: + - name: Set start timestamp + id: start + run: printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT" - name: Checkout sources uses: actions/checkout@v4 - name: Configure JDK @@ -89,6 +154,13 @@ jobs: distribution: 'corretto' java-version: 17 cache: 'gradle' + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} + aws-region: us-west-2 + - name: Setup kat + uses: aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main - name: Configure Gradle uses: aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main - name: Test @@ -96,10 +168,32 @@ jobs: run: | ./gradlew publishToMavenLocal ./gradlew testAllProtocols + - name: Calculate duration + id: end + if: always() + run: | + printf -v now '%(%s)T' + duration=$(( now - ${{ steps.start.outputs.timestamp }} )) + echo "duration=$duration" >> "$GITHUB_OUTPUT" + - name: Emit metrics + if: always() # run this step even if previous steps failed or the job is canceled + uses: aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main + with: + namespace: CI Metrics + dimensions: | + Product=smithy-kotlin + JobName=${{ github.job }} + Branch=${{ github.base_ref || github.ref_name }} + metrics: | + WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count + WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds downstream: runs-on: ubuntu-latest steps: + - name: Set start timestamp + id: start + run: printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT" - name: Checkout sources uses: actions/checkout@v4 with: @@ -118,6 +212,13 @@ jobs: # smithy-kotlin is checked out as a sibling dir which will automatically make it an included build path: 'aws-sdk-kotlin' repository: 'aws/aws-sdk-kotlin' + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} + aws-region: us-west-2 + - name: Setup kat + uses: aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main - name: Configure Gradle - smithy-kotlin uses: aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main with: @@ -149,4 +250,23 @@ jobs: sed -i "s/smithy-kotlin-codegen-version = .*$/smithy-kotlin-codegen-version = \"$SMITHY_KOTLIN_CODEGEN_VERSION\"/" gradle/libs.versions.toml ./gradlew --parallel publishToMavenLocal ./gradlew test jvmTest - ./gradlew testAllProtocols \ No newline at end of file + ./gradlew testAllProtocols + - name: Calculate duration + id: end + if: always() + run: | + printf -v now '%(%s)T' + duration=$(( now - ${{ steps.start.outputs.timestamp }} )) + echo "duration=$duration" >> "$GITHUB_OUTPUT" + - name: Emit metrics + if: always() # run this step even if previous steps failed or the job is canceled + uses: aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main + with: + namespace: CI Metrics + dimensions: | + Product=smithy-kotlin + JobName=${{ github.job }} + Branch=${{ github.base_ref || github.ref_name }} + metrics: | + WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count + WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 65dad56e3..184a78daa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ kotlin-version = "2.2.0" dokka-version = "2.0.0" -aws-kotlin-repo-tools-version = "0.4.57" +aws-kotlin-repo-tools-version = "0.4.58" # libs coroutines-version = "1.10.2"