Skip to content

Commit 7b3e9b5

Browse files
authored
misc: publish using Sonatype APIs directly and Revert "revert "kn: merge to main (#1423)" (#1431)" (#1432)
1 parent d845a3c commit 7b3e9b5

File tree

169 files changed

+2600
-1073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+2600
-1073
lines changed

.brazil.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"aws.sdk.kotlin.crt:aws-crt-kotlin:0.9.*": "AwsCrtKotlin-0.9.x",
1515
"aws.sdk.kotlin.crt:aws-crt-kotlin:0.8.*": "AwsCrtKotlin-0.8.x",
1616
"com.squareup.okhttp3:okhttp:4.*": "OkHttp3-4.x",
17+
"org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.*": "KotlinxDatetimeJvm-0.x",
1718

1819
"software.amazon.smithy:smithy-aws-traits:1.*": "Maven-software-amazon-smithy_smithy-aws-traits-1.x",
1920
"software.amazon.smithy:smithy-aws-iam-traits:1.*": "Maven-software-amazon-smithy_smithy-aws-iam-traits-1.x",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "7ced011b-d955-4559-9a21-848a19a36a4e",
3+
"type": "feature",
4+
"description": "Add support for Kotlin/Native",
5+
"issues": [
6+
"https://github.com/aws/aws-sdk-kotlin/issues/229"
7+
]
8+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Setup Build
2+
description: >
3+
Checkout repositories and build dependencies
4+
5+
runs:
6+
using: composite
7+
steps:
8+
- name: Extract aws-kotlin-repo-tools version
9+
working-directory: ./smithy-kotlin
10+
shell: bash
11+
run: |
12+
export AWS_KOTLIN_REPO_TOOLS_VERSION=$(grep '^aws-kotlin-repo-tools-version' ./gradle/libs.versions.toml | sed -E 's/.*= "(.*)"/\1/')
13+
echo "Using aws-kotlin-repo-tools version $AWS_KOTLIN_REPO_TOOLS_VERSION"
14+
echo "aws_kotlin_repo_tools_version=$AWS_KOTLIN_REPO_TOOLS_VERSION" >> $GITHUB_ENV
15+
16+
- name: Checkout aws-kotlin-repo-tools
17+
uses: actions/checkout@v4
18+
with:
19+
path: 'aws-kotlin-repo-tools'
20+
repository: 'aws/aws-kotlin-repo-tools'
21+
ref: ${{ env.aws_kotlin_repo_tools_version }}
22+
sparse-checkout: |
23+
.github
24+
25+
- name: Checkout aws-crt-kotlin
26+
uses: ./aws-kotlin-repo-tools/.github/actions/checkout-head
27+
with:
28+
# checkout aws-crt-kotlin as a sibling which will automatically make it an included build
29+
path: 'aws-crt-kotlin'
30+
repository: 'aws/aws-crt-kotlin'
31+
submodules: 'true'
32+
33+
# Cache the Kotlin/Native toolchain based on the input Kotlin version from version catalog
34+
# see https://kotlinlang.org/docs/native-improving-compilation-time.html
35+
- name: Cache Kotlin Native toolchain
36+
uses: actions/cache@v4
37+
with:
38+
path: |
39+
~/.konan
40+
key: ${{ runner.os }}-konan-${{ hashFiles('gradle/libs.versions.toml') }}
41+
restore-keys: |
42+
${{ runner.os }}-konan-
43+
44+
- name: Configure JDK
45+
uses: actions/setup-java@v3
46+
with:
47+
distribution: 'corretto'
48+
java-version: 17
49+
cache: 'gradle'
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
"""
7+
Run precompiled Kotlin/Native test binaries in a Docker container for a specific Linux distribution and architecture.
8+
9+
This requires Docker multiarch support, see https://docs.docker.com/build/building/multi-platform/ and https://github.com/multiarch/qemu-user-static
10+
In GitHub we use a provided action for this: https://github.com/docker/setup-qemu-action
11+
12+
Locally you would need to run one of:
13+
14+
`docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes`
15+
16+
OR
17+
18+
`docker run --privileged --rm tonistiigi/binfmt --install all`
19+
"""
20+
21+
import argparse
22+
import os
23+
import subprocess
24+
import shlex
25+
import shutil
26+
27+
VERBOSE = False
28+
29+
DISTRO_TO_IMAGE_NAME = {
30+
"ubuntu-22.04": "public.ecr.aws/lts/ubuntu:22.04_stable",
31+
"al2023": "public.ecr.aws/amazonlinux/amazonlinux:2023",
32+
"al2": "public.ecr.aws/amazonlinux/amazonlinux:2"
33+
}
34+
35+
DOCKER_PLATFORM_BY_ARCH = {
36+
"x64": "linux/amd64",
37+
"arm64": "linux/arm64"
38+
}
39+
40+
41+
def vprint(message):
42+
global VERBOSE
43+
if VERBOSE:
44+
print(message)
45+
46+
47+
def running_in_github_action():
48+
"""
49+
Test if currently running in a GitHub action or running locally
50+
:return: True if running in GH, False otherwise
51+
"""
52+
return "GITHUB_WORKFLOW" in os.environ
53+
54+
55+
def shell(command, cwd=None, check=True, capture_output=False):
56+
"""
57+
Run a command
58+
:param command: command to run
59+
:param cwd: the current working directory to change to before executing the command
60+
:param check: flag indicating if the status code should be checked. When true an exception will be
61+
thrown if the command exits with a non-zero exit status.
62+
:returns: the subprocess CompletedProcess output
63+
"""
64+
vprint(f"running `{command}`")
65+
return subprocess.run(command, shell=True, check=check, cwd=cwd, capture_output=capture_output)
66+
67+
68+
def oci_executable():
69+
"""
70+
Attempt to find the OCI container executor used to build and run docker containers
71+
"""
72+
oci_exe = os.environ.get('OCI_EXE')
73+
if oci_exe is not None:
74+
return oci_exe
75+
76+
executors = ['finch', 'podman', 'docker']
77+
78+
for exe in executors:
79+
if shutil.which(exe) is not None:
80+
return exe
81+
82+
print("cannot find container executor")
83+
exit(1)
84+
85+
86+
def run_docker_test(opts):
87+
"""
88+
Run a docker test for a precompiled Kotlin/Native binary
89+
90+
:param opts: the parsed command line options
91+
"""
92+
platform = DOCKER_PLATFORM_BY_ARCH[opts.arch]
93+
oci_exe = oci_executable()
94+
95+
test_bin_dir = os.path.abspath(opts.test_bin_dir)
96+
image_name = DISTRO_TO_IMAGE_NAME[opts.distro]
97+
path_to_exe = f'./linux{opts.arch.capitalize()}/debugTest/test.kexe'
98+
99+
cmd = [
100+
oci_exe,
101+
'run',
102+
'--rm',
103+
f'-v{test_bin_dir}:/test',
104+
]
105+
if not opts.no_system_certs:
106+
cmd.append(f'-v/etc/ssl:/etc/ssl')
107+
108+
cmd.extend(
109+
[
110+
'-w/test',
111+
'-e DEBIAN_FRONTEND=noninteractive',
112+
'--platform',
113+
platform,
114+
image_name,
115+
path_to_exe,
116+
]
117+
)
118+
119+
cmd = shlex.join(cmd)
120+
print(cmd)
121+
shell(cmd)
122+
123+
124+
def create_cli():
125+
parser = argparse.ArgumentParser(
126+
prog="run-container-test",
127+
description="Run cross platform test binaries in a container",
128+
formatter_class=argparse.ArgumentDefaultsHelpFormatter
129+
)
130+
131+
parser.add_argument("-v", "--verbose", help="enable verbose output", action="store_true")
132+
133+
parser.add_argument("--distro", required=True, choices=DISTRO_TO_IMAGE_NAME.keys(), help="the distribution name to run the task on")
134+
parser.add_argument("--arch", required=True, choices=DOCKER_PLATFORM_BY_ARCH.keys(), help="the architecture to use")
135+
parser.add_argument("--test-bin-dir", required=True, help="the path to the test binary directory root")
136+
parser.add_argument("--no-system-certs", action='store_true', help="disable mounting system certificates into the container")
137+
138+
return parser
139+
140+
141+
def main():
142+
cli = create_cli()
143+
opts = cli.parse_args()
144+
if opts.verbose:
145+
global VERBOSE
146+
VERBOSE = True
147+
148+
run_docker_test(opts)
149+
150+
151+
if __name__ == '__main__':
152+
main()

.github/workflows/artifact-size-metrics.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,43 @@ jobs:
4444
steps:
4545
- name: Checkout Sources
4646
uses: actions/checkout@v4
47-
- name: Configure JDK
48-
uses: actions/setup-java@v3
4947
with:
50-
distribution: 'corretto'
51-
java-version: 17
52-
cache: 'gradle'
48+
path: smithy-kotlin
49+
50+
- name: Setup build
51+
uses: ./smithy-kotlin/.github/actions/setup-build
52+
5353
- name: Configure AWS Credentials
5454
uses: aws-actions/configure-aws-credentials@v4
5555
with:
5656
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
5757
aws-region: us-west-2
58+
5859
- name: Configure Gradle
5960
uses: aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
61+
with:
62+
working-directory: smithy-kotlin
63+
6064
- name: Generate Artifact Size Metrics
61-
run: ./gradlew artifactSizeMetrics
65+
run: ./gradlew -Paws.kotlin.native=false artifactSizeMetrics
66+
working-directory: smithy-kotlin
67+
6268
- name: Analyze Artifact Size Metrics
6369
run: ./gradlew analyzeArtifactSizeMetrics
70+
working-directory: smithy-kotlin
6471

6572
- name: Show Results
6673
uses: aws/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/show-results@main
74+
with:
75+
working-directory: smithy-kotlin
6776

6877
- name: Evaluate
6978
if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-artifact-size-increase') }}
79+
working-directory: smithy-kotlin
7080
run: |
7181
cd build/reports/metrics
7282
cat has-significant-change.txt | grep false || {
7383
echo An artifact increased in size by more than allowed or a new artifact was created.
7484
echo If this is expected please add the 'acknowledge-artifact-size-increase' label to this pull request.
7585
exit 1
76-
}
86+
}

.github/workflows/changelog-verification.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
aws-region: us-west-2
2323

2424
- name: Verify changelog
25-
uses: aws/aws-kotlin-repo-tools/.github/actions/changelog-verification@main
25+
uses: aws/aws-kotlin-repo-tools/.github/actions/changelog-verification@main

0 commit comments

Comments
 (0)