diff --git a/.github/workflows/pull-request-ephemeral-deploy.yml b/.github/workflows/pull-request-ephemeral-deploy.yml index 5111502..1901adb 100644 --- a/.github/workflows/pull-request-ephemeral-deploy.yml +++ b/.github/workflows/pull-request-ephemeral-deploy.yml @@ -9,12 +9,12 @@ jobs: get-tg-versions: permissions: contents: read - uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-versions.yml@0.1.7 + uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-versions.yml@0.2.0 build-matrix: permissions: contents: read - uses: launchbynttdata/launch-workflows/.github/workflows/reusable-github-matrix-tg.yml@0.1.7 + uses: launchbynttdata/launch-workflows/.github/workflows/reusable-github-matrix-tg.yml@0.2.0 with: platform_environment: sandbox @@ -27,7 +27,7 @@ jobs: fail-fast: false matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} - uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-deploy-ephemeral.yml@feature/tg-deploy-without-gh-environment + uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-deploy-ephemeral.yml@0.2.0 with: git_branch: ${{ github.head_ref }} assume_role_arn: "arn:aws:iam::020127659860:role/github-actions-deploy-role" diff --git a/.github/workflows/pull-request-ephemeral-destroy.yml b/.github/workflows/pull-request-ephemeral-destroy.yml index 0e2d062..9020fb7 100644 --- a/.github/workflows/pull-request-ephemeral-destroy.yml +++ b/.github/workflows/pull-request-ephemeral-destroy.yml @@ -1,4 +1,4 @@ -name: Deploy Sandbox Environment +name: Destroy Ephemeral Sandbox Environment on: pull_request: @@ -9,12 +9,12 @@ jobs: get-tg-versions: permissions: contents: read - uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-versions.yml@0.1.7 + uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-versions.yml@0.2.0 build-matrix: permissions: contents: read - uses: launchbynttdata/launch-workflows/.github/workflows/reusable-github-matrix-tg.yml@0.1.7 + uses: launchbynttdata/launch-workflows/.github/workflows/reusable-github-matrix-tg.yml@0.2.0 with: platform_environment: sandbox @@ -27,7 +27,7 @@ jobs: fail-fast: false matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} - uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-destroy-ephemeral.yml@feature/tg-deploy-without-gh-environment + uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-destroy-ephemeral.yml@0.2.0 with: git_branch: ${{ github.head_ref }} assume_role_arn: "arn:aws:iam::020127659860:role/github-actions-deploy-role" diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 0d23cae..1c53200 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -1,11 +1,6 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - name: Python Tests on: - push: - branches-ignore: [ "main" ] pull_request: branches: [ "**" ] @@ -15,7 +10,20 @@ permissions: pull-requests: write jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: '3.13' + - uses: launchbynttdata/actions-asdf-install_tools@v0.2.0 + with: + exclude_tools: "python" + - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd + run-tests: + needs: [ pre-commit ] runs-on: ubuntu-latest strategy: matrix: @@ -29,9 +37,6 @@ jobs: uses: astral-sh/setup-uv@445689ea25e0de0a23313031f5fe577c74ae45a1 with: python-version: ${{ matrix.python-version }} - - name: Ruff check - run: | - uvx ruff check - name: Install dependencies run: | uv sync diff --git a/.github/workflows/release-published.yml b/.github/workflows/release-published.yml index 1ffeced..62121a5 100644 --- a/.github/workflows/release-published.yml +++ b/.github/workflows/release-published.yml @@ -9,12 +9,12 @@ jobs: get-tg-versions: permissions: contents: read - uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-versions.yml@0.1.7 + uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-versions.yml@0.2.0 build-matrix: permissions: contents: read - uses: launchbynttdata/launch-workflows/.github/workflows/reusable-github-matrix-tg.yml@0.1.7 + uses: launchbynttdata/launch-workflows/.github/workflows/reusable-github-matrix-tg.yml@0.2.0 with: platform_environment: production @@ -27,8 +27,9 @@ jobs: fail-fast: false matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} - uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-deploy.yml@0.1.7 + uses: launchbynttdata/launch-workflows/.github/workflows/reusable-terragrunt-deploy.yml@0.2.0 with: + git_branch: ${{ github.head_ref }} tf_version: ${{ needs.get-tg-versions.outputs.tf_version }} tg_version: ${{ needs.get-tg-versions.outputs.tg_version }} environment: ${{ matrix.terragrunt_environment.environment }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..fd0ab6c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,43 @@ +repos: + - repo: https://github.com/astral-sh/uv-pre-commit + rev: ac44eab0cf35cf4268a18f1e7c20e0980550d6fa # 0.7.15 + hooks: + - id: uv-lock + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # v5.0.0 + hooks: + - id: trailing-whitespace + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-shebang-scripts-are-executable + - id: check-yaml + args: + - --allow-multiple-documents + - id: end-of-file-fixer + - id: mixed-line-ending + args: + - --fix=auto + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: 8a948e557ca98afa9489998ad0b85515964df9c4 # v0.12.0 + hooks: + - id: ruff-check + types_or: [python, pyi] + args: [--fix] + - id: ruff-format + types_or: [python, pyi] + - repo: https://github.com/RobertCraigie/pyright-python + rev: 708a9d4a964376a7be931b7721d315ef1d2db31d # v1.1.402 + hooks: + - id: pyright + - repo: https://github.com/antonbabenko/pre-commit-terraform + rev: 2f8bda194a420ad77a050a9de627d77a74841fdc # v1.99.4 + hooks: + - id: terragrunt_fmt + - id: terragrunt_validate_inputs + exclude: "^[^/]+$" + args: + - --env-vars=TF_VAR_organization_tag="THIS_ORGANIZATION" + - --env-vars=TF_VAR_repository_tag="THIS_REPOSITORY" + - --env-vars=TF_VAR_commit_hash_tag="THIS_COMMIT_HASH" diff --git a/terragrunt.hcl b/terragrunt.hcl index e6c44b8..08169c2 100644 --- a/terragrunt.hcl +++ b/terragrunt.hcl @@ -1,7 +1,7 @@ locals { # After initial apply, changes to these naming values will result in the creation of new state bucket(s) and dynamodb table(s)! - logical_product_family = "sample" + logical_product_family = "sample" logical_product_service = "lambda" # Don't modify the locals below this line.