Skip to content

Commit 3d1d564

Browse files
authored
chore: add release checks (#1069)
1 parent 087783c commit 3d1d564

File tree

13 files changed

+195
-94
lines changed

13 files changed

+195
-94
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Setup Build
2+
description: >
3+
Checkout repositories and build dependencies
4+
5+
runs:
6+
using: composite
7+
steps:
8+
- name: Checkout tools
9+
uses: actions/checkout@v4
10+
with:
11+
path: 'aws-kotlin-repo-tools'
12+
repository: 'awslabs/aws-kotlin-repo-tools'
13+
ref: '0.2.3'
14+
sparse-checkout: |
15+
.github
16+
- name: Checkout smithy-kotlin
17+
uses: ./aws-kotlin-repo-tools/.github/actions/checkout-head
18+
with:
19+
# checkout smithy-kotlin as a sibling which will automatically make it an included build
20+
path: 'smithy-kotlin'
21+
repository: 'awslabs/smithy-kotlin'
22+
- name: Configure JDK
23+
uses: actions/setup-java@v3
24+
with:
25+
distribution: 'corretto'
26+
java-version: 17
27+
cache: 'gradle'

.github/scripts/run-codebuild-batch-job.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ fi
3030

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

3435
BUILD_STATUS="IN_PROGRESS"
3536
while [ "$BUILD_STATUS" == "IN_PROGRESS" ]; do

.github/workflows/changelog-verification.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
changelog-verification:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
- name: Check for changelog entry
1414
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
1515
run: |

.github/workflows/codebuild-ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ permissions:
1010
id-token: write
1111
contents: read
1212

13+
# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
14+
concurrency:
15+
group: ci-codebuild-${{ github.ref }}
16+
cancel-in-progress: true
17+
1318
jobs:
1419
e2e-tests:
1520
runs-on: ubuntu-latest
@@ -20,9 +25,19 @@ jobs:
2025
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
2126
aws-region: us-west-2
2227
- name: Run E2E Tests
28+
id: e2e-tests
2329
uses: aws-actions/aws-codebuild-run-build@v1
2430
with:
2531
project-name: gh-aws-sdk-kotlin-e2e-tests
32+
- name: Cancel build
33+
if: ${{ cancelled() }}
34+
env:
35+
BUILD_ID: ${{ steps.e2e-tests.outputs.aws-build-id }}
36+
run: |
37+
if [ ! -z "$BUILD_ID"]; then
38+
echo "cancelling in-progress build: id=$BUILD_ID"
39+
aws codebuild stop-build --id $BUILD_ID
40+
fi
2641
2742
service-check-batch:
2843
runs-on: ubuntu-latest
@@ -35,5 +50,15 @@ jobs:
3550
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
3651
aws-region: us-west-2
3752
- name: Run Service Check Batch
53+
id: svc-check-batch
3854
run: |
3955
.github/scripts/run-codebuild-batch-job.sh gh-aws-sdk-kotlin-svc-check-batch ${{ github.event.pull_request.head.sha }}
56+
- name: Cancel build
57+
if: ${{ cancelled() }}
58+
env:
59+
BUILD_ID: ${{ steps.svc-check-batch.outputs.aws-build-id }}
60+
run: |
61+
if [ ! -z "$BUILD_ID" ]; then
62+
echo "cancelling in-progress batch build: id=$BUILD_ID"
63+
aws codebuild stop-build --id $BUILD_ID
64+
fi

.github/workflows/codegen-preview.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency:
1919
cancel-in-progress: true
2020

2121
env:
22-
JAVA_VERSION: 11
22+
JAVA_VERSION: 17
2323
RUN: ${{ github.run_id }}-${{ github.run_number }}
2424
DIFF2HTML_VERSION: 5.2.5
2525
# Below is the set of services that are generated for codegen preview
@@ -49,27 +49,18 @@ jobs:
4949
- uses: actions/checkout@v4
5050
with:
5151
repository: 'awslabs/aws-kotlin-repo-tools'
52-
ref: 'ci-utils'
5352
path: 'aws-kotlin-repo-tools'
5453
- uses: actions/checkout@v4
5554
with:
5655
repository: 'awslabs/smithy-kotlin'
5756
fetch-depth: 0
5857
path: 'smithy-kotlin'
59-
- uses: actions/cache@v2
60-
name: Gradle Cache
61-
with:
62-
path: |
63-
~/.gradle/caches
64-
~/.gradle/wrapper
65-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
66-
restore-keys: |
67-
${{ runner.os }}-gradle-
6858
- name: Set up JDK
69-
uses: actions/setup-java@v1
59+
uses: actions/setup-java@v3
7060
with:
7161
java-version: ${{ env.JAVA_VERSION }}
72-
62+
distribution: 'corretto'
63+
cache: 'gradle'
7364
- name: Install deps and setup environment
7465
run: |
7566
npm install -g diff2html-cli@${{ env.DIFF2HTML_VERSION }}
Lines changed: 57 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,79 @@
11
name: CI
22

33
on:
4-
push:
5-
branches: [ main ]
64
pull_request:
7-
branches:
8-
- main
9-
- 'feat-*'
105
workflow_dispatch:
116

7+
# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
8+
concurrency:
9+
group: ci-pr-${{ github.ref }}
10+
cancel-in-progress: true
11+
1212
env:
13-
BUILDER_VERSION: v0.8.22
14-
BUILDER_SOURCE: releases
15-
# host owned by CRT team to host aws-crt-builder releases. Contact their on-call with any issues
16-
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
17-
PACKAGE_NAME: aws-sdk-kotlin
1813
RUN: ${{ github.run_id }}-${{ github.run_number }}
14+
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dkotlin.incremental=false"
1915

2016
jobs:
21-
linux-compat:
17+
jvm:
2218
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
# we build with a specific JDK version but source/target compatibility should ensure the jar is usable by
23+
# the target versions we want to support
24+
java-version:
25+
- 8
26+
- 11
27+
- 17
28+
- 21
2329
steps:
2430
- name: Checkout sources
25-
uses: actions/checkout@v2
26-
- uses: actions/cache@v2
31+
uses: actions/checkout@v4
2732
with:
28-
path: |
29-
~/.gradle/caches
30-
~/.gradle/wrapper
31-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
32-
restore-keys: |
33-
${{ runner.os }}-gradle-
34-
- name: Build and Test ${{ env.PACKAGE_NAME }}
35-
run: |
36-
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
37-
chmod a+x builder.pyz
38-
echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
39-
./builder.pyz build -p ${{ env.PACKAGE_NAME }}
40-
41-
macos-compat:
42-
runs-on: macos-latest
43-
steps:
44-
- name: Checkout sources
45-
uses: actions/checkout@v2
46-
- uses: actions/cache@v2
47-
with:
48-
path: |
49-
~/.gradle/caches
50-
~/.gradle/wrapper
51-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
52-
restore-keys: |
53-
${{ runner.os }}-gradle-
54-
- name: Build and Test ${{ env.PACKAGE_NAME }}
33+
path: 'aws-sdk-kotlin'
34+
- name: Setup Build
35+
uses: ./aws-sdk-kotlin/.github/actions/setup-build
36+
- name: Test
37+
working-directory: ./aws-sdk-kotlin
38+
shell: bash
5539
run: |
56-
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
57-
chmod a+x builder.pyz
58-
echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
59-
./builder.pyz build -p ${{ env.PACKAGE_NAME }}
40+
pwd
41+
ls -lsa
42+
./gradlew -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace
6043
61-
windows-compat:
62-
runs-on: windows-2019
44+
all-platforms:
45+
runs-on: ${{ matrix.os }}
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
os: [ ubuntu-latest, macos-latest, windows-latest ]
6350
steps:
6451
- name: Checkout sources
65-
uses: actions/checkout@v2
66-
- uses: actions/setup-java@v2
52+
uses: actions/checkout@v4
6753
with:
68-
distribution: 'temurin'
69-
java-version: '11'
70-
cache: 'gradle'
71-
- name: Modify Gradle Daemon JVM Args
72-
# windows job runs out of memory with the defaults normally used
54+
path: 'aws-sdk-kotlin'
55+
- name: Setup Build
56+
uses: ./aws-sdk-kotlin/.github/actions/setup-build
57+
- name: Build smithy-kotlin
58+
working-directory: ./smithy-kotlin
7359
shell: bash
7460
run: |
75-
systeminfo
76-
sed -i 's/org\.gradle\.jvmargs=.*$/org.gradle.jvmargs=-Xmx2g/' gradle.properties
77-
echo "org.gradle.parallel=false" >> gradle.properties
78-
cat gradle.properties
79-
- name: Build and Test ${{ env.PACKAGE_NAME }}
61+
# protocol tests require everything is published
62+
pwd
63+
./gradlew --parallel assemble
64+
./gradlew publishToMavenLocal
65+
- name: Test
66+
working-directory: ./aws-sdk-kotlin
67+
shell: bash
8068
run: |
81-
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
82-
java -version
83-
python3 builder.pyz build -p ${{ env.PACKAGE_NAME }}
69+
pwd
70+
./gradlew publishToMavenLocal
71+
./gradlew apiCheck
72+
./gradlew test allTests
73+
./gradlew testAllProtocols
74+
- name: Save Test Reports
75+
if: failure()
76+
uses: actions/upload-artifact@v3
77+
with:
78+
name: test-reports
79+
path: '**/build/reports'

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout sources
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
2121
- name: Lint ${{ env.PACKAGE_NAME }}
2222
run: |
2323
./gradlew ktlint
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release Checks
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened ]
6+
branches: [ main ]
7+
8+
# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
9+
concurrency:
10+
group: ci-release-check-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
release-check:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Configure JDK
19+
uses: actions/setup-java@v3
20+
with:
21+
distribution: 'corretto'
22+
java-version: 17
23+
cache: 'gradle'
24+
- name: Check for snapshot versions
25+
run: |
26+
# 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
27+
if grep -q -i snapshot ./gradle/libs.versions.toml; then
28+
echo "::error ::found snapshot version in libs.versions.toml"
29+
exit 1
30+
fi
31+
- name: Build check
32+
run: |
33+
# Our CI is implemented as a "live at HEAD" model where we build against the latest of all our 1P deps (either
34+
# main branch or matching branch name). Double check that without this "live at HEAD" mode we still build
35+
# successfully (which is how it is built during release).
36+
# This should help prevent the cases where we forgot to bump smithy-kotlin versions and don't catch it
37+
# because CI is masking it
38+
./gradlew test jvmTest

