Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Forwards compatibility with Dafny > 4.2 (including pending 4.5) #195

Merged
merged 128 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
25b9195
Add “make generate_properties_file” target
robin-aws Jan 30, 2024
2b539c0
Update properties file in one workflow
robin-aws Jan 31, 2024
7b77138
Typo
robin-aws Jan 31, 2024
8a84d2f
Sigh, typo
robin-aws Jan 31, 2024
0cbdd2e
Needed submodule
robin-aws Jan 31, 2024
95b54ab
Fix?
robin-aws Jan 31, 2024
c4727ad
Upgrade setup-dafny-action
robin-aws Jan 31, 2024
18736b2
Fix StandardLibrary externs w.r.t. type descriptors
robin-aws Jan 31, 2024
ef0a330
Fix KMS
robin-aws Jan 31, 2024
e434ae8
Typo
robin-aws Jan 31, 2024
924dc54
Regenerate KMS from Smithy
robin-aws Feb 1, 2024
af02950
Format generated code
robin-aws Feb 1, 2024
8f5329d
Regenerate Dafny for TestVectors…
robin-aws Feb 1, 2024
85bf3ab
Add smithy-dafny codegen step
robin-aws Feb 2, 2024
e8f00b4
Temporarily trim CI scope while testing
robin-aws Feb 2, 2024
89d6653
Setup prettier
robin-aws Feb 2, 2024
a1bb060
Add check for diff
robin-aws Feb 2, 2024
3ecf635
Only diff the relevant directory
robin-aws Feb 2, 2024
f08e18a
cd
robin-aws Feb 2, 2024
c96d79c
Make targets
robin-aws Feb 2, 2024
dead7d6
Submodule
robin-aws Feb 2, 2024
1135d5b
Update setup-dafny-action everywhere
robin-aws Feb 3, 2024
92c789a
Merge branch 'main' of github.com:aws/aws-cryptographic-material-prov…
robin-aws Feb 3, 2024
e668601
Fix bad merge
robin-aws Feb 3, 2024
cfecf9d
Simplify diff directories
robin-aws Feb 3, 2024
67344f7
fail fast: false
robin-aws Feb 3, 2024
0f18f76
Update smithy-dafny
robin-aws Feb 3, 2024
1298763
Revert upgrading generated code to 4.4
robin-aws Feb 3, 2024
f2d37d7
Add diff-generated-code input
robin-aws Feb 3, 2024
9e61f87
Better parameter description
robin-aws Feb 3, 2024
0d40ebc
Typo + format dafny
robin-aws Feb 3, 2024
4e98fef
Support net
robin-aws Feb 3, 2024
c93d24e
Submodules
robin-aws Feb 3, 2024
f004d3d
Add —patch-files-dir and first working patch
robin-aws Feb 6, 2024
4b6a796
Use smithy-dafny branch for testing
robin-aws Feb 6, 2024
8d62181
Update smithy-dafny
robin-aws Feb 6, 2024
2267704
Generate 4.3+ Java code for DDB
robin-aws Feb 6, 2024
29e1773
Revert "Generate 4.3+ Java code for DDB"
robin-aws Feb 6, 2024
8bdcb4a
Generate 4.3+ Java code for DDB
robin-aws Feb 6, 2024
798ac39
Revert "Generate 4.3+ Java code for DDB"
robin-aws Feb 6, 2024
95556ca
Copy patch for 4.3
robin-aws Feb 6, 2024
357622e
Action fixes
robin-aws Feb 6, 2024
f51d30f
Revert unnecessary Dafny change
robin-aws Feb 6, 2024
de43dc1
Update smithy-dafny
robin-aws Feb 6, 2024
5cee01b
Another revert
robin-aws Feb 6, 2024
ef2e997
Avoid direct datatype construction in DDB
robin-aws Feb 6, 2024
0e6c1ef
Update smithy-dafny
robin-aws Feb 8, 2024
566a3d5
update smithy-dafny (again)
robin-aws Feb 8, 2024
4423c46
Update smithy-dafny and switch to —library-root
robin-aws Feb 12, 2024
519ee4f
Fix generate_properties_file
robin-aws Feb 12, 2024
fc6a0e0
Remove comments about unnecessary manual edit
robin-aws Feb 12, 2024
6bc82dc
Replace || exit 1 (doesn’t work on Windows)
robin-aws Feb 12, 2024
aa8f895
Always use bash to get fail-fast behavior
robin-aws Feb 12, 2024
9f9b866
Revert default working directory
robin-aws Feb 12, 2024
73fc9fe
Update smithy-dafny
robin-aws Feb 12, 2024
dbfd2e8
update smithy-dafny
robin-aws Feb 13, 2024
d7bc98f
KMS patch
robin-aws Feb 13, 2024
8fe193c
Revert changes to KMS
robin-aws Feb 13, 2024
53b08e7
Fix KMS patch
robin-aws Feb 13, 2024
445f629
Include both files in patch
robin-aws Feb 13, 2024
25d0020
Regenerate .NET code to pick up smithy-dafny change
robin-aws Feb 13, 2024
30e1393
Pick up change in ordering
robin-aws Feb 13, 2024
f80b758
DDB .net patch
robin-aws Feb 13, 2024
b955943
More ordering changes
robin-aws Feb 13, 2024
d1801e5
Two more patches
robin-aws Feb 13, 2024
b097d37
Fix ordering
robin-aws Feb 14, 2024
b53192e
Fix patch
robin-aws Feb 14, 2024
08f0d86
another ordering fix
robin-aws Feb 14, 2024
8a7b1bd
One more ordering fix
robin-aws Feb 14, 2024
8a9025a
Again
robin-aws Feb 14, 2024
1e4c59f
ACTUALLY fix ordering
robin-aws Feb 14, 2024
2058987
fix patches
robin-aws Feb 14, 2024
10f35ef
Update smithy-dafny
robin-aws Feb 14, 2024
547da91
Restore lost edit
robin-aws Feb 14, 2024
b9eca64
Restore lost edit in patch
robin-aws Feb 14, 2024
fac0669
Swtich smithy-dafny to debugging branch
robin-aws Feb 14, 2024
f85f976
Update smithy-dafny
robin-aws Feb 14, 2024
c10a482
Update smithy-dafny
robin-aws Feb 14, 2024
38b30ef
Update smithy-dafny
robin-aws Feb 14, 2024
64c7a19
Don’t bother with polymorph_dafny when generating other languages
robin-aws Feb 14, 2024
904185b
update smithy-dafny, fix patch dafny version
robin-aws Feb 15, 2024
b85c7ea
Use —patch-files-dir to handle multi-model libraries
robin-aws Feb 16, 2024
0262813
Relocate AwsCryptographicMaterialProviders patch too
robin-aws Feb 16, 2024
8f3083a
Correction, SPLIT patch file
robin-aws Feb 16, 2024
c8699cc
Temp commit regenerated code (just to update patch)
robin-aws Feb 18, 2024
1818544
4.3 patch for KMS
robin-aws Feb 18, 2024
20d543f
Revert "Temp commit regenerated code (just to update patch)"
robin-aws Feb 18, 2024
7392e21
Fix Java errors for crypto primitives *WHEW*
robin-aws Feb 20, 2024
dfa621a
dotnet/net - potato/poTAto
robin-aws Feb 20, 2024
15d90b0
Format Java code
robin-aws Feb 20, 2024
513e932
Fix StormTrackingCMC
robin-aws Feb 20, 2024
7e15eea
Format java
robin-aws Feb 20, 2024
887d1d0
Missing file
robin-aws Feb 21, 2024
89a100b
Update smithy-dafny
robin-aws Feb 22, 2024
3188a64
OMG lock down prettier version
robin-aws Feb 23, 2024
86d94ab
Missing `ghost` keyword (caught by newer Dafny)
robin-aws Feb 23, 2024
fe960a2
Fix incorrect __default base class
robin-aws Feb 23, 2024
57789a6
Merge branch 'main' into robin-aws/fix-nightly-dafny-build
robin-aws Feb 23, 2024
31d64d7
One more CreateSuccessOfClient
robin-aws Feb 23, 2024
cff8860
Bad indenting
robin-aws Feb 23, 2024
29ebed4
Java formatting
robin-aws Feb 23, 2024
7d6e4c4
Update smithy-dafny
robin-aws Feb 23, 2024
eaf06aa
subset type tweak to avoid depending on runtime library changes
robin-aws Feb 24, 2024
41e1396
Remove a {:vcs_split_on_every_assert}
robin-aws Feb 25, 2024
3d9f22f
Revert "Remove a {:vcs_split_on_every_assert}"
robin-aws Feb 25, 2024
acf9519
Patch file to remove {:vcs_split_on_every_assert} for 4.4
robin-aws Feb 25, 2024
d1134ca
Fix patch number
robin-aws Feb 25, 2024
eec0841
Don’t generate dependencies once per server
robin-aws Feb 25, 2024
316935c
Clean up Makefile, update smithy-dafny
robin-aws Feb 26, 2024
753d0f8
Merge branch 'main' of github.com:aws/aws-cryptographic-material-prov…
robin-aws Feb 26, 2024
a6fa4c7
Update smithy-dafny to main-1.x now that PRs are merged
robin-aws Feb 27, 2024
a58036c
Refactor codegen into composite action
robin-aws Feb 28, 2024
7c56786
Missed updating a parameter
robin-aws Feb 28, 2024
bda5bb4
Syntax error in action.yml
robin-aws Feb 28, 2024
cb5b318
Missing shell: bash
robin-aws Feb 28, 2024
15d9086
Use DAFNY_VERSION
robin-aws Feb 28, 2024
8e12dae
Work around weird boolean behavior
robin-aws Feb 28, 2024
0a7f446
Fix check_polymorph_diff output
robin-aws Feb 28, 2024
3d92719
action.yml formatting
robin-aws Feb 28, 2024
0a9801e
Don’t regenerate Dafny code on Windows
robin-aws Feb 28, 2024
c229239
Typo
robin-aws Feb 28, 2024
0e16b1d
Explicitly set up node (otherwise no npx on windows?)
robin-aws Feb 28, 2024
56e4e25
Give up on npx on Windows for now
robin-aws Feb 29, 2024
2adb093
Formatting
robin-aws Feb 29, 2024
e684b6a
Add new codegen workflow to the relevant top-level workflows
robin-aws Feb 29, 2024
7a0f901
Typo in new workflow
robin-aws Feb 29, 2024
5715f20
Missing dependency setups
robin-aws Feb 29, 2024
498ecaa
workflow format
robin-aws Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/actions/polymorph_codegen/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#
# This local action serves two purposes:
#
# 1. For core workflows like pull.yml and push.yml,
# it is uses to check that the checked in copy of generated code
# matches what the current submodule version of smithy-dafny generates.
# This is important to ensure whenever someone changes the models
# or needs to regenerate to pick up smithy-dafny improvements,
# they don't have to deal with unpleasant surprises.
#
# 2. For workflows that check compatibility with other Dafny versions,
# such as nightly_dafny.yml, it is necessary to regenerate the code
# for that version of Dafny first.
# This is ultimately because some of the code smithy-dafny generates
# is tightly coupled to what code Dafny itself generates.
# A concrete example is that Dafny 4.3 added TypeDescriptors
# as parameters when constructing datatypes like Option and Result.
#
# This is why this is a composite action instead of a reusable workflow:
# the latter executes in a separate runner environment,
# but here we need to actually overwrite the generated code in place
# so that subsequent steps can work correctly.
#
# This action assumes that the given version of Dafny and .NET 6.0.x
# have already been set up, since they are used to format generated code.

