Skip to content

chore: sync public with staging #2

chore: sync public with staging

chore: sync public with staging #2

# This workflow performs tests in .NET.
name: Library net tests
on:
pull_request:
push:
branches:
- main
schedule:
# Nightly build against Dafny's nightly prereleases,
# for early warning of verification issues or regressions.
# Timing chosen to be adequately after Dafny's own nightly build,
# but this might need to be tweaked:
# https://github.com/dafny-lang/dafny/blob/master/.github/workflows/deep-tests.yml#L16
- cron: "30 16 * * *"
env:
# Used in examples
AWS_ENCRYPTION_SDK_EXAMPLE_KMS_KEY_ID: arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_EXAMPLE_KMS_KEY_ID_2: arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_EXAMPLE_KMS_MRK_KEY_ID: arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_EXAMPLE_KMS_MRK_KEY_ID_2: arn:aws:kms:eu-west-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_EXAMPLE_LIMITED_ROLE_ARN_US_EAST_1: arn:aws:iam::370957321024:role/GitHub-CI-ESDK-Dafny-Role-us-west-2
AWS_ENCRYPTION_SDK_EXAMPLE_LIMITED_ROLE_ARN_EU_WEST_1: arn:aws:iam::370957321024:role/GitHub-CI-ESDK-Dafny-Role-us-west-2
jobs:
testDotNet:
# Don't run the nightly build on forks
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
strategy:
matrix:
library: [
AwsEncryptionSDK
]
dotnet-version: [ '6.0.x' ]
frameworks: [net6.0, net48]
os: [
windows-latest,
ubuntu-latest,
macos-latest,
]
runs-on: ${{ matrix.os }}
environment: "MPL_DAFNY"
permissions:
id-token: write
contents: read
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
steps:
- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true
- uses: actions/checkout@v2
- name: Init Submodules
shell: bash
env:
# This secret is in the configured environment
# Token created on # 09/26/2023
# expires in ~30 days 10/26/2023
MPL_PAT: ${{ secrets.MPL_DAFNY }}
run: |
AUTH="$(echo -n "pat:${MPL_PAT}" | base64 | tr -d '\n')"
git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $AUTH"
git config --global --add url.https://github.com/.insteadOf [email protected]:
git submodule update --init libraries
git submodule update --init --recursive mpl
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-ESDK-Dafny-Role-us-west-2
role-session-name: NetTests
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Setup Dafny
uses: dafny-lang/[email protected]
with:
# A && B || C is the closest thing to an if .. then ... else ... or ?: expression the GitHub Actions syntax supports.
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || '4.2.0' }}
- name: Download Dependencies
working-directory: ./${{ matrix.library }}
run: make setup_net
- name: Compile ${{ matrix.library }} 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_net CORES=$CORES
- name: Test ${{ matrix.library }} .NET Framework net48
working-directory: ./${{ matrix.library }}
shell: bash
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
DYLD_LIBRARY_PATH="/usr/local/opt/[email protected]/lib"
dotnet run \
--project runtimes/net/tests/ \
--framework net48
else
dotnet run \
--project runtimes/net/tests/ \
--framework net48
fi
- name: Test ${{ matrix.library }}
working-directory: ./${{ matrix.library }}
shell: bash
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
make test_net_mac_intel
else
make test_net
fi
- name: Test Examples on ${{ matrix.frameworks }}
shell: bash
working-directory: ./${{ matrix.library }}
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
DYLD_LIBRARY_PATH="/usr/local/opt/[email protected]/lib"
dotnet test \
runtimes/net/Examples \
--framework ${{ matrix.frameworks }}
else
dotnet test \
runtimes/net/Examples \
--framework ${{ matrix.frameworks }}
fi