-
Notifications
You must be signed in to change notification settings - Fork 55
ci: build all AWS services for PRs to main #190
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
Changes from all commits
1c9498b
e26708c
92cbc11
fdf1c76
24416f4
06c147e
990321f
2c40766
1f73bab
b32b56e
9d6cefd
323f564
d435bd1
5229b08
dc61f33
efba459
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/usr/bin/env python3 | ||
| """ | ||
| Converts a list of model file paths to a formatted includes list for passing to bootstrap | ||
| """ | ||
| import sys | ||
| import os | ||
|
|
||
| not_supported_yet = ["ec2", "location", "elasticbeanstalk", "marketplacecommerceanalytics"] | ||
|
|
||
|
|
||
| def main(): | ||
| lines = sys.stdin.readlines() | ||
| services = [os.path.basename(x).split(".")[0] for x in lines] | ||
| services = ["+" + x for x in services if x not in not_supported_yet] | ||
| sys.stdout.write(",".join(services)) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,10 +5,13 @@ on: | |
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths-ignore: | ||
| - 'docs/**' | ||
| - '*.md' | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| BUILDER_VERSION: v0.8.0 | ||
| BUILDER_VERSION: v0.8.19 | ||
| 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 | ||
|
|
@@ -21,21 +24,29 @@ jobs: | |
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v2 | ||
| - uses: actions/cache@v2 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
| - name: Build and Test ${{ env.PACKAGE_NAME }} | ||
| env: | ||
| CI_USER: ${{ secrets.CI_USER}} | ||
| CI_ACCESS_TOKEN: ${{ secrets.CI_ACCESS_TOKEN }} | ||
| run: | | ||
| echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin | ||
| export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-ubuntu-16-x64:${{ env.BUILDER_VERSION }} | ||
| docker pull $DOCKER_IMAGE | ||
| docker run --mount type=bind,source=$(pwd),target=/root/${{ env.PACKAGE_NAME }} \ | ||
| --env GITHUB_REF \ | ||
| --env GITHUB_HEAD_REF \ | ||
| --env CI_USER \ | ||
| --env CI_ACCESS_TOKEN \ | ||
| --env GIT_ASKPASS=/root/${{ env.PACKAGE_NAME }}/.github/scripts/git-ci-askpass.sh \ | ||
| $DOCKER_IMAGE build -p ${{ env.PACKAGE_NAME }} --build-dir=/root/${{ env.PACKAGE_NAME }} | ||
| 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 | ||
| GIT_ASKPASS="$(pwd)/.github/scripts/git-ci-askpass.sh" ./builder.pyz build -p ${{ env.PACKAGE_NAME }} | ||
| - uses: actions/upload-artifact@v2 | ||
| # uploads local m2 so built runtime artifacts can be re-used | ||
| name: Upload Published Maven Artifacts | ||
| with: | ||
| name: m2-${{ env.name }}-${{ github.sha }} | ||
| path: ~/.m2 | ||
| retention-days: 2 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question why 2 days here? I assume this repo caching is particular to a given PR. Would this be for day boundries?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't really need the artifact past building the AWS services in parallel. 2 days seemed reasonable to me to debug and diagnose any build failures. |
||
|
|
||
| macos-compat: | ||
| runs-on: macos-latest | ||
|
|
@@ -47,7 +58,7 @@ jobs: | |
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
| - name: Build and Test ${{ env.PACKAGE_NAME }} | ||
|
|
@@ -58,3 +69,52 @@ jobs: | |
| 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 | ||
| GIT_ASKPASS="$(pwd)/.github/scripts/git-ci-askpass.sh" ./builder.pyz build -p ${{ env.PACKAGE_NAME }} | ||
|
|
||
| build-aws-services-batch: | ||
| name: Build AWS services parallel | ||
| runs-on: ubuntu-latest | ||
| continue-on-error: false | ||
| needs: linux-compat | ||
| strategy: | ||
| matrix: | ||
| # run jobs in parallel | ||
| JOB: [1,2,3,4,5,6,7,8,9,10,11,12] | ||
| env: | ||
| JOBS: 12 | ||
| JOB: ${{ matrix.JOB }} | ||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v2 | ||
| - uses: actions/cache@v2 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
| - uses: actions/download-artifact@v2 | ||
| name: Download Maven Artifacts | ||
| with: | ||
| name: m2-${{ env.name }}-${{ github.sha }} | ||
| path: ~/.m2 | ||
| - name: Generate SDKs | ||
| run: | | ||
| ls -lsa ~/.m2/repository | ||
| find codegen/sdk/aws-models -name '*.json' | sort | awk "NR % $JOBS == $JOB - 1" > services.txt | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question I take it this is what breaks the work up for each worker?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it splits the list of services into batches modulo the number of "jobs". |
||
| echo "Building the following services" | ||
| cat services.txt | ||
| ./gradlew --no-daemon :codegen:sdk:bootstrap -Paws.services=$(cat services.txt | .github/scripts/generate-includes.py) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Why is the generate-includes.py script necessary if we can specify which protocols/services not to build? Won't this be equivalent and simpler? ./gradlews -Paws.services=-location,-marketplacecommerceanalytics -Paws.protocols=-ec2Query :codegen:sdk:bootstrap
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is executed in batches. We only want to build |
||
| - name: Build AWS Services | ||
| run: | | ||
| ./gradlew --parallel build | ||
|
|
||
| build-aws-services: | ||
| if: ${{ always() }} | ||
| name: Build all AWS services | ||
| runs-on: ubuntu-latest | ||
| needs: build-aws-services-batch | ||
| steps: | ||
| - name: Check batch matrix status | ||
| if: ${{ needs.build-aws-services-batch.result != 'success' }} | ||
| run: exit 1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ Generated sources are not checked into the repository, you first have to generat | |
|
|
||
|
|
||
| ```sh | ||
| ./gradlew :codegen:sdk:bootstrap | ||
| ./gradlew --no-daemon :codegen:sdk:bootstrap | ||
| ``` | ||
|
Comment on lines
20
to
22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Why are we recommending
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should help prevent having to call |
||
|
|
||
| NOTE: This task will respect the AWS services specified by project properties. See options below. | ||
|
|
@@ -41,7 +41,7 @@ To see list of all projects run `./gradlew projects` | |
| See the local.properties definition above to specify this in a config file. | ||
|
|
||
| ```sh | ||
| ./gradlew -Paws.services=+lambda :codegen:sdk:bootstrap | ||
| ./gradlew --no-daemon -Paws.services=+lambda :codegen:sdk:bootstrap | ||
| ``` | ||
|
|
||
| ##### Testing Locally | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,8 @@ tasks["clean"].doFirst { | |
| delete("smithy-build.json") | ||
| } | ||
|
|
||
| tasks.create<SmithyBuild>("buildSdk") { | ||
| tasks.create<SmithyBuild>("generateSdk") { | ||
| group = "codegen" | ||
| // ensure the generated clients use the same version of the runtime as the aws aws-runtime | ||
| val smithyKotlinVersion: String by project | ||
| doFirst { | ||
|
|
@@ -70,13 +71,12 @@ tasks.create<SmithyBuild>("buildSdk") { | |
| addRuntimeClasspath = true | ||
| dependsOn(tasks["generateSmithyBuild"]) | ||
| inputs.file(projectDir.resolve("smithy-build.json")) | ||
| // ensure smithy-aws-kotlin-codegen is up to date | ||
| inputs.files(configurations.compileClasspath) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment very nice! I was trying to get these gradle configurations to work at one point but couldn't make it work. Well done!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to solve it but let me know if you see issues still. For me it seemed to rebuild appropriately now. However, I still have issues where I have to call |
||
| } | ||
|
|
||
| // Run the `buildSdk` automatically. | ||
| tasks["build"].finalizedBy(tasks["buildSdk"]) | ||
|
|
||
| // force rebuild every time while developing | ||
| tasks["buildSdk"].outputs.upToDateWhen { false } | ||
| tasks["generateSdk"].outputs.upToDateWhen { false } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice rename |
||
|
|
||
| data class ProtocolTest(val projectionName: String, val serviceShapeId: String) { | ||
| val packageName: String | ||
|
|
@@ -172,7 +172,7 @@ open class ProtocolTestTask : DefaultTask() { | |
|
|
||
| enabledProtocols.forEach { | ||
| tasks.register<ProtocolTestTask>("testProtocol-${it.projectionName}") { | ||
| dependsOn(tasks.build) | ||
| dependsOn(tasks["generateSdk"]) | ||
| group = "Verification" | ||
| protocol = it.projectionName | ||
| plugin = "kotlin-codegen" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,13 @@ | ||
| kotlin.code.style=official | ||
| kkotlin.incremental.js=true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correctness: |
||
| kotlin.incremental.multiplatform=true | ||
| kotlin.parallel.tasks.in.project=true | ||
| kotlin.mpp.stability.nowarn=true | ||
| kotlin.native.ignoreDisabledTargets=true | ||
|
|
||
| # gradle | ||
| # FIXME - see https://github.com/Kotlin/dokka/issues/1405 | ||
| org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1G | ||
| org.gradle.jvmargs=-Xmx6g -XX:MaxPermSize=6g -XX:MaxMetaspaceSize=1G | ||
|
|
||
| # sdk | ||
| sdkVersion=0.4.0-SNAPSHOT | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correctness: Elastic Beanstalk should be supported now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marketplacecommerceanalyticscan join the party as well.