name: "Polymorph code generation"
description: "Regenerates code using smithy-dafny, and optionally checks that the result matches the checked in state"
inputs:
dafny:
description: "The Dafny version to run"
required: true
type: string
library:
description: "Name of the library to regenerate code for"
required: true
type: string
diff-generated-code:
description: "Diff regenerated code against committed state"
required: true
type: boolean
outputs:
random-number:
description: "Random number"
value: ${{ steps.random-number-generator.outputs.random-number }}
runs:
using: "composite"
steps:
# Replace the project.properties file so that we pick up the right runtimes etc.,
# in cases where inputs.dafny is different from the current value in that file.
- name: Update top-level project.properties file
env:
DAFNY_VERSION: ${{ inputs.dafny }}
shell: bash
run: |
make generate_properties_file

- name: Regenerate Dafny code using smithy-dafny
# Unfortunately Dafny codegen doesn't work on Windows:
# https://github.com/smithy-lang/smithy-dafny/issues/317
if: runner.os != 'Windows'
working-directory: ./${{ inputs.library }}
shell: bash
run: |
make polymorph_dafny

- name: Regenerate Java code using smithy-dafny
# npx seems to be unavailable on Windows GHA runners,
# so we don't regenerate Java code on them either.
if: runner.os != 'Windows'
working-directory: ./${{ inputs.library }}
shell: bash
# smithy-dafny also formats generated code itself now,
# so prettier is a necessary dependency.
run: |
make -C .. setup_prettier
make polymorph_java

