diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml new file mode 100644 index 0000000..19d805b --- /dev/null +++ b/.github/workflows/dependencies.yml @@ -0,0 +1,52 @@ +name: update dependencies +on: + + schedule: + - cron: '0 0 1 * *' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.PRIVATE_KEY }} + + - uses: actions/checkout@v3 + with: + token: ${{ steps.app-token.outputs.token }} + ref: development + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: pip + + - name: Install pre-commit and pip-tools + run: pip install pre-commit pip-tools + + - name: Run pre-commit autoupdate + run: pre-commit autoupdate + + - name: Update test requirements + run: pip-compile --upgrade test_requirements.in -o test_requirements.txt + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6.0.2 + with: + token: ${{ steps.app-token.outputs.token }} + base: development + branch: dependency-updates + delete-branch: true + title: Dependency Updates + commit-message: Dependency updates \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a93311f..7add6d1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,13 @@ repos: -- repo: https://github.com/pre-commit/mirrors-autopep8 - rev: v2.0.4 +- repo: https://github.com/hhatto/autopep8 + rev: v2.3.1 hooks: - id: autopep8 args: - --in-place - --aggressive - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.1.1 hooks: - id: flake8 - repo: https://github.com/pycqa/isort diff --git a/tests/test_notifications.py b/tests/test_notifications.py index 0539b72..4dbd47e 100644 --- a/tests/test_notifications.py +++ b/tests/test_notifications.py @@ -5,7 +5,7 @@ from unittest.mock import patch import boto3 -from moto import mock_ssm +from moto import mock_aws from src.handle_digitized_image_notifications import (get_config, lambda_handler, @@ -118,7 +118,7 @@ def test_structure_teams_message(): assert output == json.dumps(expected) -@mock_ssm +@mock_aws def test_config(): ssm = boto3.client('ssm', region_name='us-east-1') path = "/dev/digitized_av_trigger" diff --git a/tests/test_requirements.in b/tests/test_requirements.in new file mode 100644 index 0000000..6c59c8b --- /dev/null +++ b/tests/test_requirements.in @@ -0,0 +1,5 @@ +boto3~=1.35 +coverage~=7.6 +moto~=5.0 +pytest~=8.3 +urllib3~=2.2 \ No newline at end of file diff --git a/tests/test_requirements.txt b/tests/test_requirements.txt index d9ff050..669dd19 100644 --- a/tests/test_requirements.txt +++ b/tests/test_requirements.txt @@ -1,5 +1,79 @@ -boto3~=1.26 -coverage~=7.2 -moto~=4.1 -pytest~=7.2 -urllib3~=1.26 \ No newline at end of file +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# pip-compile --output-file=tests/test_requirements.txt tests/test_requirements.in +# +boto3==1.35.70 + # via + # -r tests/test_requirements.in + # moto +botocore==1.35.70 + # via + # boto3 + # moto + # s3transfer +certifi==2024.8.30 + # via requests +cffi==1.17.1 + # via cryptography +charset-normalizer==3.4.0 + # via requests +coverage==7.6.8 + # via -r tests/test_requirements.in +cryptography==43.0.3 + # via moto +exceptiongroup==1.2.2 + # via pytest +idna==3.10 + # via requests +iniconfig==2.0.0 + # via pytest +jinja2==3.1.4 + # via moto +jmespath==1.0.1 + # via + # boto3 + # botocore +markupsafe==3.0.2 + # via + # jinja2 + # werkzeug +moto==5.0.21 + # via -r tests/test_requirements.in +packaging==24.2 + # via pytest +pluggy==1.5.0 + # via pytest +pycparser==2.22 + # via cffi +pytest==8.3.3 + # via -r tests/test_requirements.in +python-dateutil==2.9.0.post0 + # via + # botocore + # moto +pyyaml==6.0.2 + # via responses +requests==2.32.3 + # via + # moto + # responses +responses==0.25.3 + # via moto +s3transfer==0.10.4 + # via boto3 +six==1.16.0 + # via python-dateutil +tomli==2.1.0 + # via pytest +urllib3==2.2.3 + # via + # -r tests/test_requirements.in + # botocore + # requests + # responses +werkzeug==3.1.3 + # via moto +xmltodict==0.14.2 + # via moto