From 37eff7a2e1f3551e83db992e620fc7fb700b1046 Mon Sep 17 00:00:00 2001 From: Matas Date: Tue, 22 Oct 2024 12:18:28 -0400 Subject: [PATCH] feat: `kat` in CI (#117) --- .github/workflows/kat-transform.yml | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/kat-transform.yml diff --git a/.github/workflows/kat-transform.yml b/.github/workflows/kat-transform.yml new file mode 100644 index 0000000..d8589be --- /dev/null +++ b/.github/workflows/kat-transform.yml @@ -0,0 +1,70 @@ +name: Kat Transform + +on: + pull_request: + types: [ opened, synchronize, reopened, labeled, unlabeled ] + branches: [ main ] + +# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed +concurrency: + group: kat-pr-${{ github.ref }} + cancel-in-progress: true + +permissions: + id-token: write + contents: read + +env: + RUN: ${{ github.run_id }}-${{ github.run_number }} + GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dkotlin.incremental=false" + +jobs: + verify-transform: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + path: 'aws-crt-kotlin' + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} + aws-region: us-west-2 + + - name: Setup kat + uses: awslabs/aws-kotlin-repo-tools/.github/actions/setup-kat@main + + - name: Configure JDK + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: 17 + cache: 'gradle' + + - name: Build + working-directory: ./aws-crt-kotlin + shell: bash + run: | + pwd + ls -lsa + kat bump-version # Bump from `vNext-SNAPSHOT` to `vNext`. kat transform only works on non-SNAPSHOT versions + ./gradlew build + ./gradlew publishAllPublicationsToTestLocalRepository + + - name: Transform + working-directory: ./aws-crt-kotlin + shell: bash + run: | + pwd + ls -lsa + kat brazil transform -i ./build/m2 -o ./transformed -t .brazil.json -v live + + # Check for manifest file + if [ ! -f "./transformed/brazil-import-manifest.json" ]; then + echo "Error: brazil-import-manifest.json not found in the transformed artifact" + exit 1 + fi + + echo "Transformation succeeded!" \ No newline at end of file