Skip to content

Commit

Permalink
chore(GHA): add action for testing against MPL HEAD (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
josecorella authored Jul 12, 2024
1 parent a1427e0 commit b2f70ca
Show file tree
Hide file tree
Showing 12 changed files with 280 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci_examples_java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ on:
required: false
default: false
type: boolean
mpl-version:
description: "MPL version to use"
required: false
type: string
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
testJava:
Expand Down Expand Up @@ -48,6 +57,20 @@ jobs:
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD
- name: Update project.properties if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
run: |
sed "s/mplDependencyJavaVersion=.*/mplDependencyJavaVersion=${{inputs.mpl-version}}/g" project.properties > project.properties2; mv project.properties2 project.properties
- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ci_examples_net.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
required: false
default: false
type: boolean
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
dotNetExamples:
Expand Down Expand Up @@ -45,6 +50,15 @@ jobs:
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD
- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/ci_test_java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ on:
required: false
default: false
type: boolean
mpl-version:
description: "MPL version to use"
required: false
type: string
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
testJava:
Expand Down Expand Up @@ -42,6 +51,20 @@ jobs:
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD
- name: Update project.properties if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
run: |
sed "s/mplDependencyJavaVersion=.*/mplDependencyJavaVersion=${{inputs.mpl-version}}/g" project.properties > project.properties2; mv project.properties2 project.properties
- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ci_test_net.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
required: false
default: false
type: boolean
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
testDotNet:
Expand Down Expand Up @@ -46,6 +51,15 @@ jobs:
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD
- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/ci_test_vector_java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ on:
required: false
default: false
type: boolean
mpl-version:
description: "MPL version to use"
required: false
type: string
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
testJava:
Expand Down Expand Up @@ -51,6 +60,20 @@ jobs:
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD
- name: Update project.properties if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
run: |
sed "s/mplDependencyJavaVersion=.*/mplDependencyJavaVersion=${{inputs.mpl-version}}/g" project.properties > project.properties2; mv project.properties2 project.properties
- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ci_test_vector_net.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
required: false
default: false
type: boolean
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
testDotNet:
Expand Down Expand Up @@ -51,6 +56,15 @@ jobs:
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD
- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/daily_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
uses: ./.github/workflows/test_vector_verification.yml
with:
dafny: ${{needs.getVerifyVersion.outputs.version}}
daily-ci-java:
needs: getVersion
uses: ./.github/workflows/ci_test_java.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
daily-ci-java-test-vectors:
needs: getVersion
uses: ./.github/workflows/ci_test_vector_java.yml
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/library_dafny_verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ on:
required: false
default: false
type: boolean
mpl-version:
description: "MPL version to use"
required: false
type: string
mpl-head:
description: "Running on MPL HEAD"
required: false
default: false
type: boolean

jobs:
verification:
Expand Down Expand Up @@ -47,6 +56,20 @@ jobs:
with:
dafny-version: ${{ inputs.dafny }}

- name: Update MPL submodule if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
working-directory: submodules/MaterialProviders
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD
- name: Update project.properties if using MPL HEAD
if: ${{ inputs.mpl-head == true }}
run: |
sed "s/mplDependencyJavaVersion=.*/mplDependencyJavaVersion=${{inputs.mpl-version}}/g" project.properties > project.properties2; mv project.properties2 project.properties
# dafny-reportgenerator requires next6
# but only 7.0 is installed on macos-12-large
- name: Setup .NET Core SDK '6.0.x'
Expand All @@ -63,14 +86,14 @@ jobs:
diff-generated-code: false

- name: Verify ${{ matrix.library }} Dafny code
working-directory: ./DynamoDbEncryption
working-directory: DynamoDbEncryption
run: |
# This works because `node` is installed by default on GHA runners
CORES=$(node -e 'console.log(os.cpus().length)')
make verify_service CORES=$CORES SERVICE=${{ matrix.library }}
- name: Check solver resource use
if: success() || failure()
working-directory: ./DynamoDbEncryption
working-directory: DynamoDbEncryption
run: |
make dafny-reportgenerator
78 changes: 78 additions & 0 deletions .github/workflows/mpl-head.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# This workflow invokes other workflows with the latest MPL head at 14:00 UTC (7am PDT)
name: CI MPL HEAD

on:
schedule:
- cron: "00 14 * * 1-5"

jobs:
getVersion:
# Don't run the cron builds on forks
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
uses: ./.github/workflows/dafny_version.yml
getVerifyVersion:
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
uses: ./.github/workflows/dafny_verify_version.yml
getMplHeadVersion:
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
uses: ./.github/workflows/mpl_head_version.yml
mpl-head-ci-format:
needs: getVersion
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
uses: ./.github/workflows/library_format.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-head-ci-verification:
needs: [getVerifyVersion, getMplHeadVersion]
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
uses: ./.github/workflows/library_dafny_verification.yml
with:
dafny: ${{needs.getVerifyVersion.outputs.version}}
mpl-version: ${{needs.getMplHeadVersion.outputs.version}}
mpl-head: true
mpl-head-ci-test-vector-verification:
needs: [getVerifyVersion, getMplHeadVersion]
uses: ./.github/workflows/test_vector_verification.yml
with:
dafny: ${{needs.getVerifyVersion.outputs.version}}
mpl-version: ${{needs.getMplHeadVersion.outputs.version}}
mpl-head: true
mpl-head-ci-java:
needs: [getVersion, getMplHeadVersion]
uses: ./.github/workflows/ci_test_java.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-version: ${{needs.getMplHeadVersion.outputs.version}}
mpl-head: true
mpl-head-ci-java-test-vectors:
needs: [getVersion, getMplHeadVersion]
uses: ./.github/workflows/ci_test_vector_java.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-version: ${{needs.getMplHeadVersion.outputs.version}}
mpl-head: true
mpl-head-ci-java-examples:
needs: [getVersion, getMplHeadVersion]
uses: ./.github/workflows/ci_examples_java.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-version: ${{needs.getMplHeadVersion.outputs.version}}
mpl-head: true
mpl-head-ci-net:
needs: getVersion
uses: ./.github/workflows/ci_test_net.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-head: true
mpl-head-ci-net-test-vectors:
needs: getVersion
uses: ./.github/workflows/ci_test_vector_net.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-head: true
mpl-head-ci-net-examples:
needs: getVersion
uses: ./.github/workflows/ci_examples_net.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
mpl-head: true
36 changes: 36 additions & 0 deletions .github/workflows/mpl_head_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow reads the project.properties
# into the environment variables
# and then creates an output variable for `dafnyVerifyVersion `
name: MPL HEAD Version

on:
workflow_call:
outputs:
version:
description: "The dafny version for verify"
value: ${{ jobs.getMplHeadVersion.outputs.version }}

jobs:
getMplHeadVersion:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.read_property.outputs.mplVersion }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Update MPL submodule locally if requested
working-directory: submodules/MaterialProviders
shell: bash
run: |
git checkout main
git pull
git submodule update --init --recursive
git rev-parse HEAD
- name: Get the MPL version from the MPL submodule
id: read_property
uses: christian-draeger/[email protected]
with:
path: "submodules/MaterialProviders/project.properties"
properties: "mplVersion"
Loading

0 comments on commit b2f70ca

Please sign in to comment.