Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add release checks #1069

Merged
merged 23 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/setup-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup Build
description: >
Checkout repositories and build dependencies

runs:
using: composite
steps:
- name: Checkout tools
uses: actions/checkout@v4
with:
path: 'aws-kotlin-repo-tools'
repository: 'awslabs/aws-kotlin-repo-tools'
ref: 'gh-action'
sparse-checkout: |
.github
- name: Checkout smithy-kotlin
uses: ./aws-kotlin-repo-tools/.github/actions/checkout-head
with:
# checkout smithy-kotlin as a sibling which will automatically make it an included build
path: 'smithy-kotlin'
repository: 'awslabs/smithy-kotlin'
Comment on lines +16 to +21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Do we also need to checkout aws-crt-kotlin?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally this would be handled by improving this tooling. Right now we don't update aws-crt-kotlin often enough or with large enough changes that it's worth considering at the moment. I'm thinking we revisit this when it's a problem and we need it (likely as we pursue other KMP targets).

- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
cache: 'gradle'
1 change: 1 addition & 0 deletions .github/scripts/run-codebuild-batch-job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fi

BUILD_ID=$(echo ${START_RESULT} | jq '.buildBatch.id' -r)
echo "Build id $BUILD_ID"
echo "aws-build-id=$BUILD_ID" >> "$GITHUB_OUTPUT"

BUILD_STATUS="IN_PROGRESS"
while [ "$BUILD_STATUS" == "IN_PROGRESS" ]; do
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
changelog-verification:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Check for changelog entry
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
run: |
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/codebuild-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ 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:
group: ci-codebuild-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e-tests:
runs-on: ubuntu-latest
Expand All @@ -20,9 +25,19 @@ jobs:
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
aws-region: us-west-2
- name: Run E2E Tests
id: e2e-tests
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: gh-aws-sdk-kotlin-e2e-tests
- name: Cancel build
if: ${{ cancelled() }}
env:
BUILD_ID: ${{ steps.e2e-tests.outputs.aws-build-id }}
run: |
if [ ! -z "$BUILD_ID"]; then
echo "cancelling in-progress build: id=$BUILD_ID"
aws codebuild stop-build --id $BUILD_ID
fi

service-check-batch:
runs-on: ubuntu-latest
Expand All @@ -35,5 +50,15 @@ jobs:
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
aws-region: us-west-2
- name: Run Service Check Batch
id: svc-check-batch
run: |
.github/scripts/run-codebuild-batch-job.sh gh-aws-sdk-kotlin-svc-check-batch ${{ github.event.pull_request.head.sha }}
- name: Cancel build
if: ${{ cancelled() }}
env:
BUILD_ID: ${{ steps.svc-check-batch.outputs.aws-build-id }}
run: |
if [ ! -z "$BUILD_ID" ]; then
echo "cancelling in-progress batch build: id=$BUILD_ID"
aws codebuild stop-build --id $BUILD_ID
fi
17 changes: 4 additions & 13 deletions .github/workflows/codegen-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:
cancel-in-progress: true

env:
JAVA_VERSION: 11
JAVA_VERSION: 17
RUN: ${{ github.run_id }}-${{ github.run_number }}
DIFF2HTML_VERSION: 5.2.5
# Below is the set of services that are generated for codegen preview
Expand Down Expand Up @@ -49,27 +49,18 @@ jobs:
- uses: actions/checkout@v4
with:
repository: 'awslabs/aws-kotlin-repo-tools'
ref: 'ci-utils'
path: 'aws-kotlin-repo-tools'
- uses: actions/checkout@v4
with:
repository: 'awslabs/smithy-kotlin'
fetch-depth: 0
path: 'smithy-kotlin'
- uses: actions/cache@v2
name: Gradle Cache
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}

distribution: 'corretto'
cache: 'gradle'
- name: Install deps and setup environment
run: |
npm install -g diff2html-cli@${{ env.DIFF2HTML_VERSION }}
Expand Down
118 changes: 57 additions & 61 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,79 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches:
- main
- 'feat-*'
workflow_dispatch:

# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
concurrency:
group: ci-pr-${{ github.ref }}
cancel-in-progress: true

env:
BUILDER_VERSION: v0.8.22
BUILDER_SOURCE: releases
# host owned by CRT team to host aws-crt-builder releases. Contact their on-call with any issues
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-sdk-kotlin
RUN: ${{ github.run_id }}-${{ github.run_number }}
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dkotlin.incremental=false"

jobs:
linux-compat:
jvm:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# we build with a specific JDK version but source/target compatibility should ensure the jar is usable by
# the target versions we want to support
java-version:
- 8
- 11
- 17
- 21
steps:
- name: Checkout sources
uses: actions/checkout@v2
- uses: actions/cache@v2
uses: actions/checkout@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build and Test ${{ env.PACKAGE_NAME }}
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
chmod a+x builder.pyz
echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
./builder.pyz build -p ${{ env.PACKAGE_NAME }}

