diff options
| author | Joshua Lusk <luskjh@gmail.com> | 2026-05-25 20:21:47 -0400 |
|---|---|---|
| committer | Joshua Lusk <luskjh@gmail.com> | 2026-05-25 20:21:47 -0400 |
| commit | 522f354f231df5ef86d5489cf4980805b6ff9be1 (patch) | |
| tree | 9ebb0b414bcfca6c5f93ef11913b1382925dd0f6 | |
| parent | 46f86f2a3edb1b728248f2073ff9cfde37a7c3d0 (diff) | |
add pre-commit and ci workflow
| -rw-r--r-- | .ansible-lint | 2 | ||||
| -rw-r--r-- | .github/ci.yaml | 21 | ||||
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | Makefile | 5 | ||||
| -rw-r--r-- | README.md | 15 | ||||
| -rwxr-xr-x | pre-commit.sh | 3 | ||||
| -rw-r--r-- | requirements.yaml | 7 | ||||
| -rw-r--r-- | uv.lock | 2 |
8 files changed, 50 insertions, 8 deletions
diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..f615bf2 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,2 @@ +exclude_paths: + - .github/ diff --git a/.github/ci.yaml b/.github/ci.yaml new file mode 100644 index 0000000..88e0711 --- /dev/null +++ b/.github/ci.yaml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 + with: + python-version-file: ".python-version" + - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + with: + enable-cache: true + - run: echo "${{ secrets.VAULT_PASS }}" > .vault_pass + - run: pre-commit.sh @@ -1,5 +1,6 @@ +/.ansible/ .DS_Store /.vault_pass -/.venv +/.venv/ /tmp/* !/tmp/.keep @@ -10,6 +10,11 @@ edit: .PHONY: install install: $(UV) sync + $(BIN)/ansible-galaxy collection install -r requirements.yaml + +.PHONY: install-pre +install-pre: + cp pre-commit.sh .git/hooks/pre-commit .PHONY: lint lint: @@ -8,6 +8,8 @@ Remote infrastructure. $ git clone git@github.com:luskjh/infra $ cd infra $ make install +$ make install-pre +$ echo '<vault password>' > .vault_pass ``` ## Makefile targets @@ -16,11 +18,12 @@ $ make install _Listed in alphabetical order._ -| Target | Description | -| ------------------ | -------------------- | -| `edit` | Edit ansible vault | -| `install` | Install dependencies | -| `lint` | Run ansible lint | -| `ping`<sup>*</sup> | Ping hollyhock host | +| Target | Description | +| ------------------ | ----------------------- | +| `edit` | Edit ansible vault | +| `install` | Install dependencies | +| `install-pre` | Install pre-commit hook | +| `lint` | Run ansible lint | +| `ping`<sup>*</sup> | Ping hollyhock host | [hollyhock]: //hollyhock.sorantics.com diff --git a/pre-commit.sh b/pre-commit.sh new file mode 100755 index 0000000..aeb4b9c --- /dev/null +++ b/pre-commit.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +make lint diff --git a/requirements.yaml b/requirements.yaml new file mode 100644 index 0000000..1c58833 --- /dev/null +++ b/requirements.yaml @@ -0,0 +1,7 @@ +collections: + - name: ansible.posix + version: ">=2.1.0,<2.2" + - name: community.crypto + version: ">=3.2.0,<3.3" + - name: community.general + version: ">=12.5.0,<12.6" @@ -425,7 +425,7 @@ dev = [ { name = "ansible", specifier = ">=13.7.0,<13.8" }, { name = "ansible-core", specifier = ">=2.20.6,<2.21" }, { name = "ansible-dev-tools", specifier = ">=26.4.6,<26.5" }, - { name = "passlib", specifier = ">=1.7.4" }, + { name = "passlib", specifier = ">=1.7.4,<1.8" }, ] [[package]] |
