Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ppat committed Apr 27, 2024
0 parents commit 1e27cba
Show file tree
Hide file tree
Showing 16 changed files with 8,281 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# .ansible-lint
profile: safety

exclude_paths:
- .github/

use_default_rules: true

skip_list:
- name[casing]
- name[template]
- package-latest
- jinja[spacing]

enable_list:
- args
- empty-string-compare # opt-in
- no-log-password # opt-in
- no-same-owner # opt-in
- name[prefix] # opt-in

warn_list:
- var-naming[no-role-prefix]
2 changes: 2 additions & 0 deletions .ansible-lint-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file contains ignores rule violations for ansible-lint
packages/roles/install_from_url/tasks/main.yaml var-naming[no-role-prefix]
98 changes: 98 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:best-practices",
"group:linters"
],
"packageRules": [
{
"groupName": "all ansible-galaxy non-major dependencies",
"groupSlug": "ansible-galaxy-non-major-deps",
"matchManagers": [
"ansible-galaxy"
],
"matchUpdateTypes": [
"minor",
"patch"
]
},
{
"groupName": "all ansible-galaxy major dependencies",
"groupSlug": "ansible-galaxy-deps",
"matchManagers": [
"ansible-galaxy"
],
"matchUpdateTypes": [
"major"
]
},
{
"groupName": "all github-action dependencies",
"groupSlug": "github-actions-deps",
"matchFileNames": [
".github/workflows/**"
]
},
{
"groupName": "all npm non-major dependencies",
"groupSlug": "npm-non-major-deps",
"matchManagers": [
"npm"
],
"matchUpdateTypes": [
"minor",
"patch"
]
},
{
"groupName": "all npm major dependencies",
"groupSlug": "npm-deps",
"matchManagers": [
"npm"
],
"matchUpdateTypes": [
"major"
]
},
{
"groupName": "all python non-major dependencies",
"groupSlug": "python-non-major-deps",
"matchManagers": [
"pip_requirements",
"poetry"
],
"matchUpdateTypes": [
"minor",
"patch"
]
},
{
"groupName": "all python major dependencies",
"groupSlug": "python-deps",
"matchManagers": [
"pip_requirements",
"poetry"
],
"matchUpdateTypes": [
"major"
]
},
{
"matchPackageNames": [
"ansible-lint",
"molecule",
"molecule-plugins"
],
"matchManagers": [
"pip_requirements",
"poetry"
],
"allowedVersions": "<24"
}
],
"prHourlyLimit": 10,
"prConcurrentLimit": 20,
"semanticCommits": "enabled",
"separateMajorMinor": true,
"separateMultipleMajor": false
}
101 changes: 101 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
name: Lint all

# yamllint disable-line rule:truthy
on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Set package architecture based on runner architecture
run: |
[[ "$RUNNER_ARCH" == "ARM64" ]] && echo "PKG_ARCH=arm64" || echo "PKG_ARCH=amd64" >> $GITHUB_ENV
env:
RUNNER_ARCH: ${{ runner.arch }}

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0

- name: Set up python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
requirements.txt
- name: Set up node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: 20

- name: Install python requirements
run: python -m pip install -r requirements.txt

- name: Install node packages
run: npm ci

- name: Install pre-commit hooks
run: pre-commit install --install-hooks --hook-type pre-commit

- name: Install actionlint
run: |
wget --progress=dot:giga -c https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_${PKG_ARCH}.tar.gz -O /tmp/actionlint.tar.gz
tar -xzvf /tmp/actionlint.tar.gz -C /tmp
sudo install -o root -g root -m 0755 /tmp/actionlint /usr/local/sbin/actionlint
working-directory: /tmp
env:
ACTIONLINT_VERSION: 1.6.26

- name: check-added-large-files
run: pre-commit run --all-files check-added-large-files

- name: check-executables-have-shebangs
run: pre-commit run --all-files check-executables-have-shebangs

- name: check-json
run: pre-commit run --all-files check-json

- name: check-shebang-scripts-are-executable
run: pre-commit run --all-files check-shebang-scripts-are-executable

- name: detect-private-key
run: pre-commit run --all-files detect-private-key

- name: end-of-file-fixer
run: pre-commit run --all-files end-of-file-fixer

- name: forbid-new-submodules
run: pre-commit run --all-files forbid-new-submodules

- name: mixed-line-ending
run: pre-commit run --all-files mixed-line-ending

- name: trailing-whitespace
run: pre-commit run --all-files trailing-whitespace

- name: shellcheck
run: pre-commit run --all-files shellcheck

- name: yamllint
run: yamllint -c .yamllint --strict --format github .

- name: actionlint
run: actionlint -shellcheck "shellcheck -c .shellcheckrc"

- name: ansible-lint
run: ansible-lint -c .ansible-lint -i .ansible-lint-ignore .

- name: commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
48 changes: 48 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Release

# yamllint disable-line rule:truthy
on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 5
name: "create release"
steps:
- name: Check out
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
token: "${{ secrets.GH_RELEASE_TOKEN }}"
fetch-depth: 0

- name: Set up python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
requirements.txt
- name: Install python requirements
run: python -m pip install -r requirements.txt

- name: Set up node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: 20

- name: Install node packages
run: npm ci

- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}

- name: Determine release version
run: echo "RELEASED_VERSION=$(cat /tmp/released.version | cut -d'v' -f2)" >> $GITHUB_ENV
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# python
.cache
.eggs/
.Python
build/
eggs/
dist/
sdist/
wheels/
*.egg-info/
*.egg
*.pyc
**/__pycache__
MANIFEST

# python testing
.coverage
.coverage.*
.hypothesis/
.nox/
.pytest_cache/
.tox/
coverage.xml
htmlcov/
cover/

# node
node_modules/
41 changes: 41 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: check-json
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- id: end-of-file-fixer
- id: forbid-new-submodules
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
hooks:
- id: yamllint
args: [--strict]
- repo: https://github.com/ansible/ansible-lint
rev: v6.22.1
hooks:
- id: ansible-lint
args: ["--skip-list=yaml,jinja"]
stages:
- manual
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.9.0
hooks:
- id: shellcheck
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.10.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies:
- '@commitlint/config-conventional'
- '@commitlint/ensure'
- 'commitlint-plugin-function-rules'
args: ['--verbose']
Loading

0 comments on commit 1e27cba

Please sign in to comment.