- name: Regenerate .NET code using smithy-dafny
working-directory: ./${{ inputs.library }}
shell: bash
run: |
make polymorph_dotnet

- name: Check regenerated code against commited code
# Composite action inputs seem to not actually support booleans properly for some reason
if: inputs.diff-generated-code == 'true'
working-directory: ./${{ inputs.library }}
shell: bash
run: |
make check_polymorph_diff
6 changes: 6 additions & 0 deletions .github/workflows/daily_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
uses: ./.github/workflows/library_format.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
daily-ci-codegen:
needs: getVersion
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
uses: ./.github/workflows/library_codegen.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
daily-ci-verification:
needs: getVersion
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/library_codegen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This workflow regenerates code using smithy-dafny and checks that the output matches what's checked in.
name: Library Code Generation
on:
workflow_call:
inputs:
dafny:
description: "The Dafny version to run"
required: true
type: string

jobs:
code-generation:
strategy:
fail-fast: false
matrix:
library:
[
TestVectorsAwsCryptographicMaterialProviders,
AwsCryptographyPrimitives,
ComAmazonawsKms,
ComAmazonawsDynamodb,
AwsCryptographicMaterialProviders,
StandardLibrary,
]
# Note dotnet is only used for formatting generated code
# in this workflow
dotnet-version: ["6.0.x"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
steps:
- name: Support longpaths
run: |
git config --global core.longpaths true

- uses: actions/checkout@v4
# The specification submodule is private so we don't have access, but we don't need
# it to verify the Dafny code. Instead we manually pull the submodules we DO need.
- run: git submodule update --init libraries
- run: git submodule update --init smithy-dafny

# Only used to format generated code
# and to translate version strings such as "nightly-latest"
# to an actual DAFNY_VERSION.
- name: Setup Dafny
uses: dafny-lang/[email protected]
with:
dafny-version: ${{ inputs.dafny }}

- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}

- uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ env.DAFNY_VERSION }}
library: ${{ matrix.library }}
diff-generated-code: true
25 changes: 21 additions & 4 deletions .github/workflows/library_dafny_verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ on:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean

jobs:
verification:
strategy:
fail-fast: false
matrix:
library:
[
Expand All @@ -23,6 +30,9 @@ jobs:
]
os: [macos-latest-large]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
Expand All @@ -33,11 +43,12 @@ jobs:

- uses: actions/checkout@v4
# The specification submodule is private so we don't have access, but we don't need
# it to verify the Dafny code. Instead we manually pull the submodule we DO need.
# it to verify the Dafny code. Instead we manually pull the submodules we DO need.
- run: git submodule update --init libraries
- run: git submodule update --init smithy-dafny

- name: Setup Dafny
uses: dafny-lang/setup-dafny-action@v1.6.1
uses: dafny-lang/setup-dafny-action@v1.7.0
with:
dafny-version: ${{ inputs.dafny }}

Expand All @@ -48,8 +59,15 @@ jobs:
with:
dotnet-version: "6.0.x"

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ env.DAFNY_VERSION }}
library: ${{ matrix.library }}
diff-generated-code: false

- name: Verify ${{ matrix.library }} Dafny code
shell: bash
working-directory: ./${{ matrix.library }}
run: |
# This works because `node` is installed by default on GHA runners
Expand All @@ -58,7 +76,6 @@ jobs:

