|
| 1 | +# This workflow performs static analysis in Python. |
| 2 | +name: Python Static Analysis |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + regenerate-code: |
| 8 | + description: "Regenerate code using smithy-dafny" |
| 9 | + required: false |
| 10 | + default: false |
| 11 | + type: boolean |
| 12 | + mpl-version: |
| 13 | + description: "MPL version to use" |
| 14 | + required: false |
| 15 | + type: string |
| 16 | + mpl-head: |
| 17 | + description: "Running on MPL HEAD" |
| 18 | + required: false |
| 19 | + default: false |
| 20 | + type: boolean |
| 21 | + |
| 22 | +jobs: |
| 23 | + testPython: |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + python-version: [3.11] |
| 27 | + os: [macos-13] |
| 28 | + runs-on: ${{ matrix.os }} |
| 29 | + permissions: |
| 30 | + id-token: write |
| 31 | + contents: read |
| 32 | + steps: |
| 33 | + - name: Configure AWS Credentials |
| 34 | + uses: aws-actions/configure-aws-credentials@v4 |
| 35 | + with: |
| 36 | + aws-region: us-west-2 |
| 37 | + role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2 |
| 38 | + role-session-name: DDBEC-Dafny-Python-Tests |
| 39 | + |
| 40 | + - uses: actions/checkout@v3 |
| 41 | + with: |
| 42 | + submodules: recursive |
| 43 | + |
| 44 | + - name: Setup Python ${{ matrix.python-version }} |
| 45 | + uses: actions/setup-python@v4 |
| 46 | + with: |
| 47 | + python-version: ${{ matrix.python-version }} |
| 48 | + |
| 49 | + - name: Setup Python ${{ matrix.python-version }} for running tests |
| 50 | + run: | |
| 51 | + python -m pip install --upgrade pip |
| 52 | + pip install --upgrade tox |
| 53 | + pip install poetry |
| 54 | +
|
| 55 | + - name: Update MPL submodule if using MPL HEAD |
| 56 | + if: ${{ inputs.mpl-head == true }} |
| 57 | + working-directory: submodules/MaterialProviders |
| 58 | + run: | |
| 59 | + git checkout main |
| 60 | + git pull |
| 61 | + git submodule update --init --recursive |
| 62 | + git rev-parse HEAD |
| 63 | +
|
| 64 | + - name: Regenerate code using smithy-dafny if necessary |
| 65 | + if: ${{ inputs.regenerate-code }} |
| 66 | + uses: ./.github/actions/polymorph_codegen |
| 67 | + with: |
| 68 | + dafny: ${{ env.DAFNY_VERSION }} |
| 69 | + library: DynamoDbEncryption |
| 70 | + diff-generated-code: false |
| 71 | + update-and-regenerate-mpl: true |
| 72 | + |
| 73 | + - name: Test DynamoDbEncryption Examples |
| 74 | + working-directory: ./Examples/runtimes/python |
| 75 | + run: | |
| 76 | + tox -e ruff |
| 77 | + tox -e black-check |
0 commit comments