diff --git a/.github/workflows/dafny-interop.yml b/.github/workflows/dafny-interop.yml index da395dbfa..2dde2f744 100644 --- a/.github/workflows/dafny-interop.yml +++ b/.github/workflows/dafny-interop.yml @@ -4,6 +4,21 @@ name: Dafny Interoperability Test on: + workflow_call: + inputs: + mpl-dafny: + description: "The Dafny version to compile the MPL with (4.2.0, nightly-latest, etc..)" + required: true + type: string + mpl-commit: + description: "The MPL branch/commit to use" + required: false + default: "main" + type: string + dbesdk-dafny: + description: "The Dafny version to compile the DBESDK with (4.2.0, nightly-latest, etc..)" + required: true + type: string workflow_dispatch: inputs: mpl-dafny: @@ -67,3 +82,9 @@ jobs: mpl-dafny: ${{inputs.mpl-dafny}} mpl-commit: ${{inputs.mpl-commit}} dbesdk-dafny: ${{inputs.dbesdk-dafny}} + dafny-interop-go: + uses: ./.github/workflows/dafny_interop_go_tests.yml + with: + mpl-dafny: ${{inputs.mpl-dafny}} + mpl-commit: ${{inputs.mpl-commit}} + dbesdk-dafny: ${{inputs.dbesdk-dafny}} diff --git a/.github/workflows/dafny_interop_go_tests.yml b/.github/workflows/dafny_interop_go_tests.yml new file mode 100644 index 000000000..a48a133ea --- /dev/null +++ b/.github/workflows/dafny_interop_go_tests.yml @@ -0,0 +1,127 @@ +# This workflow performs tests in Go with nightly latest versions for mpl or esdk. +name: Library Go Backwards Interop Tests + +on: + workflow_call: + inputs: + mpl-dafny: + description: "The Dafny version to compile the MPL with (4.2.0, dafny-nightly, etc..)" + required: true + type: string + mpl-commit: + description: "The MPL commit to use" + required: false + default: "main" + type: string + dbesdk-dafny: + description: "The Dafny version to compile the DBESDK with (4.2.0, dafny-nightly, etc..)" + required: true + type: string + +jobs: + testGo: + strategy: + fail-fast: false + matrix: + library: [TestVectors] + os: [ubuntu-22.04, macos-13] + go-version: ["1.23", "1.24"] + runs-on: ${{ matrix.os }} + permissions: + id-token: write + contents: read + steps: + - name: Setup Docker + if: matrix.os == 'macos-13' && matrix.library == 'TestVectors' + uses: douglascamata/setup-docker-macos-action@v1-alpha + + - name: Setup DynamoDB Local + if: matrix.library == 'TestVectors' + uses: rrainn/dynamodb-action@v4.0.0 + with: + port: 8000 + cors: "*" + + - name: Support longpaths + run: | + git config --global core.longpaths true + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: us-west-2 + role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2 + role-session-name: DDBEC-Dafny-Java-Tests + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Setup MPL Dafny + uses: ./submodules/MaterialProviders/.github/actions/setup_dafny + with: + dafny-version: ${{ inputs.mpl-dafny }} + + - name: Create temporary global.json + run: echo '{"sdk":{"rollForward":"latestFeature","version":"6.0.0"}}' > ./global.json + + - name: Setup Java 17 for codegen + uses: actions/setup-java@v3 + with: + distribution: "corretto" + java-version: "17" + + - name: Update MPL submodule + working-directory: submodules/MaterialProviders + run: | + git fetch + git checkout ${{inputs.mpl-commit}} + git pull + git submodule update --init --recursive + git rev-parse HEAD + + - uses: actions/checkout@v3 + - name: Init Submodules + shell: bash + run: | + git submodule update --init --recursive submodules/smithy-dafny + git submodule update --init --recursive submodules/MaterialProviders + + - name: Install Smithy-Dafny codegen dependencies + uses: ./.github/actions/install_smithy_dafny_codegen_dependencies + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + + - name: Install Go imports + shell: bash + run: | + go install golang.org/x/tools/cmd/goimports@latest + + - name: Compile MPL with Dafny ${{inputs.mpl-dafny}} + shell: bash + working-directory: submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders + run: | + # This works because `node` is installed by default on GHA runners + CORES=$(node -e 'console.log(os.cpus().length)') + make transpile_go CORES=$CORES + + - name: Setup DBESDK Dafny + uses: ./submodules/MaterialProviders/.github/actions/setup_dafny + with: + dafny-version: ${{ inputs.dbesdk-dafny}} + + - name: Build DBESDK implementation + shell: bash + working-directory: ./${{ matrix.library }} + run: | + # This works because `node` is installed by default on GHA runners + CORES=$(node -e 'console.log(os.cpus().length)') + make transpile_go CORES=$CORES + + - name: Test ${{ matrix.library }} + working-directory: ./${{ matrix.library }} + run: | + make test_go diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index eb4bc6e20..bf89178cb 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -9,6 +9,7 @@ on: # but this might need to be tweaked: # https://github.com/dafny-lang/dafny/blob/master/.github/workflows/deep-tests.yml#L16 - cron: "30 16 * * *" + workflow_dispatch: jobs: getVersion: @@ -64,6 +65,22 @@ jobs: with: dafny: "nightly-latest" regenerate-code: true + dafny_nightly_backwards_interop_dbesdk: + if: github.event_name != 'schedule' || github.repository_owner == 'aws' + needs: getVersion + uses: ./.github/workflows/dafny-interop.yml + with: + mpl-dafny: ${{needs.getVersion.outputs.version}} + mpl-commit: "main" + dbesdk-dafny: "nightly-latest" + dafny_nightly_backwards_interop_mpl: + if: github.event_name != 'schedule' || github.repository_owner == 'aws' + needs: getVersion + uses: ./.github/workflows/dafny-interop.yml + with: + mpl-dafny: "nightly-latest" + mpl-commit: "main" + dbesdk-dafny: ${{needs.getVersion.outputs.version}} cut-issue-on-failure: runs-on: ubuntu-22.04