|
| 1 | +# This workflow performs tests in DotNet with MPL nightly latest. |
| 2 | +name: Library DotNet 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 | + testDotNet: |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + library: [DynamoDbEncryption] |
| 26 | + dotnet-version: ["6.0.x"] |
| 27 | + os: [macos-12, ubuntu-latest, windows-latest] |
| 28 | + runs-on: ${{ matrix.os }} |
| 29 | + permissions: |
| 30 | + id-token: write |
| 31 | + contents: read |
| 32 | + env: |
| 33 | + DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
| 34 | + DOTNET_NOLOGO: 1 |
| 35 | + steps: |
| 36 | + - name: Support longpaths on Git checkout |
| 37 | + run: | |
| 38 | + git config --global core.longpaths true |
| 39 | + - uses: actions/checkout@v3 |
| 40 | + with: |
| 41 | + submodules: recursive |
| 42 | + fetch-depth: 0 |
| 43 | + |
| 44 | + - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} |
| 45 | + uses: actions/setup-dotnet@v4 |
| 46 | + with: |
| 47 | + dotnet-version: ${{ matrix.dotnet-version }} |
| 48 | + |
| 49 | + - name: Setup MPL Dafny |
| 50 | + uses: dafny-lang/setup-dafny-action@v1.7.2 |
| 51 | + with: |
| 52 | + dafny-version: ${{ inputs.mpl-dafny }} |
| 53 | + |
| 54 | + - name: Update MPL submodule |
| 55 | + working-directory: submodules/MaterialProviders |
| 56 | + run: | |
| 57 | + git fetch |
| 58 | + git checkout ${{inputs.mpl-commit}} |
| 59 | + git pull |
| 60 | + git submodule update --init --recursive |
| 61 | + git rev-parse HEAD |
| 62 | +
|
| 63 | + - name: Download Dependencies |
| 64 | + working-directory: ./${{ matrix.library }} |
| 65 | + run: make setup_net |
| 66 | + |
| 67 | + - name: Configure AWS Credentials |
| 68 | + uses: aws-actions/configure-aws-credentials@v4 |
| 69 | + with: |
| 70 | + aws-region: us-west-2 |
| 71 | + role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2 |
| 72 | + role-session-name: DDBEC-Dafny-Net-Tests |
| 73 | + |
| 74 | + - name: Compile MPL with Dafny ${{inputs.mpl-dafny}} |
| 75 | + shell: bash |
| 76 | + working-directory: submodules/MaterialProviders/TestVectorsAwsCryptographicMaterialProviders |
| 77 | + run: | |
| 78 | + make setup_net |
| 79 | + # This works because `node` is installed by default on GHA runners |
| 80 | + CORES=$(node -e 'console.log(os.cpus().length)') |
| 81 | + make transpile_net CORES=$CORES |
| 82 | +
|
| 83 | + - name: Setup DBESDK Dafny |
| 84 | + uses: dafny-lang/setup-dafny-action@v1.7.2 |
| 85 | + with: |
| 86 | + dafny-version: ${{ inputs.dbesdk-dafny}} |
| 87 | + |
| 88 | + - name: Compile ${{ matrix.library }} implementation |
| 89 | + shell: bash |
| 90 | + working-directory: ./${{ matrix.library }} |
| 91 | + run: | |
| 92 | + # This works because `node` is installed by default on GHA runners |
| 93 | + CORES=$(node -e 'console.log(os.cpus().length)') |
| 94 | + make transpile_implementation_net CORES=$CORES |
| 95 | + make transpile_test_net CORES=$CORES |
| 96 | +
|
| 97 | + - name: Test ${{ matrix.library }} net48 |
| 98 | + if: matrix.os == 'windows-latest' |
| 99 | + working-directory: ./${{ matrix.library }} |
| 100 | + shell: bash |
| 101 | + run: | |
| 102 | + dotnet restore runtimes/net/tests |
| 103 | + dotnet build runtimes/net/tests |
| 104 | + make test_net FRAMEWORK=net48 |
| 105 | +
|
| 106 | + - name: Test ${{ matrix.library }} net6.0 |
| 107 | + working-directory: ./${{ matrix.library }} |
| 108 | + shell: bash |
| 109 | + run: | |
| 110 | + dotnet restore runtimes/net/tests |
| 111 | + dotnet build runtimes/net/tests |
| 112 | + if [ "$RUNNER_OS" == "macOS" ]; then |
| 113 | + make test_net_mac_intel |
| 114 | + else |
| 115 | + make test_net FRAMEWORK=net6.0 |
| 116 | + fi |
| 117 | +
|
| 118 | + - name: Test Build and Pack ${{ matrix.library}} |
| 119 | + shell: bash |
| 120 | + if: matrix.os != 'windows-latest' |
| 121 | + working-directory: ./${{ matrix.library }} |
| 122 | + run: | |
| 123 | + dotnet build runtimes/net /p:Configuration=Release -nowarn:CS0162,CS0168 |
| 124 | + dotnet pack runtimes/net/DynamoDbEncryption.csproj --no-build /p:Configuration=Release --output build |
0 commit comments