Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Checks (#26)
Browse files Browse the repository at this point in the history
*  pre-commit
* pre-commit action
  • Loading branch information
bbaassssiiee authored Nov 6, 2024
1 parent 4540eee commit a3880c6
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 2 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# https://ansible-lint.readthedocs.io/en/latest/default_rules/
exclude_paths:
- galaxy_roles/
- .github/

skip_list:
- experimental # all rules tagged as experimental
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.1
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# https://pre-commit.com/hooks.html
default_language_version:
python: python3
exclude: >
.github
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: detect-private-key
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: [-c=.yamllint]

- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0 # or specific git tag
hooks:
- id: forbid-binary
exclude: >
(?x)^(
screenshot.png
)$
- id: git-check
- id: script-must-have-extension
- id: shellcheck
- id: shfmt
2 changes: 2 additions & 0 deletions ansible.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
# Just `source ./ansible.rc`
deactivate
rm -rf ~/.py3
python3.12 -m venv ~/py3
# shellcheck source=/dev/null
source ~/py3/bin/activate
pip install --upgrade pip wheel
pip install -r requirements.txt
1 change: 0 additions & 1 deletion inventory/test/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ controller ansible_host=10.0.0.206
controller ansible_host=10.0.0.206
[web]
controller ansible_host=10.0.0.206

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
ansible-core<2.17.0
ansible-lint
docker
pre-commit==4.0.1
1 change: 0 additions & 1 deletion roles/semaphore/templates/semaphore.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ TimeoutStopSec=60

[Install]
WantedBy=multi-user.target

0 comments on commit a3880c6

Please sign in to comment.