-
Notifications
You must be signed in to change notification settings - Fork 28
192 lines (166 loc) · 6.3 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: CI
on:
push:
branches: [ main ]
pull_request:
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:
RUN: ${{ github.run_id }}-${{ github.run_number }}
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dkotlin.incremental=false"
jobs:
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@v4
with:
path: 'smithy-kotlin'
- name: Setup build
uses: ./smithy-kotlin/.github/actions/setup-build
- name: Build and Test on JVM
working-directory: ./smithy-kotlin
shell: bash
run: |
./gradlew -Paws.kotlin.native=false -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace
# macos-14 build and test for targets: jvm, macoArm64, iosSimulatorArm64, watchosSimulatorArm65, tvosSimulatorArm64
# macos-13 build and test for targets: jvm, macoX64, iosX64, tvosX64, watchosX64
macos:
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-13]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
path: 'smithy-kotlin'
- name: Setup build
uses: ./smithy-kotlin/.github/actions/setup-build
- name: Build and Test on Apple platforms
working-directory: ./smithy-kotlin
shell: bash
run: |
# FIXME K2. Re-enable warnings as errors after this warning is removed: https://youtrack.jetbrains.com/issue/KT-68532
# echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
./gradlew apiCheck
./gradlew -Paws.sdk.kotlin.crt.disableCrossCompile=true build
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-reports-${{ matrix.os }}
path: '**/build/reports'
# build and test for targets: jvm, linuxX64
# cross compile for: linuxX64, linuxArm64
# TODO - add mingw as cross compile target
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
path: 'smithy-kotlin'
- name: Setup build
uses: ./smithy-kotlin/.github/actions/setup-build
- name: Configure CRT Docker Images
run: |
./aws-crt-kotlin/docker-images/build-all.sh
- name: Build and Test on Linux with Cross-Compile
working-directory: ./smithy-kotlin
shell: bash
run: |
# FIXME K2. Re-enable warnings as errors after this warning is removed: https://youtrack.jetbrains.com/issue/KT-68532
# echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
./gradlew apiCheck
./gradlew build
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-reports-${{ matrix.os }}
path: '**/build/reports'
# windows JVM
windows:
runs-on: windows-2022
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
path: 'smithy-kotlin'
- name: Setup build
uses: ./smithy-kotlin/.github/actions/setup-build
- name: Build and Test on Windows JVM
working-directory: ./smithy-kotlin
run: |
./gradlew apiCheck
./gradlew -P"aws.sdk.kotlin.crt.disableCrossCompile"=true build
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-windows
path: '**/build/reports'
protocol-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
path: 'smithy-kotlin'
- name: Setup build
uses: ./smithy-kotlin/.github/actions/setup-build
- name: Test
working-directory: ./smithy-kotlin
shell: bash
run: |
./gradlew -Paws.kotlin.native=false publishToMavenLocal
./gradlew -Paws.kotlin.native=false testAllProtocols
downstream:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
path: 'smithy-kotlin'
- name: Setup build
uses: ./smithy-kotlin/.github/actions/setup-build
- name: Checkout aws-sdk-kotlin
uses: ./aws-kotlin-repo-tools/.github/actions/checkout-head
with:
# smithy-kotlin is checked out as a sibling dir which will automatically make it an included build
path: 'aws-sdk-kotlin'
repository: 'awslabs/aws-sdk-kotlin'
- name: Build and Test aws-sdk-kotlin downstream
working-directory: ./smithy-kotlin
run: |
# TODO - JVM only
cd $GITHUB_WORKSPACE/smithy-kotlin
./gradlew --parallel -Paws.kotlin.native=false publishToMavenLocal
SMITHY_KOTLIN_RUNTIME_VERSION=$(grep sdkVersion= gradle.properties | cut -d = -f 2)
SMITHY_KOTLIN_CODEGEN_VERSION=$(grep codegenVersion= gradle.properties | cut -d = -f 2)
cd $GITHUB_WORKSPACE/aws-sdk-kotlin
# replace smithy-kotlin-runtime-version and smithy-kotlin-codegen-version to be
# whatever we are testing such that the protocol test projects don't fail with a
# version that doesn't exist locally or in maven central. Otherwise the generated
# protocol test projects will use whatever the SDK thinks the version of
# smithy-kotlin should be
sed -i "s/smithy-kotlin-runtime-version = .*$/smithy-kotlin-runtime-version = \"$SMITHY_KOTLIN_RUNTIME_VERSION\"/" gradle/libs.versions.toml
sed -i "s/smithy-kotlin-codegen-version = .*$/smithy-kotlin-codegen-version = \"$SMITHY_KOTLIN_CODEGEN_VERSION\"/" gradle/libs.versions.toml
./gradlew --parallel -Paws.kotlin.native=false publishToMavenLocal
./gradlew -Paws.kotlin.native=false test jvmTest
./gradlew -Paws.kotlin.native=false testAllProtocols