- name: Check solver resource use
if: success() || failure()
shell: bash
working-directory: ./${{ matrix.library }}
run: |
make dafny-reportgenerator
7 changes: 4 additions & 3 deletions .github/workflows/library_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
Expand All @@ -40,20 +43,18 @@ jobs:
- run: git submodule update --init libraries

- name: Setup Dafny
uses: dafny-lang/setup-dafny-action@v1.6.1
uses: dafny-lang/setup-dafny-action@v1.7.0
with:
dafny-version: ${{ inputs.dafny }}

- name: Check format of ${{ matrix.library }} Dafny code
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 format_dafny-check

- name: Check format of ${{ matrix.library }} Net code
shell: bash
working-directory: ./${{ matrix.library }}
run: |
# This works because `node` is installed by default on GHA runners
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/library_java_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ on:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean

jobs:
testJava:
strategy:
fail-fast: false
matrix:
library:
[
Expand All @@ -32,6 +38,9 @@ jobs:
permissions:
id-token: write
contents: read
defaults:
run:
shell: bash
steps:
- name: Support longpaths on Git checkout
run: |
Expand All @@ -47,22 +56,30 @@ jobs:

- uses: actions/checkout@v4
# The specification submodule is private so we don't have access, but we don't need
# it to verify the Dafny code. Instead we manually pull the submodule we DO need.
# it to verify the Dafny code. Instead we manually pull the submodules we DO need.
- run: git submodule update --init libraries
- run: git submodule update --init smithy-dafny

- name: Setup Dafny
uses: dafny-lang/setup-dafny-action@v1.6.1
uses: dafny-lang/setup-dafny-action@v1.7.0
with:
dafny-version: ${{ inputs.dafny }}

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ env.DAFNY_VERSION }}
library: ${{ matrix.library }}
diff-generated-code: false

- name: Setup Java 8
uses: actions/setup-java@v3
with:
distribution: "corretto"
java-version: 8

- name: Build ${{ matrix.library }} implementation
shell: bash
working-directory: ./${{ matrix.library }}
run: |
# This works because `node` is installed by default on GHA runners
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/library_net_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ on:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean

jobs:
testDotNet:
strategy:
fail-fast: false
matrix:
library:
[
Expand All @@ -25,6 +31,9 @@ jobs:
dotnet-version: ["6.0.x"]
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
permissions:
id-token: write
contents: read
Expand All @@ -45,25 +54,33 @@ jobs:

- uses: actions/checkout@v4
# The specification submodule is private so we don't have access, but we don't need
# it to verify the Dafny code. Instead we manually pull the submodule we DO need.
# it to verify the Dafny code. Instead we manually pull the submodules we DO need.
- run: git submodule update --init libraries
- run: git submodule update --init smithy-dafny

- 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/setup-dafny-action@v1.6.1
uses: dafny-lang/setup-dafny-action@v1.7.0
with:
dafny-version: ${{ inputs.dafny }}

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ env.DAFNY_VERSION }}
library: ${{ matrix.library }}
diff-generated-code: false

- 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
Expand Down
Loading
Loading