aws-runtime/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ subprojects {
6262
dependencies {
6363
dokkaPlugin(project(":dokka-aws"))
6464
}
65+
66+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
67+
kotlinOptions {
68+
jvmTarget = "1.8"
69+
}
70+
}
6571
}
6672

6773
apiValidation {

build.gradle.kts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ plugins {
2828
// configures (KMP) subprojects with our own KMP conventions and some default dependencies
2929
apply(plugin = "aws.sdk.kotlin.kmp")
3030

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

37+
allprojects {
3738
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().configureEach {
3839
val sdkVersion: String by project
3940
moduleVersion.set(sdkVersion)
@@ -58,9 +59,7 @@ allprojects {
5859
)
5960
pluginsMapConfiguration.set(pluginConfigMap)
6061
}
61-
}
6262

63-
subprojects {
6463
tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
6564
// each module can include their own top-level module documentation
6665
// see https://kotlinlang.org/docs/kotlin-doc.html#module-and-package-documentation
@@ -88,14 +87,23 @@ subprojects {
8887
}
8988
}
9089
}
91-
}
9290

93-
if (project.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
94-
subprojects {
91+
if (rootProject.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
9592
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
9693
kotlinOptions.allWarningsAsErrors = true
9794
}
9895
}
96+
97+
if (testJavaVersion != null) {
98+
tasks.withType<Test> {
99+
val toolchains = project.extensions.getByType<JavaToolchainService>()
100+
javaLauncher.set(
101+
toolchains.launcherFor {
102+
languageVersion.set(testJavaVersion)
103+
},
104+
)
105+
}
106+
}
99107
}
100108

101109
project.afterEvaluate {

0 commit comments

Comments
 (0)