Skip to content

Commit 45a2b63

Browse files
authored
Merge branch 'main' into update-names
2 parents 68b1f53 + b9333fb commit 45a2b63

File tree

94 files changed

+1832
-345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1832
-345
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# This local action sets up code dependencies
3+
# to run Smithy-Dafny CI in GitHub Actions workflows.
4+
#
5+
6+
name: "Install Smithy-Dafny codegen dependencies"
7+
description: "Install Java package dependencies required to run Smithy-Dafny codegen"
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Install smithy-dafny-codegen Rust dependencies locally
12+
uses: gradle/gradle-build-action@v2
13+
with:
14+
arguments: :codegen-client:pTML :codegen-core:pTML :rust-runtime:pTML
15+
build-root-directory: submodules/smithy-dafny/smithy-dafny-codegen-modules/smithy-rs
16+
17+
- name: Install smithy-dafny-codegen Python dependencies locally
18+
uses: gradle/gradle-build-action@v2
19+
with:
20+
arguments: :smithy-python-codegen:pTML
21+
build-root-directory: submodules/smithy-dafny/codegen/smithy-dafny-codegen-modules/smithy-python/codegen

.github/actions/polymorph_codegen/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ runs:
9797
run: |
9898
echo "PROJECT_DEPENDENCIES=${{ inputs.update-and-regenerate-mpl != 'true' && 'PROJECT_DEPENDENCIES=' || '' }}" >> $GITHUB_OUTPUT
9999
100+
- name: Print dotnet version
101+
shell: bash
102+
run: |
103+
dotnet --version
104+
100105
- name: Regenerate Dafny code using smithy-dafny
101106
# Unfortunately Dafny codegen doesn't work on Windows:
102107
# https://github.com/smithy-lang/smithy-dafny/issues/317
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow checks if you are checking in dafny code
2+
# with the keyword {:only}, it adds a message to the pull
3+
# request to remind you to remove it.
4+
name: Check {:only} decorator presence
5+
6+
on:
7+
pull_request:
8+
9+
jobs:
10+
grep-only-verification-keyword:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Check only keyword
21+
id: only-keyword
22+
shell: bash
23+
run:
24+
# checking in code with the dafny decorator {:only}
25+
# will not verify the entire file or maybe the entire project depending on its configuration
26+
# This action checks if you are either adding or removing the {:only} decorator and posting on the pr if you are.
27+
echo "ONLY_KEYWORD=$(git diff origin/main origin/${GITHUB_HEAD_REF} **/*.dfy | grep -i {:only})" >> "$GITHUB_OUTPUT"
28+
29+
- name: Check if ONLY_KEYWORD is not empty
30+
id: comment
31+
env:
32+
PR_NUMBER: ${{ github.event.number }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
ONLY_KEYWORD: ${{ steps.only-keyword.outputs.ONLY_KEYWORD }}
35+
if: ${{env.ONLY_KEYWORD != ''}}
36+
run: |
37+
COMMENT="It looks like you are adding or removing the dafny keyword {:only}.\nIs this intended?"
38+
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
39+
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"
40+
exit 1

.github/workflows/ci_codegen.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ jobs:
3333
- uses: actions/checkout@v3
3434
with:
3535
submodules: recursive
36+
- run: git submodule update --init --recursive submodules/smithy-dafny
3637

3738
# Only used to format generated code
3839
# and to translate version strings such as "nightly-latest"
3940
# to an actual DAFNY_VERSION.
4041
- name: Setup Dafny
41-
uses: dafny-lang/setup-dafny-action@v1.7.2
42+
uses: dafny-lang/setup-dafny-action@v1.8.0
4243
with:
4344
dafny-version: ${{ inputs.dafny }}
4445

@@ -47,8 +48,20 @@ jobs:
4748
with:
4849
dotnet-version: ${{ matrix.dotnet-version }}
4950

51+
- name: Create temporary global.json
52+
run: echo '{"sdk":{"rollForward":"latestFeature","version":"6.0.0"}}' > ./global.json
53+
54+
- name: Setup Java 17 for codegen
55+
uses: actions/setup-java@v3
56+
with:
57+
distribution: "corretto"
58+
java-version: "17"
59+
60+
- name: Install Smithy-Dafny codegen dependencies
61+
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies
62+
5063
- uses: ./.github/actions/polymorph_codegen
5164
with:
52-
dafny: ${{ env.DAFNY_VERSION }}
65+
dafny: ${{ inputs.dafny }}
5366
library: ${{ matrix.library }}
5467
diff-generated-code: true

.github/workflows/ci_examples_java.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
java-version: ${{ matrix.java-version }}
5454

5555
- name: Setup Dafny
56-
uses: dafny-lang/setup-dafny-action@v1.7.2
56+
uses: dafny-lang/setup-dafny-action@v1.8.0
5757
with:
5858
dafny-version: ${{ inputs.dafny }}
5959

.github/workflows/ci_examples_net.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
dotnet-version: ${{ matrix.dotnet-version }}
4747

4848
- name: Setup Dafny
49-
uses: dafny-lang/setup-dafny-action@v1.7.2
49+
uses: dafny-lang/setup-dafny-action@v1.8.0
5050
with:
5151
dafny-version: ${{ inputs.dafny }}
5252

.github/workflows/ci_test_java.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
submodules: recursive
4848

4949
- name: Setup Dafny
50-
uses: dafny-lang/setup-dafny-action@v1.7.2
50+
uses: dafny-lang/setup-dafny-action@v1.8.0
5151
with:
5252
dafny-version: ${{ inputs.dafny }}
5353

.github/workflows/ci_test_net.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
dotnet-version: ${{ matrix.dotnet-version }}
4848

4949
- name: Setup Dafny
50-
uses: dafny-lang/setup-dafny-action@v1.7.2
50+
uses: dafny-lang/setup-dafny-action@v1.8.0
5151
with:
5252
dafny-version: ${{ inputs.dafny }}
5353

.github/workflows/ci_test_vector_java.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
submodules: recursive
5757

5858
- name: Setup Dafny
59-
uses: dafny-lang/setup-dafny-action@v1.7.2
59+
uses: dafny-lang/setup-dafny-action@v1.8.0
6060
with:
6161
dafny-version: ${{ inputs.dafny }}
6262

.github/workflows/ci_test_vector_net.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
submodules: recursive
5353

5454
- name: Setup Dafny
55-
uses: dafny-lang/setup-dafny-action@v1.7.2
55+
uses: dafny-lang/setup-dafny-action@v1.8.0
5656
with:
5757
dafny-version: ${{ inputs.dafny }}
5858

0 commit comments

Comments
 (0)