Skip to content

Commit

Permalink
Added github workflow
Browse files Browse the repository at this point in the history
This workflow include the tox linters run.
This will detect the errors when we will push
code to the master branch or create pr against
master branch.

Signed-off-by: Amol Kahat <[email protected]>
  • Loading branch information
amolkahat committed Feb 15, 2022
1 parent 77975f7 commit 9a63c1c
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: "Cibyl CI"
on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "Setup Python"
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
pip install tox
- name: "Run tox"
run: tox
63 changes: 63 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
default_language_version:
python: python3
minimum_pre_commit_version: "1.14.0"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: end-of-file-fixer
exclude: '^ci-scripts/infra-setup/roles/rrcockpit/files/grafana/.*\.json$' # noqa
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-byte-order-marker
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: debug-statements
- id: check-json
- id: check-yaml
files: .*\.(yaml|yml)$
# https://github.com/pre-commit/pre-commit-hooks/issues/273
args: ["--unsafe"]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.1.4
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8.git
rev: 3.8.3
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.5.3
hooks:
- id: pylint
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.24.2
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict -f parsable
- repo: https://github.com/ansible/ansible-lint.git
rev: v5.3.2
hooks:
- id: ansible-lint
always_run: true
pass_filenames: false
# do not add file filters here as ansible-lint does not give reliable
# results when called with individual files.
# https://github.com/ansible/ansible-lint/issues/611
verbose: true
entry: bash -c "ANSIBLE_LIBRARY=plugins/modules ansible-lint --force-color -p -v" # noqa
- repo: https://github.com/openstack-dev/bashate.git
rev: 2.0.0
hooks:
- id: bashate
entry: bashate --error . --ignore=E006,E040
# Run bashate check for all bash scripts
# Ignores the following rules:
# E006: Line longer than 79 columns (as many scripts use jinja
# templating, this is very difficult)
# E040: Syntax error determined using `bash -n` (as many scripts
# use jinja templating, this will often fail and the syntax
# error will be discovered in execution anyway)
33 changes: 33 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# Based on ansible-lint config
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# cibyl
# cibyl
22 changes: 22 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tox]
minversion = 3.8.0
envlist = linters
skipsdist = True
ignore_basepython_conflict = True
skip_missing_interpreters = False
requires =
tox-extra; python_version >= '3.8'

[testenv]
usedevelop = True
install_cmd = pip install -U {opts} {packages}

[testenv:linters]
deps =
pre-commit>=1.21.0
commands =
python -m pre_commit run -a

[gh-actions]
python =
3.9: py39

0 comments on commit 9a63c1c

Please sign in to comment.