|
| 1 | +# This workflow performs tests in Go with nightly latest versions for mpl or esdk. |
| 2 | +name: Library Go Backwards Interop Tests |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + mpl-dafny: |
| 8 | + description: "The Dafny version to compile the MPL with (4.2.0, dafny-nightly, etc..)" |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + mpl-commit: |
| 12 | + description: "The MPL commit to use" |
| 13 | + required: false |
| 14 | + default: "main" |
| 15 | + type: string |
| 16 | + dbesdk-dafny: |
| 17 | + description: "The Dafny version to compile the DBESDK with (4.2.0, dafny-nightly, etc..)" |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + |
| 21 | +jobs: |
| 22 | + testGo: |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + library: [TestVectors] |
| 27 | + os: [ubuntu-22.04, macos-13] |
| 28 | + go-version: ["1.23", "1.24"] |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + permissions: |
| 31 | + id-token: write |
| 32 | + contents: read |
| 33 | + steps: |
| 34 | + - name: Setup Docker |
| 35 | + if: matrix.os == 'macos-13' && matrix.library == 'TestVectors' |
| 36 | + uses: douglascamata/setup-docker-macos-action@v1-alpha |
| 37 | + |
| 38 | + - name: Setup DynamoDB Local |
| 39 | + if: matrix.library == 'TestVectors' |
| 40 | + |
| 41 | + with: |
| 42 | + port: 8000 |
| 43 | + cors: "*" |
| 44 | + |
| 45 | + - name: Support longpaths |
| 46 | + run: | |
| 47 | + git config --global core.longpaths true |
| 48 | +
|
| 49 | + - name: Configure AWS Credentials |
| 50 | + uses: aws-actions/configure-aws-credentials@v4 |
| 51 | + with: |
| 52 | + aws-region: us-west-2 |
| 53 | + role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2 |
| 54 | + role-session-name: DDBEC-Dafny-Java-Tests |
| 55 | + |
| 56 | + - uses: actions/checkout@v3 |
| 57 | + with: |
| 58 | + submodules: recursive |
| 59 | + |
| 60 | + - name: Setup MPL Dafny |
| 61 | + uses: ./submodules/MaterialProviders/.github/actions/setup_dafny |
| 62 | + with: |
| 63 | + dafny-version: ${{ inputs.mpl-dafny }} |
| 64 | + |
| 65 | + - name: Create temporary global.json |
| 66 | + run: echo '{"sdk":{"rollForward":"latestFeature","version":"6.0.0"}}' > ./global.json |
| 67 | + |
| 68 | + - name: Setup Java 17 for codegen |
| 69 | + uses: actions/setup-java@v3 |
| 70 | + with: |
| 71 | + distribution: "corretto" |
| 72 | + java-version: "17" |
| 73 | + |
| 74 | + - name: Update MPL submodule |
| 75 | + working-directory: mpl |
| 76 | + run: | |
| 77 | + git fetch |
| 78 | + git checkout ${{inputs.mpl-commit}} |
| 79 | + git pull |
| 80 | + git submodule update --init --recursive |
| 81 | + git rev-parse HEAD |
| 82 | +
|
| 83 | + - uses: actions/checkout@v3 |
| 84 | + - name: Init Submodules |
| 85 | + shell: bash |
| 86 | + run: | |
| 87 | + git submodule update --init --recursive submodules/smithy-dafny |
| 88 | + git submodule update --init --recursive submodules/MaterialProviders |
| 89 | +
|
| 90 | + - name: Install Smithy-Dafny codegen dependencies |
| 91 | + uses: ./.github/actions/install_smithy_dafny_codegen_dependencies |
| 92 | + |
| 93 | + - name: Install Go |
| 94 | + uses: actions/setup-go@v5 |
| 95 | + with: |
| 96 | + go-version: ${{ matrix.go-version }} |
| 97 | + |
| 98 | + - name: Install Go imports |
| 99 | + shell: bash |
| 100 | + run: | |
| 101 | + go install golang.org/x/tools/cmd/goimports@latest |
| 102 | +
|
| 103 | + - name: Compile MPL with Dafny ${{inputs.mpl-dafny}} |
| 104 | + shell: bash |
| 105 | + working-directory: submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders |
| 106 | + run: | |
| 107 | + # This works because `node` is installed by default on GHA runners |
| 108 | + CORES=$(node -e 'console.log(os.cpus().length)') |
| 109 | + make transpile_go CORES=$CORES |
| 110 | +
|
| 111 | + - name: Setup DBESDK Dafny |
| 112 | + uses: ./submodules/MaterialProviders/.github/actions/setup_dafny |
| 113 | + with: |
| 114 | + dafny-version: ${{ inputs.dbesdk-dafny}} |
| 115 | + |
| 116 | + - name: Build DBESDK implementation |
| 117 | + shell: bash |
| 118 | + working-directory: ./${{ matrix.library }} |
| 119 | + run: | |
| 120 | + # This works because `node` is installed by default on GHA runners |
| 121 | + CORES=$(node -e 'console.log(os.cpus().length)') |
| 122 | + make transpile_go CORES=$CORES |
| 123 | +
|
| 124 | + - name: Test ${{ matrix.library }} |
| 125 | + working-directory: ./${{ matrix.library }} |
| 126 | + run: | |
| 127 | + make test_go |
0 commit comments