|
1 | 1 | name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [ main ] |
6 | 4 | pull_request: |
7 | | - branches: |
8 | | - - main |
9 | | - - 'feat-*' |
10 | 5 | workflow_dispatch: |
11 | 6 |
|
| 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 | + |
12 | 12 | 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 |
18 | 13 | RUN: ${{ github.run_id }}-${{ github.run_number }} |
| 14 | + GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dkotlin.incremental=false" |
19 | 15 |
|
20 | 16 | jobs: |
21 | | - linux-compat: |
| 17 | + jvm: |
22 | 18 | 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 |
23 | 29 | steps: |
24 | 30 | - name: Checkout sources |
25 | | - uses: actions/checkout@v2 |
26 | | - - uses: actions/cache@v2 |
| 31 | + uses: actions/checkout@v4 |
27 | 32 | 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 |
55 | 39 | 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 |
60 | 43 |
|
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 ] |
63 | 50 | steps: |
64 | 51 | - name: Checkout sources |
65 | | - uses: actions/checkout@v2 |
66 | | - - uses: actions/setup-java@v2 |
| 52 | + uses: actions/checkout@v4 |
67 | 53 | 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 |
73 | 59 | shell: bash |
74 | 60 | 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 |
80 | 68 | 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' |
0 commit comments