Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ permissions:
contents: read

env:
UV_VERSION: "0.9.x"
TERRAFORM_VERSION: "1.13"
JUST_VERSION: '1'
PREK_VERSION: '0.2.10'
TERRAFORM_VERSION: '1.13'
UV_VERSION: '0.9.x'

jobs:
pre-commit:
prek:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand All @@ -29,8 +31,10 @@ jobs:
terraform_version: ${{ env.TERRAFORM_VERSION }}
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0
with:
just-version: '1'
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
just-version: ${{ env.JUST_VERSION }}
- uses: j178/prek-action@91fd7d7cf70ae1dee9f4f44e7dfa5d1073fe6623 # v1.0.11
with:
prek-version: ${{ env.PREK_VERSION }}

sanity:
runs-on: ubuntu-latest
Expand All @@ -48,7 +52,7 @@ jobs:
- run: just validate-wheel

ci:
needs: [pre-commit, sanity]
needs: [prek, sanity]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand All @@ -66,7 +70,7 @@ jobs:
- run: just integration-tests

python-version:
needs: [pre-commit, sanity]
needs: [prek, sanity]
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 15
Expand Down
14 changes: 10 additions & 4 deletions hooks/minify_iam_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@

from hatchling.builders.hooks.plugin.interface import BuildHookInterface

IAM_DATA_PATH = Path("policy_sentry/shared/data/iam-definition.json")


class MinifyIAMDataHook(BuildHookInterface):
"""Hatch build hook that minifies the IAM data store before building."""

PLUGIN_NAME = "minify_iam_data"

def initialize(self, _version, build_data):
src = Path("policy_sentry/shared/data/iam-definition.json")
dest = Path(self.root) / src
def initialize(self, _version, _build_data):
dest = Path(self.root) / IAM_DATA_PATH

dest.parent.mkdir(parents=True, exist_ok=True)
minified = json.dumps(json.loads(src.read_bytes()), separators=(",", ":"))
minified = json.dumps(json.loads(IAM_DATA_PATH.read_bytes()), separators=(",", ":"))
dest.write_text(minified)

def finalize(self, _version, _build_data, _artifact_path):
# after the build, pretty format the json file again
file_path = Path(self.root) / IAM_DATA_PATH
file_path.write_text(json.dumps(json.loads(file_path.read_bytes()), indent=2))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Twitter = "https://twitter.com/kmcquade3"
dev = [
"coverage>=7.11.0",
"mypy>=1.18.0",
"pre-commit>=4.1.0",
"prek>=0.2.10,<0.3.0",
"pytest>=8.4.0",
"rust-just>=1.43.0",
"types-beautifulsoup4>=4.12.0",
Expand Down
2 changes: 1 addition & 1 deletion terraform_module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ No provider.
Run this every time before you push to Git.

```
pre-commit run -a
prek run -a
```


Expand Down
105 changes: 23 additions & 82 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.