macos-compat:
runs-on: macos-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build and Test ${{ env.PACKAGE_NAME }}
path: 'aws-sdk-kotlin'
- name: Setup Build
uses: ./aws-sdk-kotlin/.github/actions/setup-build
- name: Test
working-directory: ./aws-sdk-kotlin
shell: bash
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
chmod a+x builder.pyz
echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
./builder.pyz build -p ${{ env.PACKAGE_NAME }}
pwd
ls -lsa
./gradlew -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace

windows-compat:
runs-on: windows-2019
all-platforms:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-2019 ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: I notice that the smithy-kotlin PR uses windows-latest while this explicitly uses windows-2019 (which is not the latest). Should it be upgraded to windows-latest too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall why this one is set to 2019, I can try windows-latest though and see what shakes out.

steps:
- name: Checkout sources
uses: actions/checkout@v2
- uses: actions/setup-java@v2
uses: actions/checkout@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- name: Modify Gradle Daemon JVM Args
# windows job runs out of memory with the defaults normally used
path: 'aws-sdk-kotlin'
- name: Setup Build
uses: ./aws-sdk-kotlin/.github/actions/setup-build
- name: Build smithy-kotlin
working-directory: ./smithy-kotlin
shell: bash
run: |
systeminfo
sed -i 's/org\.gradle\.jvmargs=.*$/org.gradle.jvmargs=-Xmx2g/' gradle.properties
echo "org.gradle.parallel=false" >> gradle.properties
cat gradle.properties
- name: Build and Test ${{ env.PACKAGE_NAME }}
# protocol tests require everything is published
pwd
./gradlew --parallel assemble
./gradlew publishToMavenLocal
- name: Test
working-directory: ./aws-sdk-kotlin
shell: bash
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
java -version
python3 builder.pyz build -p ${{ env.PACKAGE_NAME }}
pwd
./gradlew publishToMavenLocal
./gradlew apiCheck
./gradlew test allTests
./gradlew testAllProtocols
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-reports
path: '**/build/reports'
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Lint ${{ env.PACKAGE_NAME }}
run: |
./gradlew ktlint
38 changes: 38 additions & 0 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release Checks

on:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ main ]

# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
concurrency:
group: ci-release-check-${{ github.ref }}
cancel-in-progress: true

jobs:
release-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
cache: 'gradle'
- name: Check for snapshot versions
run: |
# We aren't releasable if we (1) directly depend on a snapshot version of a dependency OR (2) can't build the project without unreleased changes
if grep -q -i snapshot ./gradle/libs.versions.toml; then
echo "::error ::found snapshot version in libs.versions.toml"
exit 1
fi
- name: Build check
run: |
# Our CI is implemented as a "live at HEAD" model where we build against the latest of all our 1P deps (either
# main branch or matching branch name). Double check that without this "live at HEAD" mode we still build
# successfully (which is how it is built during release).
# This should help prevent the cases where we forgot to bump smithy-kotlin versions and don't catch it
# because CI is masking it
./gradlew test jvmTest
6 changes: 6 additions & 0 deletions aws-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ subprojects {
dependencies {
dokkaPlugin(project(":dokka-aws"))
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
}
}
}

apiValidation {
Expand Down
28 changes: 18 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ plugins {
// configures (KMP) subprojects with our own KMP conventions and some default dependencies
apply(plugin = "aws.sdk.kotlin.kmp")

allprojects {
repositories {
mavenLocal()
mavenCentral()
}
val testJavaVersion = typedProp<String>("test.java.version")?.let {
JavaLanguageVersion.of(it)
}?.also {
println("configuring tests to run with jdk $it")
}

allprojects {
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().configureEach {
val sdkVersion: String by project
moduleVersion.set(sdkVersion)
Expand All @@ -58,9 +59,7 @@ allprojects {
)
pluginsMapConfiguration.set(pluginConfigMap)
}
}

subprojects {
tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
// each module can include their own top-level module documentation
// see https://kotlinlang.org/docs/kotlin-doc.html#module-and-package-documentation
Expand Down Expand Up @@ -88,14 +87,23 @@ subprojects {
}
}
}
}

if (project.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
subprojects {
if (rootProject.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.allWarningsAsErrors = true
}
}

if (testJavaVersion != null) {
tasks.withType<Test> {
val toolchains = project.extensions.getByType<JavaToolchainService>()
javaLauncher.set(
toolchains.launcherFor {
languageVersion.set(testJavaVersion)
},
)
}
}
}

project.afterEvaluate {
Expand Down
Loading
Loading