|
4 | 4 | push: |
5 | 5 | branches: [ main ] |
6 | 6 | pull_request: |
7 | | - branches: |
8 | | - - main |
9 | | - - 'feat-*' |
10 | 7 | workflow_dispatch: |
11 | 8 |
|
| 9 | +# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed |
| 10 | +concurrency: |
| 11 | + group: ci-pr-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
12 | 14 | 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: smithy-kotlin |
18 | | - LINUX_BASE_IMAGE: ubuntu-16-x64 |
19 | 15 | RUN: ${{ github.run_id }}-${{ github.run_number }} |
| 16 | + GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dkotlin.incremental=false" |
20 | 17 |
|
21 | 18 | jobs: |
22 | | - linux-compat: |
| 19 | + jvm: |
23 | 20 | runs-on: ubuntu-latest |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + # we build with a specific JDK version but source/target compatibility should ensure the jar is usable by |
| 25 | + # the target versions we want to support |
| 26 | + java-version: |
| 27 | + - 8 |
| 28 | + - 11 |
| 29 | + - 17 |
| 30 | + - 21 |
24 | 31 | steps: |
25 | | - - name: Checkout sources |
26 | | - uses: actions/checkout@v2 |
27 | | - - uses: actions/cache@v2 |
28 | | - with: |
29 | | - path: | |
30 | | - ~/.gradle/caches |
31 | | - ~/.gradle/wrapper |
32 | | - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} |
33 | | - restore-keys: | |
34 | | - ${{ runner.os }}-gradle- |
35 | | - - name: Build and Test ${{ env.PACKAGE_NAME }} |
36 | | - run: | |
37 | | - python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" |
38 | | - chmod a+x builder.pyz |
39 | | - echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties |
40 | | - ./builder.pyz build -p ${{ env.PACKAGE_NAME }} |
41 | | -
|
42 | | - macos-compat: |
43 | | - runs-on: macos-latest |
44 | | - steps: |
45 | | - - name: Checkout sources |
46 | | - uses: actions/checkout@v2 |
47 | | - - uses: actions/cache@v2 |
48 | | - with: |
49 | | - path: | |
50 | | - ~/.gradle/caches |
51 | | - ~/.gradle/wrapper |
52 | | - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} |
53 | | - restore-keys: | |
54 | | - ${{ runner.os }}-gradle- |
55 | | - - name: Build and Test ${{ env.PACKAGE_NAME }} |
56 | | - run: | |
57 | | - python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" |
58 | | - chmod a+x builder.pyz |
59 | | - echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties |
60 | | - ./builder.pyz build -p ${{ env.PACKAGE_NAME }} |
| 32 | + - name: Checkout sources |
| 33 | + uses: actions/checkout@v4 |
| 34 | + - name: Configure JDK |
| 35 | + uses: actions/setup-java@v3 |
| 36 | + with: |
| 37 | + distribution: 'corretto' |
| 38 | + java-version: 17 |
| 39 | + cache: 'gradle' |
| 40 | + - name: Test |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + ./gradlew -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace |
61 | 44 |
|
62 | | - windows-compat: |
63 | | - runs-on: windows-latest |
| 45 | + all-platforms: |
| 46 | + runs-on: ${{ matrix.os }} |
| 47 | + strategy: |
| 48 | + fail-fast: false |
| 49 | + matrix: |
| 50 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
64 | 51 | steps: |
65 | 52 | - name: Checkout sources |
66 | | - uses: actions/checkout@v2 |
67 | | - - name: Build and Test ${{ env.PACKAGE_NAME }} |
| 53 | + uses: actions/checkout@v4 |
| 54 | + - name: Configure JDK |
| 55 | + uses: actions/setup-java@v3 |
| 56 | + with: |
| 57 | + distribution: 'corretto' |
| 58 | + java-version: 17 |
| 59 | + cache: 'gradle' |
| 60 | + - name: Test |
| 61 | + shell: bash |
68 | 62 | run: | |
69 | | - python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" |
70 | | - python3 builder.pyz build -p ${{ env.PACKAGE_NAME }} |
| 63 | + echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties |
| 64 | + ./gradlew apiCheck |
| 65 | + ./gradlew test allTests |
| 66 | + - name: Save Test Reports |
| 67 | + if: failure() |
| 68 | + uses: actions/upload-artifact@v3 |
| 69 | + with: |
| 70 | + name: test-reports |
| 71 | + path: '**/build/reports' |
71 | 72 |
|
72 | 73 | downstream: |
73 | 74 | runs-on: ubuntu-latest |
74 | 75 | steps: |
75 | 76 | - name: Checkout sources |
76 | | - uses: actions/checkout@v2 |
77 | | - - uses: actions/cache@v2 |
| 77 | + uses: actions/checkout@v4 |
| 78 | + with: |
| 79 | + path: 'smithy-kotlin' |
| 80 | + - name: Checkout tools |
| 81 | + uses: actions/checkout@v4 |
| 82 | + with: |
| 83 | + path: 'aws-kotlin-repo-tools' |
| 84 | + repository: 'awslabs/aws-kotlin-repo-tools' |
| 85 | + ref: '0.2.3' |
| 86 | + sparse-checkout: | |
| 87 | + .github |
| 88 | + - name: Checkout aws-sdk-kotlin |
| 89 | + uses: ./aws-kotlin-repo-tools/.github/actions/checkout-head |
| 90 | + with: |
| 91 | + # smithy-kotlin is checked out as a sibling dir which will automatically make it an included build |
| 92 | + path: 'aws-sdk-kotlin' |
| 93 | + repository: 'awslabs/aws-sdk-kotlin' |
| 94 | + - name: Configure JDK |
| 95 | + uses: actions/setup-java@v3 |
78 | 96 | with: |
79 | | - path: | |
80 | | - ~/.gradle/caches |
81 | | - ~/.gradle/wrapper |
82 | | - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} |
83 | | - restore-keys: | |
84 | | - ${{ runner.os }}-gradle- |
85 | | - - name: Build and Test ${{ env.PACKAGE_NAME }} Downstream Consumers |
| 97 | + distribution: 'corretto' |
| 98 | + java-version: 17 |
| 99 | + cache: 'gradle' |
| 100 | + - name: Build and Test aws-sdk-kotlin downstream |
86 | 101 | run: | |
87 | | - python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" |
88 | | - chmod a+x builder |
89 | | - echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties |
90 | | - ./builder build -p ${{ env.PACKAGE_NAME }} --spec downstream |
| 102 | + # TODO - JVM only |
| 103 | + cd $GITHUB_WORKSPACE/smithy-kotlin |
| 104 | + ./gradlew --parallel publishToMavenLocal |
| 105 | + cd $GITHUB_WORKSPACE/aws-sdk-kotlin |
| 106 | + ./gradlew --parallel publishToMavenLocal |
| 107 | + ./gradlew testAllProtocols |
0 commit comments